Create preprocessing module - #188
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
|
Thanks a lot, @brady-ryan! Unfortunately, there is no way around getting the tests passed. However, I would also prefer not to depend on/use |
… remove bad candidates, update docs and requirements, remove AstroObjectAnalyser dependency
for more information, see https://pre-commit.ci
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #188 +/- ##
===========================================
+ Coverage 99.95% 100.00% +0.04%
===========================================
Files 15 18 +3
Lines 2139 2827 +688
===========================================
+ Hits 2138 2827 +689
+ Misses 1 0 -1
🚀 New features to boost your workflow:
|
|
@ajshajib, these new updates remove the dependency on @ahuang314, I have added Other optimizations include:
If we like this current structure, then I will proceed forward with finishing the test functions! |
|
@brady-ryan, just a quick comment (I can give a more thorough look a little later), it looks like there is a dependency on SourceExtractor. I would prefer to avoid that. If I remember correctly, it involved the installation of a Fortran code and its Python wrapper, so it's rather complicated, which can be replaced with Astropy functionalities. For example, look at my notebook, which uses only Python. Is SourceExtractor only needed to compute the background rms, or for something else too? Background rms can also be computed using astropy. |
Hi @ajshajib, alongside background estimation, Source Extractor is used to build a catalog of source objects within the full mosaic. After this, a masking criterion is utilized to select candidate PSF stars from the catalog. I see in your notebook that you also used Astropy to find candidate stars, so, if you prefer, I can rewrite *Edit - you use photutils for the background and retrieving candidate stars, not Astropy. I suppose that would still be preferable to Source Extractor. |
|
Yes, using a fully Pythonic method will be preferable, so astropy/photutils over SourceExtractor is preferred. |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
|
View / edit / reply to this conversation on ReviewNB ajshajib commented on 2026-07-17T05:17:41Z Dolphin
D should be in small letter in dolphin. Please fix everywhere else in the notebook. |
|
View / edit / reply to this conversation on ReviewNB ajshajib commented on 2026-07-17T05:17:42Z Modify the requirement for the full science image to be put in the io_directory, as per my other comment in the code. |
|
View / edit / reply to this conversation on ReviewNB ajshajib commented on 2026-07-17T05:17:42Z What's the utility of having flux values on top of each panel. If there's none, better to remove it to keep things cleaner. Otherwise, please state the utility for the users. brady-ryan commented on 2026-07-25T18:15:18Z This was leftover from when I sorted objects by magnitude with Source Extractor. Indeed, it is no longer necessary here. |
|
View / edit / reply to this conversation on ReviewNB ajshajib commented on 2026-07-17T05:17:43Z Is it very necessary to provide custom masks made by hand? In my experience, I have never come across a situation where making a custom mask was worth the time, instead I could simply choose some other stars for the PSF. Easy to make masks can be made on the fly through |
|
View / edit / reply to this conversation on ReviewNB ajshajib commented on 2026-07-17T05:17:44Z their documentation Make this a linked text pointing to the doc's url. |
|
View / edit / reply to this conversation on ReviewNB ajshajib commented on 2026-07-17T05:17:44Z STARRED documentation
Please make it linked to the URL. |
…ctory, new function to clean PSF workspace, remove cosmoHammer from requirements, update example notebook
for more information, see https://pre-commit.ci
|
This was leftover from when I sorted objects by magnitude with Source Extractor. Indeed, it is no longer necessary here. View entire conversation on ReviewNB |
|
Hi @ajshajib, thank you again for the comments and suggestions. Apologies for the delay in addressing them, I was away this week. Anyways, I have modified the workflow such that the user provides the star cutouts and noise map cutouts directly into the PSF fitting functions. Previously, the user would need to save the data first, and it would be automatically reloaded with the fitting functions. As per your suggestion, one no longer needs to save the cutouts. I have also implemented a cleaning function for those who may want to save the cutouts initially, but then remove them before transfer between computers with The example notebook has been modified accordingly to reflect these changes. I also added a few sentences at the start to discuss the STARRED vs. PSFr results from Millon et al. (2024), recommending the user to utilize the STARRED methodology. Lastly, there seem to be some new errors in |
change kwargs_optim to kwargs_optimizer Co-authored-by: Anowar Shajib <ajshajib@uchicago.edu>
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
…ng one (otherwise the other test functions are affected)
|
Hi @ajshajib, I thought it appropriate that as the *Edit - all new code now covered by test functions. |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
This PR implements a preprocessing module whose usefulness is twofold. Firstly, the
ImageCutoutclass provides a user-friendly interface for making a cutout from the full science mosaic and generating the necessarykwargs_datadictionary. Secondly, this PR eases and accelerates the creation of a PSF from a full science mosaic. It includes:psf.py: the core PSF preprocessing modulepreprocessing_util.py: utility module which includes some functions that are shared betweenPSFand theImageCutoutpreprocessing class.test_psf.py: an initial suite of test functions. At the moment, the entire code is probably not covered, just the main components while we discuss what changes/modifications might be necessary.test_preprocessing.py: an initial suite of test functions for the preprocessing_util module.files.py: additions for preprocessing I/OExample of PSF.ipynb: example notebook walking through the creation of a PSF with both the PSFr and STARRED methodologies.image_cutout.py: the core Image cutout preprocessing moduletest_image_cutout: suite of test functions forImageCutoutExample of Image Cutout.ipynb: example walking through using theImageCutoutto create a science image.requirements.txt: includes the required software for PSF preprocessing.