twillis449 / radio_source_analysis

MIT License
2 stars 0 forks source link

Painting of subtracted sources function #3

Closed Kincaidr closed 2 years ago

Kincaidr commented 2 years ago

Hi Tony,

I have been in the loop of some of your emails and have seen that you have added a technique to fill subtracted sources from background interpolation through the scripts FMM_inpainting.py and pyheal.py.

My question is how I would use this function when running the script? I currently run this command to get my images: get_galaxy_parameters.py zwcl2341.csv F T F 6.

This image contains holes in the diffuse structure which I want to fill.

Thanks!

twillis449 commented 2 years ago

FMM_inpainting.py is a separate program. In your case, you should just be able to run FMM_inpainting.py zwcl2341.csv

(Also, make sure that your radio_source_analysis code directory is up=to-date. I was not writing out mask files for a while, but they are needed for FMM_inpainting.py)

Kincaidr commented 2 years ago

When i give the subtracted image from the command get_morphology_images.py zwcl2341.csv 3 D 6 F F as input to the FMM_inpainting.py script the output looks the same.

I am trying to do what you showed in email:

image

twillis449 commented 2 years ago

Its working perfectly :)

Assuming that the left and right images are to exactly the same intensity scale, with the left image being the inpainted one, note how all the holes in the middle of the diffuse image have been filled in. Also that head-tail galaxy near the centre of the image looks like it has some actual emission surrounding the area that was cut out and look how it has been filled in the the left image The fairly large hole near the top of the image has some slight emission just to the left of the holr's edge and look how emission has been filled into that area in the left image.

By the way - Viral sent me this field a while ago and at is one of the images I have been using as a test-bed for the entire process - I will send you my version a bit later as its on a different computer,

Kincaidr commented 2 years ago

Yes this is not what I have produced, it is directly from the email.

I am asking what you did to produce the right image from the left. If I just use the FMM_inpainting.py on the right image it still comes out the same.

twillis449 commented 2 years ago

Ah _OK. I see that you are looking for. My csv file contains the line Viral_P 355.91541666667 0.33083333333333 , along with some other stuff, so in my case, I need to make the soft link Viral_P.fits -> Viral_P_final_image.fits (and in my case Viral_P_final_image.fits is just another soft link to Viral_P_diffuse_structure_dilated.fits. FMM_inpainting will open Viral_P.fits along with the mask file Viral_P-dilated_tophat.mask.fits. FMM_inpainting then fills in the areas of Viral_P.fits where the mask file has values of 1. The output is then put into Viral_P_CV_FMM_inpaint_result.fits (as I am using OpenCV) So in your image above Viral_P.fits corresponds to the right image and the inpainted image is the one on the left.

Kincaidr commented 2 years ago

ok i see how it works now. I also have final_image soft linked to diffuse_structure_dilated. And will need to soft link of zwcl.fits to final_image like you mentioned for the naming conventions to work. But how would I do this since it tells me that the file already exists? See below:

image

I need to soft link the two highlighted in green

twillis449 commented 2 years ago

So you can delete the zwc12341.fits
rm zwcl12341.fits and then re-assign it with ln -s zwci12341_final_image.fits zwcl12341.fits

Kincaidr commented 2 years ago

Works now, thanks!

twillis449 commented 2 years ago

I decided that it was stupid to have to reassign the soft link in this case. So I have updated FMM_inpainting so that it will look directly for the name+ 'final_image.fits' file directly in the code the same way it has to look for the name +_dilated_tophat.mask.fits' masking file.