spacetelescope / mirage

This code can be used to generate simulated NIRCam, NIRISS, or FGS data
https://mirage-data-simulator.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
39 stars 41 forks source link

Download Niriss ghost file from niriss_ghost repository #753

Closed bhilbert4 closed 2 years ago

bhilbert4 commented 2 years ago

This PR changes where Mirage gets the niriss ghost gap file from. Rather than being included in the Mirage repository, the file is now downloaded from the niriss_ghost repository and placed in Mirage's config subdirectory. With this, we now treat the niriss_ghost repository as containing the master copy of this file.

At the moment, Mirage is set up to download the file only if it does not already exist in the config subdirectory. But then how would a user know that there is an updated version of the file in the niriss_ghost repo and delete their local copy of the file? Perhaps, since this is a tiny ascii file, Mirage should always download a new copy of the file whenever it creates a NIRISS simulation that will include ghosts.

bhilbert4 commented 2 years ago

Updated to download the niriss ghost gap file each time Mirage runs. This will ensure that the latest version is always being used.

bhilbert4 commented 2 years ago

@mtakahiro should I bother merging this PR? This will have Mirage download the gap file each time it runs. Or should I abandon this and wait for the update that will use the niriss_ghost repo instead? The only reason I can think of to merge this one would be if there are people currently making NIRISS simulations that use the new filters in the updated gap file, and they want to get ghosts in now. I'm happy to do either.

mtakahiro commented 2 years ago

@bhilbert4 yes please go ahead. I'm not sure how long the other option will take. Your solution actually meets our requirements at least for now.

bhilbert4 commented 2 years ago

Great! Would you tick the box as the official reviewer? You can see in constants.py that I've hardcoded the URL to the gap file, and then use download_file() to download it early in the seed image creation process.