Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CleanBadPixels not working #78

Open
lgrcia opened this issue May 11, 2023 · 3 comments
Open

CleanBadPixels not working #78

lgrcia opened this issue May 11, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@lgrcia
Copy link
Owner

lgrcia commented May 11, 2023

  • Bad loader option in CleanBadPixels
  • The pixel map is not built properly...
@lgrcia lgrcia added the bug Something isn't working label May 11, 2023
@lgrcia lgrcia changed the title Bad loader option in CleanBadPixels CleanBadPixels not working May 11, 2023
@mathvdd
Copy link

mathvdd commented Sep 14, 2023

Hello Lionel,

Is still still an issue in the current version? It looks like working for me

Edit: did you consider correcting bad pixels with NaN values? Is that even possible with a fits file? I guess that could bring compatibility issue with other blocks in prose?

Edit2: I did some more tries with different TRAPPIST-South darks to look for best results. I find that with low exptime (~10s) darks the detection is not good, and with high exptime (1500s) there is more artifacts in the bpm (with about 5 dark frames). I scaled up using 358 frames of 240s darks, I arrive to satisfactory results if I used an already previously compiled master dark (with the Calibration block), getting around 90% of bad pixels corrected on the image I used and no wrong bpm in the bpm map. Using a list of the same dark frames as input of the bpm block, the result is not good, i guess because (if I read well your code ;)) it compares the extreme values of the images one by one and therefore is more susceptible to add other artifacts in the bpm map.

ba
Before and after the correction with the master dark bpm

bpm
Difference in the bpm map made with one master dark and a list of the same darks used for the master

bpmandim
Comparison between the master dark bpm map and the uncorrected image

Median averaging the frame in this block (or inputting the master dark directly) before doing the detection could I think improve the result

by "Bad loader option in CleanBadPixels" you mean it should be improved to take a list of path etc as other blocks instead of a list of np matrices?

@lgrcia
Copy link
Owner Author

lgrcia commented Sep 20, 2023

Thanks for the thorough analysis @mathvdd. This block was developed and tested for a single instrument and I am even surprised it is useful at all on TRAPPIST data. Could you create a new block with your preferred way of dealing with bad pixels? This way we could come up with a more general and useful option :)

@mathvdd
Copy link

mathvdd commented Sep 21, 2023

Hello @lgrcia , this is a block based on your CleanBadPixel block. The only thing I changed is that it compiles a master dark using the Calibration block to base the BPM on rather than comparing min and max of each individual darks. This works better for me but there is probably room for improvement as I don't have much experience in this.

3ef9455

I did not try with flats yet. I am not sure to understand this part of the code (lines 499 to 503):

if len(bad_flats) == 2:
    self.bad_pixels = (
        np.hstack([self.bad_pixels[0], bad_flats[0]]),
        np.hstack([self.bad_pixels[1], bad_flats[1]]),
        )

Is that just the normal way to add the 2 BPM made from the dark and flats?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants