dsavransky / EXOSIMS

Simulator for exoplanet direct imaging space missions
BSD 3-Clause "New" or "Revised" License
27 stars 40 forks source link

koMap incorrect for same star in 2 different star catalogs #264

Closed deanthedream closed 2 years ago

deanthedream commented 3 years ago

It's not urgent, but it might be a good idea to update the public documentation of EXOSIMS to avoid any confusion. Stars are sometimes in one catalogue or another, with HIP label or without. That's why I wanted to try a large catalogue with all the RV and SL targets we have. Can someone remind me somewhere in EXOSIMS documentation on how to import SIMBAD catalogue in EXOSIMS? Or a sample script.

There is another reason why I was trying to load different catalogues (Let me loop Dean and Vanessa in):

As you know, Vanessa and I are using EXOSIMS and CGI Perf to review some DRM targets. One feature that we would like to understand is why the same star in two different catalogues, with the same coordinates, gives rise to two completely different keep out results. This happens for two targets of a few we are using: HD 134987 and HD 219134. I was able to find HD 134987 in two catalogues: KnownRVPlanets and KeplerLike that Keith shared with me. In the first one, both seem to show 100% accessibility. In the Kepler on, HD 134987 shows 29.9% (closer to a first estimate of 38% based on some Vanessa's tool).

I attach the script that Dean shared with me and the two json scripts for each case. They run out of the box. I hope Dean, or someone, may take a look and let me know what you think. The coordinates agree quite well, although the star's distance is different (26.21 pc is compatible with SIMBAD or https://exoplanetarchive.ipac.caltech.edu, and 22.2 (I think http://exoplanet.eu/catalog/ jas that but it is down right now ...).

Hope I just missed something obvious. Many thanks!

Sergi

Short summary (longer at the end):

Notice that HIP 74500 = HD 134987


Full details:

Run with "test1"

No-parallel: resetting SurveyEnsemble to Prototype Imported SurveySimulation (prototype module) from EXOSIMS.Prototypes.SurveySimulation Numpy random seed is: 504142085 Imported KeplerLikeUniverse (specific module) from EXOSIMS.SimulatedUniverse.KeplerLikeUniverse Imported TargetList (prototype module) from EXOSIMS.Prototypes.TargetList Imported EXOCAT1 (specific module) from EXOSIMS.StarCatalog.EXOCAT1 Imported Nemati (specific module) from EXOSIMS.OpticalSystem.Nemati Imported Stark (specific module) from EXOSIMS.ZodiacalLight.Stark Imported PostProcessing (prototype module) from EXOSIMS.Prototypes.PostProcessing Imported GalaxiesFaintStars (specific module) from EXOSIMS.BackgroundSources.GalaxiesFaintStars Imported Completeness (prototype module) from EXOSIMS.Prototypes.Completeness Imported KeplerLike2 (specific module) from EXOSIMS.PlanetPopulation.KeplerLike2 Imported Forecaster (specific module) from EXOSIMS.PlanetPhysicalModel.Forecaster Calculating target stellar masses. Imported WFIRSTObservatoryL2 (specific module) from EXOSIMS.Observatory.WFIRSTObservatoryL2 Imported TimeKeeping (prototype module) from EXOSIMS.Prototypes.TimeKeeping OBendTimes is: [1095.75] d Limiting delta magnitude for mode syst: HLC-565 inst: imager is 25.510299866805603 Limiting delta magnitude for mode syst: SPC-660 inst: spectro is 22.25772487764565 Loading cached keepout map file from /Users/srhildeb/.EXOSIMS/cache/koMap_aed79454e49847afa8f95c13e5b95d3e.komap Keepout Map loaded from cache. Loading cached fZ from /Users/srhildeb/.EXOSIMS/cache/CompletenessTargetListNemati8d483cf138ace95805eba8c90c9e65b7.starkfZ Loading cached fZQuads from /Users/srhildeb/.EXOSIMS/cache/CompletenessTargetListNemati8d483cf138ace95805eba8c90c9e65b7.fZmin Imported SurveyEnsemble (prototype module) from EXOSIMS.Prototypes.SurveyEnsemble /Users/srhildeb/opt/anaconda3/lib/python3.8/site-packages/erfa/core.py:154: ErfaWarning: ERFA function "utctai" yielded 1 of "dubious year (Note 3)" warnings.warn('ERFA function "{}" yielded {}'.format(func_name, wmsg), Star HIP 74500 Completeness: 29.93 % <SkyCoord (ICRS): (ra, dec, distance) in (deg, deg, pc) [(228.37051, -25.309164, 26.21)]>

Run with "test2"

Imported KnownRVPlanetsUniverse (specific module) from EXOSIMS.Simulat[...]se.KnownRVPlanetsUniverse Imported KnownRVPlanetsTargetList (specific module) from EXOSIMS.TargetList.KnownRVPlanetsTargetList Imported EXOCAT1 (specific module) from EXOSIMS.StarCatalog.EXOCAT1 Imported Nemati_2019 (specific module) from EXOSIMS.OpticalSystem.Nemati_2019 Imported Stark (specific module) from EXOSIMS.ZodiacalLight.Stark Imported PostProcessing (prototype module) from EXOSIMS.Prototypes.PostProcessing Imported GalaxiesFaintStars (specific module) from EXOSIMS.BackgroundSources.GalaxiesFaintStars Imported Completeness (prototype module) from EXOSIMS.Prototypes.Completeness Imported KnownRVPlanets (specific module) from EXOSIMS.PlanetPopulation.KnownRVPlanets Imported Forecaster (specific module) from EXOSIMS.PlanetPhysicalModel.Forecaster /Users/srhildeb/opt/anaconda3/lib/python3.8/site-packages/numpy/core/fromnumeric.py:748: UserWarning: Warning: 'partition' will ignore the 'mask' of the MaskedArray. a.partition(kth, axis=axis, kind=kind, order=order) Imported WFIRSTObservatoryL2 (specific module) from EXOSIMS.Observatory.WFIRSTObservatoryL2 Imported TimeKeeping (prototype module) from EXOSIMS.Prototypes.TimeKeeping OBendTimes is: [1095.75] d Limiting delta magnitude for mode syst: HLC-565 inst: imager is 25.510299866805603 Limiting delta magnitude for mode syst: SPC-660 inst: spectro is 22.25772487764565 Loading cached keepout map file from /Users/srhildeb/.EXOSIMS/cache/koMap_9e3965cda06ea5e5228afd0bde98832d.komap Keepout Map loaded from cache. Loading cached fZ from /Users/srhildeb/.EXOSIMS/cache/CompletenessKnownRVPlanetsTargetListNemati_2019cc51596884358bea5e0b264779aab39f.starkfZ Loading cached fZQuads from /Users/srhildeb/.EXOSIMS/cache/CompletenessKnownRVPlanetsTargetListNemati_2019cc51596884358bea5e0b264779aab39f.fZmin Imported SurveyEnsemble (prototype module) from EXOSIMS.Prototypes.SurveyEnsemble /Users/srhildeb/opt/anaconda3/lib/python3.8/site-packages/erfa/core.py:154: ErfaWarning: ERFA function "utctai" yielded 1 of "dubious year (Note 3)" warnings.warn('ERFA function "{}" yielded {}'.format(func_name, wmsg), Star HD 134987 Completeness: 100.00 % <SkyCoord (ICRS): (ra, dec, distance) in (deg, deg, pc) [(228.36945, -25.309347, 22.2)]>

deanthedream commented 3 years ago

To check first: I looked at Prototypes/Observatory.py line ~555 where the cachename is defined for the keepout map. It looks like the Star Catalog is omitted from the cached filename for keepout maps. Adding in the star catalog name and universe name should be sufficient.

hsergi commented 3 years ago

Hi Dean, is this issue resolved? We are going to deliver the Roman CGI ETC in 2 weeks from now (10/28) publicly.

deanthedream commented 3 years ago

I wrote the following script to test this issue and found no issues on the SolarSystemPlanetPop branch. The last line confirms that each time in the keepout map the two planets have identical keepout maps. The only changes in SolarSystemPlanetPop branch relevant to this is the explicit addition of some attributes in the file caching. My original suspicion was that file caching was the issue, Dmitry thought otherwise, this script works with SolarSystemPlanetPop branch.

`#testing same stars in different catalogs having different KOMaps

import sys, os.path, EXOSIMS, EXOSIMS.MissionSim, json import numpy as np import copy from copy import deepcopy import astropy.units as u

outspec1 = {"missionFinishAbs": 61729.75, "missionLife": 3.0, "missionPortion": 0.195, "missionSchedule": None, "missionStart": 60634.0, "scienceInstruments": [ { "name": "imagingEMCCD", "QE": 0.9, "optics": 0.28, "FoV": 0.75, "pixelNumber": 105, "pixelSize": 13e-6, "sread": 0, "idark": 3e-5, "CIC": 1.3e-3, "texp": 100, "ENF": 1, "PCeff": 0.75 }, { "name": "imagingRedEMCCD", "QE": 0.9, "optics": 0.42, "FoV": 1.1, "pixelNumber": 104, "pixelSize": 13e-6, "sread": 0, "idark": 3e-5, "CIC": 1.3e-3, "texp": 100, "PCeff": 0.75, "ENF": 1 }, { "name": "spectroEMCCD", "QE": 0.9, "FoV": 0.8, "optics": 0.27, "pixelNumber": 102, "pixelSize": 12e-6, "core_platescale": 0.1, "lenslSamp": 2, "sread": 0, "idark": 3e-5, "CIC": 2.1e-3, "texp": 300, "ENF": 1, "Rs": 140, "PCeff": 0.9 } ], "starlightSuppressionSystems": [ { "name": "VVC500", "lam": 500, "IWA": 0.045, "OWA": 2.127, "ohTime": 0.1, "BW": 0.20, "optics": 0.95, "optics_comment": "contamination", "core_platescale": 0.1, "koAngles_Earth": [ 45.0, 180.0 ], "koAngles_Moon": [ 45.0, 180.0 ], "koAngles_Small": [ 1.0, 180.0 ], "koAngles_Sun": [ 45.0, 124.0 ] } ], "observingModes": [ { "instName": "imagingEMCCD", "systName": "VVC500", "detection": 1, "SNR": 7 }, { "instName": "imagingRedEMCCD", "systName": "VVC500", "detection": 1, "lam": 745, "SNR": 7 } ], "modules": { "PlanetPopulation": "KeplerLike2", "StarCatalog": "EXOCAT1", "OpticalSystem": " ", "ZodiacalLight": " ", "BackgroundSources": " ", "PlanetPhysicalModel": "FortneyMarleyCahoyMix1", "Observatory": "WFIRSTObservatoryL2", "TimeKeeping": " ", "PostProcessing": " ", "Completeness": " ", "TargetList": " ", "SimulatedUniverse": "KeplerLikeUniverse", "SurveySimulation": " ", "SurveyEnsemble": " " }}

outspec2 = {"missionFinishAbs": 61729.75, "missionLife": 3.0, "missionPortion": 0.195, "missionSchedule": None, "missionStart": 60634.0, "scienceInstruments": [ { "name": "imagingEMCCD", "QE": 0.9, "optics": 0.28, "FoV": 0.75, "pixelNumber": 105, "pixelSize": 13e-6, "sread": 0, "idark": 3e-5, "CIC": 1.3e-3, "texp": 100, "ENF": 1, "PCeff": 0.75 }, { "name": "imagingRedEMCCD", "QE": 0.9, "optics": 0.42, "FoV": 1.1, "pixelNumber": 104, "pixelSize": 13e-6, "sread": 0, "idark": 3e-5, "CIC": 1.3e-3, "texp": 100, "PCeff": 0.75, "ENF": 1 }, { "name": "spectroEMCCD", "QE": 0.9, "FoV": 0.8, "optics": 0.27, "pixelNumber": 102, "pixelSize": 12e-6, "core_platescale": 0.1, "lenslSamp": 2, "sread": 0, "idark": 3e-5, "CIC": 2.1e-3, "texp": 300, "ENF": 1, "Rs": 140, "PCeff": 0.9 } ], "starlightSuppressionSystems": [ { "name": "VVC500", "lam": 500, "IWA": 0.045, "OWA": 2.127, "ohTime": 0.1, "BW": 0.20, "optics": 0.95, "optics_comment": "contamination", "core_platescale": 0.1, "koAngles_Earth": [ 45.0, 180.0 ], "koAngles_Moon": [ 45.0, 180.0 ], "koAngles_Small": [ 1.0, 180.0 ], "koAngles_Sun": [ 45.0, 124.0 ] } ], "observingModes": [ { "instName": "imagingEMCCD", "systName": "VVC500", "detection": 1, "SNR": 7 }, { "instName": "imagingRedEMCCD", "systName": "VVC500", "detection": 1, "lam": 745, "SNR": 7 } ], "modules": { "PlanetPopulation": "KnownRVPlanets", "StarCatalog": "EXOCAT1", "OpticalSystem": " ", "ZodiacalLight": " ", "BackgroundSources": " ", "PlanetPhysicalModel": " ", "Observatory": "WFIRSTObservatoryL2", "TimeKeeping": " ", "PostProcessing": " ", "Completeness": " ", "TargetList": "KnownRVPlanetsTargetList", "SimulatedUniverse": "KnownRVPlanetsUniverse", "SurveySimulation": " ", "SurveyEnsemble": " " }}

sim1 = EXOSIMS.MissionSim.MissionSim(outspec1)#scriptfile=scriptfile,nopar=True) sim2 = EXOSIMS.MissionSim.MissionSim(outspec2)

Notice that HIP 74500 = HD 134987

indIn1 = np.where(sim1.TargetList.Name == 'HIP 74500')[0] indIn2 = np.where(sim2.TargetList.Name == 'HD 134987')[0]

len(sim1.TargetList.Name) len(sim2.TargetList.Name)

sim1.SurveySimulation.koMaps['VVC500'].shape sim2.SurveySimulation.koMaps['VVC500'].shape

sim1.TargetList.coords[indIn1] sim2.TargetList.coords[indIn2]

verifies the two targets have the same keepout map

np.all(np.logical_not(sim1.SurveySimulation.koMaps['VVC500'][indIn1] == sim2.SurveySimulation.koMaps['VVC500'][indIn2]))`

deanthedream commented 3 years ago

I never replicated the original issue Sergi found.

hsergi commented 3 years ago

Thank you, Dean. Much appreciated. Ideally, master should handle accessibility w/o any issues, and it may. Not sure until I can find a time to test it. If you can run any further tests, keep me posted.

More thanks,

Sergi

On Thu, Oct 14, 2021 at 10:00 PM deanthedream @.***> wrote:

I wrote the following script to test this issue and found no issues on the SolarSystemPlanetPop branch. The last line confirms that each time in the keepout map the two planets have identical keepout maps. The only changes in SolarSystemPlanetPop branch relevant to this is the explicit addition of some attributes in the file caching. My original suspicion was that file caching was the issue, Dmitry thought otherwise, this script works with SolarSystemPlanetPop branch.

`#testing same stars in different catalogs having different KOMaps

import sys, os.path, EXOSIMS, EXOSIMS.MissionSim, json import numpy as np import copy from copy import deepcopy import astropy.units as u

outspec1 = {"missionFinishAbs": 61729.75, "missionLife": 3.0, "missionPortion": 0.195, "missionSchedule": None, "missionStart": 60634.0, "scienceInstruments": [ { "name": "imagingEMCCD", "QE": 0.9, "optics": 0.28, "FoV": 0.75, "pixelNumber": 105, "pixelSize": 13e-6, "sread": 0, "idark": 3e-5, "CIC": 1.3e-3, "texp": 100, "ENF": 1, "PCeff": 0.75 }, { "name": "imagingRedEMCCD", "QE": 0.9, "optics": 0.42, "FoV": 1.1, "pixelNumber": 104, "pixelSize": 13e-6, "sread": 0, "idark": 3e-5, "CIC": 1.3e-3, "texp": 100, "PCeff": 0.75, "ENF": 1 }, { "name": "spectroEMCCD", "QE": 0.9, "FoV": 0.8, "optics": 0.27, "pixelNumber": 102, "pixelSize": 12e-6, "core_platescale": 0.1, "lenslSamp": 2, "sread": 0, "idark": 3e-5, "CIC": 2.1e-3, "texp": 300, "ENF": 1, "Rs": 140, "PCeff": 0.9 } ], "starlightSuppressionSystems": [ { "name": "VVC500", "lam": 500, "IWA": 0.045, "OWA": 2.127, "ohTime": 0.1, "BW": 0.20, "optics": 0.95, "optics_comment": "contamination", "core_platescale": 0.1, "occ_trans": "$HOME/Documents/exosims/fitFilesFolder/HabExMay3/G_VC6_occ_trans_asec.fits", "core_thruput": "$HOME/Documents/exosims/fitFilesFolder/HabExMay3/G_VC6_core_thruput_asec.fits", "core_mean_intensity": "$HOME/Documents/exosims/fitFilesFolder/HabExMay3/G_VC6_core_mean_intensity_asec.fits", "occ_trans_local": "$HOME/Documents/exosims/fitFilesFolder/HabExMay3/G_VC6_occ_trans_asec.fits", "core_thruput_local": "$HOME/Documents/exosims/fitFilesFolder/HabExMay3/G_VC6_core_thruput_asec.fits", "core_mean_intensity_local": "$HOME/Documents/exosims/fitFilesFolder/HabExMay3/G_VC6_core_mean_intensity_asec.fits", "koAngles_Earth": [ 45.0, 180.0 ], "koAngles_Moon": [ 45.0, 180.0 ], "koAngles_Small": [ 1.0, 180.0 ], "koAngles_Sun": [ 45.0, 124.0 ] } ], "observingModes": [ { "instName": "imagingEMCCD", "systName": "VVC500", "detection": 1, "SNR": 7 }, { "instName": "imagingRedEMCCD", "systName": "VVC500", "detection": 1, "lam": 745, "SNR": 7 } ], "modules": { "PlanetPopulation": " ", "StarCatalog": "EXOCAT1", "OpticalSystem": " ", "ZodiacalLight": " ", "BackgroundSources": " ", "PlanetPhysicalModel": " ", "Observatory": "WFIRSTObservatoryL2", "TimeKeeping": " ", "PostProcessing": " ", "Completeness": " ", "TargetList": " ", "SimulatedUniverse": " ", "SurveySimulation": " ", "SurveyEnsemble": " " }}

outspec2 = {"missionFinishAbs": 61729.75, "missionLife": 3.0, "missionPortion": 0.195, "missionSchedule": None, "missionStart": 60634.0, "scienceInstruments": [ { "name": "imagingEMCCD", "QE": 0.9, "optics": 0.28, "FoV": 0.75, "pixelNumber": 105, "pixelSize": 13e-6, "sread": 0, "idark": 3e-5, "CIC": 1.3e-3, "texp": 100, "ENF": 1, "PCeff": 0.75 }, { "name": "imagingRedEMCCD", "QE": 0.9, "optics": 0.42, "FoV": 1.1, "pixelNumber": 104, "pixelSize": 13e-6, "sread": 0, "idark": 3e-5, "CIC": 1.3e-3, "texp": 100, "PCeff": 0.75, "ENF": 1 }, { "name": "spectroEMCCD", "QE": 0.9, "FoV": 0.8, "optics": 0.27, "pixelNumber": 102, "pixelSize": 12e-6, "core_platescale": 0.1, "lenslSamp": 2, "sread": 0, "idark": 3e-5, "CIC": 2.1e-3, "texp": 300, "ENF": 1, "Rs": 140, "PCeff": 0.9 } ], "starlightSuppressionSystems": [ { "name": "VVC500", "lam": 500, "IWA": 0.045, "OWA": 2.127, "ohTime": 0.1, "BW": 0.20, "optics": 0.95, "optics_comment": "contamination", "core_platescale": 0.1, "occ_trans": "$HOME/Documents/exosims/fitFilesFolder/HabExMay3/G_VC6_occ_trans_asec.fits", "core_thruput": "$HOME/Documents/exosims/fitFilesFolder/HabExMay3/G_VC6_core_thruput_asec.fits", "core_mean_intensity": "$HOME/Documents/exosims/fitFilesFolder/HabExMay3/G_VC6_core_mean_intensity_asec.fits", "occ_trans_local": "$HOME/Documents/exosims/fitFilesFolder/HabExMay3/G_VC6_occ_trans_asec.fits", "core_thruput_local": "$HOME/Documents/exosims/fitFilesFolder/HabExMay3/G_VC6_core_thruput_asec.fits", "core_mean_intensity_local": "$HOME/Documents/exosims/fitFilesFolder/HabExMay3/G_VC6_core_mean_intensity_asec.fits", "koAngles_Earth": [ 45.0, 180.0 ], "koAngles_Moon": [ 45.0, 180.0 ], "koAngles_Small": [ 1.0, 180.0 ], "koAngles_Sun": [ 45.0, 124.0 ] } ], "observingModes": [ { "instName": "imagingEMCCD", "systName": "VVC500", "detection": 1, "SNR": 7 }, { "instName": "imagingRedEMCCD", "systName": "VVC500", "detection": 1, "lam": 745, "SNR": 7 } ], "modules": { "PlanetPopulation": "KnownRVPlanets", "StarCatalog": "EXOCAT1", "OpticalSystem": " ", "ZodiacalLight": " ", "BackgroundSources": " ", "PlanetPhysicalModel": " ", "Observatory": "WFIRSTObservatoryL2", "TimeKeeping": " ", "PostProcessing": " ", "Completeness": " ", "TargetList": "KnownRVPlanetsTargetList", "SimulatedUniverse": "KnownRVPlanetsUniverse", "SurveySimulation": " ", "SurveyEnsemble": " " }}

sim1 = EXOSIMS.MissionSim.MissionSim(outspec1)#scriptfile=scriptfile,nopar=True) sim2 = EXOSIMS.MissionSim.MissionSim(outspec2) Notice that HIP 74500 = HD 134987

indIn1 = np.where(sim1.TargetList.Name == 'HIP 74500')[0] indIn2 = np.where(sim2.TargetList.Name == 'HD 134987')[0]

len(sim1.TargetList.Name) len(sim2.TargetList.Name)

sim1.SurveySimulation.koMaps['VVC500'].shape sim2.SurveySimulation.koMaps['VVC500'].shape

sim1.TargetList.coords[indIn1] sim2.TargetList.coords[indIn2]

verifies the two targets have the same keepout map

np.all(np.logical_not(sim1.SurveySimulation.koMaps['VVC500'][indIn1] == sim2.SurveySimulation.koMaps['VVC500'][indIn2]))`

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dsavransky/EXOSIMS/issues/264#issuecomment-944003726, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGXULAYCTBQBKJZ2KULJ6LUG6YNRANCNFSM4YPUNWYA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

-- Dr. Sergi Hildebrandt Rafels

Research Scientist Visiting Faculty/Lecturer in Physics Jet Propulsion Laboratory California Institute of Technology M/S 169-320 M/S 367-17 4800 Oak Grove Drive 1200, E. California Bvld. Pasadena, California 91109 Pasadena, California 91125 1-818-354-0220 1-626-395-3493

hsergi commented 3 years ago

I can't reproduce your example. It requires some FITS files in '$HOME/Documents/exosims/fitFilesFolder/HabExMay3/'. Hopefully, the pull request will be merged soon into master.

deanthedream commented 3 years ago

Sorry about that, I updated the comment by simply removing those lines of the outspec. I also missed that I did not specify KeplerLikeUniverse. Both of these have been fixed in the above script and I re-ran it getting the same result.