dsavransky / EXOSIMS

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

util/eccanom zero-size Exception #380

Open turmon opened 1 month ago

turmon commented 1 month ago

Describe the bug When given a zero-size input, util/eccanom raises an exception (see below). The exception seems due to np.max() not knowing what to do with size-zero inputs.

To Reproduce Call the routine with a size-zero input. This seems to happen with small target lists?

Expected behavior Probably returning E=[] would suffice.

JSON script: NA

EXOSIMS version: Current master (3.2)

Additional context Traceback follows.

2306 targets remain after IWA filter. 16 targets remain after completeness filter. Loaded star fluxes values from /home/turmon/.EXOSIMS/cache_HWO_v320_spie_v4/TargetList_EXOCAT1_nStars_16_mode_6c334e97ffe488daffb4a8285d0c69 a9.star_fluxes Traceback (most recent call last): File "/proj/exep/rhonda/Sandbox/HabEx/Local/sandbox_driver.py", line 380, in message = main(args, xspecs) File "/proj/exep/rhonda/Sandbox/HabEx/Local/sandbox_driver.py", line 269, in main sim = EXOSIMS.MissionSim.MissionSim(args.scriptfile, xspecs) File "/proj/exep/rhonda/Sandbox/Python-venvs/exosims-3.2.0-rmm/EXOSIMS/EXOSIMS/MissionSim.py", line 167, in init self.SurveySimulation = get_module( File "/proj/exep/rhonda/Sandbox/Python-venvs/exosims-3.2.0-rmm/EXOSIMS/EXOSIMS/SurveySimulation/coroOnlyScheduler.py", line 63, in init SurveySimulation.init(self, specs) File "/proj/exep/rhonda/Sandbox/Python-venvs/exosims-3.2.0-rmm/EXOSIMS/EXOSIMS/Prototypes/SurveySimulation.py", line 256, in init self.SimulatedUniverse = get_module( File "/proj/exep/rhonda/Sandbox/Python-venvs/exosims-3.2.0-rmm/EXOSIMS/EXOSIMS/SimulatedUniverse/DulzPlavchanUniverseEarthsOnly.py", line 17, in init SimulatedUniverse.init(self, *specs) File "/proj/exep/rhonda/Sandbox/Python-venvs/exosims-3.2.0-rmm/EXOSIMS/EXOSIMS/Prototypes/SimulatedUniverse.py", line 265, in init self.init_systems() File "/proj/exep/rhonda/Sandbox/Python-venvs/exosims-3.2.0-rmm/EXOSIMS/EXOSIMS/Prototypes/SimulatedUniverse.py", line 389, in init_systems E = eccanom(M0, e) # eccentric anomaly File "/proj/exep/rhonda/Sandbox/Python-venvs/exosims-3.2.0-rmm/EXOSIMS/EXOSIMS/util/eccanom.py", line 49, in eccanom err = np.max(abs(M - (E - e np.sin(E)))) File "/proj/exep/rhonda/Sandbox/Python-venvs/exosims-3.2.0-rmm/lib/python3.10/site-packages/numpy/core/fromnumeric.py", line 2810, in max return _wrapreduction(a, np.maximum, 'max', axis, None, out, File "/proj/exep/rhonda/Sandbox/Python-venvs/exosims-3.2.0-rmm/lib/python3.10/site-packages/numpy/core/fromnumeric.py", line 88, in _wrapreduction return ufunc.reduce(obj, axis, dtype, out, **passkwargs) ValueError: zero-size array to reduction operation maximum which has no identity