dsavransky / EXOSIMS

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

Phototometry branch: MeanStars: spectral class parsing #328

Closed turmon closed 1 year ago

turmon commented 1 year ago

Not a critical issue, I patched it outside the distribution, reported so it's not lost.

Describe the bug spectral class parsing throws error

To Reproduce Steps to reproduce the behavior: matchSpecType where spectral type is "G2/G3"

NB: seems OK with "G3/G5 V"

Expected behavior No throw

JSON script: Pasted. I'm using the standard Votable that comes with the distribution.

EXOSIMS version:

Additional context Error trace:

File "/proj/exep/rhonda/Sandbox/EXOSIMS-versions/Photometry2022/EXOSIMS/EXOSIMS/Prototypes/SimulatedUniverse.py", line 205, in init self.TargetList = get_module(specs["modules"]["TargetList"], "TargetList")( File "/proj/exep/rhonda/Sandbox/EXOSIMS-versions/Photometry2022/EXOSIMS/EXOSIMS/TargetList/KnownRVPlanetsTargetList.py", line 64, in init TargetList.init(self, **specs) File "/proj/exep/rhonda/Sandbox/EXOSIMS-versions/Photometry2022/EXOSIMS/EXOSIMS/Prototypes/TargetList.py", line 404, in init self.fillPhotometryVals() File "/proj/exep/rhonda/Sandbox/EXOSIMS-versions/Photometry2022/EXOSIMS/EXOSIMS/Prototypes/TargetList.py", line 952, in fillPhotometryVals tmp = self.ms.matchSpecType(s) File "/usr/local/anaconda3/envs/cornell-v2/lib/python3.10/site-packages/MeanStars/MeanStars.py", line 659, in matchSpecType specSubClass = np.array(tmp2).astype(float).mean() ValueError: could not convert string to float: ''


{ "ORIGIN": "Developed by Rhonda Morgan, 2016/08/24. Updated as EXOSIMS changed, 2016/09-2016/10. More modifications were made for integration time testing (turmon).", "missionLife": 0.10, "missionPortion": 1.0, "duration": 100, "keepStarCatalog": false, "rvplanetfilepath_comment": "This element of the specs dictionary is set in the calling python driver", "minComp": 0.1, "pupilDiam": 4, "obscurFac": 0, "focal": 120, "pitch": 5e-6, "dMagLim": 26.0, "telescopeKeepout": 45, "attenuation": 0.6333, "intCutoff": 100.0, "magZ": 23.34, "magEZ": 23.34, "varEZ_comment": "photometry testing: suppress randomization of exo-zodi by setting var = 0.", "varEZ": 0.0, "FAP": 3e-5, "MDP": 1e-3, "ppFact": 0.1, "prange": [0.2, 0.2], "erange": [0, 0.01], "wrange_note": "de-randomize the argument to perigee (gen_w in PlanetPopulation)", "wrange": [0.0, 0.0], "Orange_note": "de-randomize the long. of the ascending node (gen_O in PlanetPopulation)", "Orange": [0.0, 0.0], "scaleOrbits": false, "scienceInstruments": [ { "name": "imager-EMCCD", "QE": 0.91, "idark": 5e-4, "CIC": 3e-3, "sread": 0.2, "ENF": 1, "Gem": 450, "texp": 1000 }, { "name": "spectro-EMCCD", "QE": 0.91, "idark": 5e-4, "CIC": 3e-3, "sread": 0.2, "ENF": 1, "Gem": 450, "texp": 1000, "Rs": 70 } ], "starlightSuppressionSystems": [ { "name": "HLC-550", "IWA": 0.0709, "OWA": 0.7094, "lam": 550, "BW": 0.20, "occ_trans": 0.3471, "core_thruput": 0.02, "core_mean_intensity": 4e-14 }, { "name": "HLC-750", "IWA": 0.0709, "OWA": 0.7094, "ohTime": 0.02, "lam": 750, "occ_trans": 0.3471, "core_thruput": 0.02, "core_mean_intensity": 4e-14 } ], "observingModes": [ { "description": "index = 0, used for detection at 750nm", "instName": "imager-EMCCD", "systName": "HLC-750", "SNR": 5, "detectionMode": true }, { "description": "index = 1, used for characterization at 750nm", "instName": "spectro-EMCCD", "systName": "HLC-750", "SNR": 10, "detectionMode": false } ], "modules_comment": "Original SimulatedUniverse module was KnownRVPlanetsUniverse, changed to Deterministic for repeatable testing.", "modules": { "PlanetPopulation": "KnownRVPlanets", "StarCatalog": " ", "OpticalSystem": "Nemati", "ZodiacalLight": " ", "BackgroundSources": "GalaxiesFaintStars", "PlanetPhysicalModel": " ", "Observatory": "WFIRSTObservatoryL2", "TimeKeeping": " ", "PostProcessing": " ", "Completeness": " ", "TargetList": "KnownRVPlanetsTargetList", "SimulatedUniverse": "KnownRVPlanetsUniverse", "SurveySimulation": " ", "SurveyEnsemble": " " } }

dsavransky commented 1 year ago

Thanks! I was testing on EXOCAT and missed this variation of allowable spectral type. I'll have to overhaul the regexps one more time.

dsavransky commented 1 year ago

This is now fixed in MeanStars v3.4.0. Minimum version has been updated in reqs on this branch.