Skip to content

testing_EXOSIMS_IAC.py fails #2

@douglase

Description

@douglase

Attempting test run basic integration time adjusted completeness model test example and getting root finding error.

system: tried on Python 3.8, 3.9,3.11. tried EXOSIMS releases: 3.0.0,3.0.3,3.1.3

running:

testing_EXOSIMS_IAC.py

returns:

Numpy random seed is: 143677989
Imported SAG13Universe (implementation) from EXOSIMS.SimulatedUniverse.SAG13Universe
Imported TargetList (prototype) from EXOSIMS.Prototypes.TargetList
Imported EXOCAT1 (implementation) from EXOSIMS.StarCatalog.EXOCAT1
Imported Nemati (implementation) from EXOSIMS.OpticalSystem.Nemati
Imported Stark (implementation) from EXOSIMS.ZodiacalLight.Stark
Imported PostProcessing (prototype) from EXOSIMS.Prototypes.PostProcessing
Imported GalaxiesFaintStars (implementation) from EXOSIMS.BackgroundSources.GalaxiesFaintStars
Imported IntegrationTimeAdjustedCompleteness (implementation) from EXOSIMS.Complet[...]nTimeAdjustedCompleteness
Imported SAG13 (implementation) from EXOSIMS.PlanetPopulation.SAG13
Imported Forecaster (implementation) from EXOSIMS.PlanetPhysicalModel.Forecaster
Loaded star fluxes values from /Users/edouglas/.EXOSIMS/cache/TargetList_EXOCAT1_nStars_2193_mode_34f288aafa764c8215ebad472f6256da.star_fluxes
Calculating saturation_dMag:   0%|                     | 0/2193 [00:00<?, ?it/s]
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[9], line 15
      9 #### Instantiate EXOSIMS Object
     10 #folder_load = os.path.normpath(os.path.expandvars('$HOME/github/exodetbox/exodetbox/scripts'))
     11 #filename = 'HabEx_CKL2_PPKL2.json'
     12 #filename = 'WFIRSTcycle6core.json'
     13 #filename = 'HabEx_CSAG13_PPSAG13_IACtest.json'
     14 #scriptfile = os.path.join(folder_load,filename)
---> 15 sim = EXOSIMS.MissionSim.MissionSim(cachedir=None,**{"erange": [0,0.35],
     16                                                      "arange":[0.09, 12.4],
     17                                                      "Rprange":[0.5, 11.6],
     18                                                      "scaleOrbits": False,
     19                                                      "constrainOrbits": True,
     20                                                      "whichPlanetPhaseFunction": "quasiLambertPhaseFunction",\
     21             "scienceInstruments": 
     22                                                      [{"name": "imagingEMCCD",
     23                                                        "QE": 0.9,
     24                                                        "optics": 0.28,
     25                                                        "FoV": 0.75,
     26                                                        "pixelNumber": 105,
     27                                                        "pixelSize": 13e-6,
     28                                                        "sread": 0,
     29                                                        "idark": 3e-5,
     30                                                        "CIC": 1.3e-3,
     31                                                        "texp": 100,
     32                                                        "ENF": 1,
     33                                                        "PCeff": 0.75}],\
     34             "starlightSuppressionSystems": [{"name": "VVC500",
     35                                              "lam": 500,
     36                                              "IWA": 0.045,
     37                                              "OWA": 2.127,
     38                                              "ohTime": 0.1,
     39                                              "BW": 0.20,
     40                                              "optics": 0.95,
     41                                              "optics_comment": "contamination",
     42             "core_platescale": 0.1,
     43                                              "occ_trans": 0.9,
     44             "core_thruput": 0.9,           
     45             "core_mean_intensity": 0.9,
     46             "occ_trans_local": 0.9,
     47             "core_thruput_local": 1,           
     48             "core_mean_intensity_local": 1}],
     49             "modules":{"PlanetPopulation": "SAG13",
     50                        "StarCatalog": "EXOCAT1",
     51                        "OpticalSystem": "Nemati",
     52                        "ZodiacalLight": "Stark",
     53                        "BackgroundSources": "GalaxiesFaintStars",\
     54             "PlanetPhysicalModel": "Forecaster",
     55                        "Observatory": "WFIRSTObservatoryL2",
     56                        "TimeKeeping": " ","PostProcessing": " ",
     57                        "Completeness": "IntegrationTimeAdjustedCompleteness",
     58                        "TargetList": " ",\
     59             "SimulatedUniverse": "SAG13Universe",
     60                        "SurveySimulation": " ",
     61                        "SurveyEnsemble": " "}})
     62 IWA_HabEx = 0.045*u.arcsec #taken from a Habex Script in units of mas
     63 #IWA2=0.150*u.arcsec #Suggested by dmitry as analahous to WFIRST

File ~/github/EXOSIMS/EXOSIMS/MissionSim.py:167, in MissionSim.__init__(self, scriptfile, nopar, verbose, logfile, loglevel, checkInputs, **specs)
    164         self._outspec[att] = self.__dict__[att]
    166 # create a surveysimulation object (triggering init of everything else)
--> 167 self.SurveySimulation = get_module(
    168     specs["modules"]["SurveySimulation"], "SurveySimulation"
    169 )(**specs)
    171 # collect sub-initializations
    172 SS = self.SurveySimulation

File ~/github/EXOSIMS/EXOSIMS/Prototypes/SurveySimulation.py:245, in SurveySimulation.__init__(self, scriptfile, ntFlux, nVisitsMax, charMargin, dt_max, record_counts_path, nokoMap, nofZ, cachedir, defaultAddExoplanetObsTime, find_known_RV, include_known_RV, **specs)
    240 # if any of the modules is a string, assume that they are all strings
    241 # and we need to initalize
    242 if isinstance(next(iter(specs["modules"].values())), str):
    243 
    244     # import desired module names (prototype or specific)
--> 245     self.SimulatedUniverse = get_module(
    246         specs["modules"]["SimulatedUniverse"], "SimulatedUniverse"
    247     )(**specs)
    248     self.Observatory = get_module(
    249         specs["modules"]["Observatory"], "Observatory"
    250     )(**specs)
    251     self.TimeKeeping = get_module(
    252         specs["modules"]["TimeKeeping"], "TimeKeeping"
    253     )(**specs)

File ~/github/EXOSIMS/EXOSIMS/SimulatedUniverse/SAG13Universe.py:17, in SAG13Universe.__init__(self, earthPF, **specs)
     14 def __init__(self, earthPF=False, **specs):
     16     self.earthPF = earthPF
---> 17     SimulatedUniverse.__init__(self, **specs)
     18     self._outspec["earthPF"] = self.earthPF

File ~/github/EXOSIMS/EXOSIMS/Prototypes/SimulatedUniverse.py:205, in SimulatedUniverse.__init__(self, fixedPlanPerStar, Min, cachedir, lucky_planets, commonSystemInclinations, commonSystemInclinationParams, **specs)
    199     assert not (val), (
    200         "KnownRVPlanetsTargetList or KnownRVPlanets should not be used "
    201         "with this SimulatedUniverse"
    202     )
    204 # import TargetList class
--> 205 self.TargetList = get_module(specs["modules"]["TargetList"], "TargetList")(
    206     **specs
    207 )
    209 # bring inherited class objects to top level of Simulated Universe
    210 TL = self.TargetList

File ~/github/EXOSIMS/EXOSIMS/Prototypes/TargetList.py:459, in TargetList.__init__(self, missionStart, staticStars, keepStarCatalog, fillPhotometry, fillMissingBandMags, explainFiltering, filterBinaries, cachedir, filter_for_char, earths_only, getKnownPlanets, int_WA, int_dMag, scaleWAdMag, int_dMag_offset, popStars, **specs)
    456 self.catalog_atts.append("blackbody_spectra")
    458 # Calculate saturation and intCutoff delta mags and completeness values
--> 459 self.calc_saturation_and_intCutoff_vals()
    461 # populate completeness values
    462 self.int_comp = self.Completeness.target_completeness(self)

File ~/github/EXOSIMS/EXOSIMS/Prototypes/TargetList.py:867, in TargetList.calc_saturation_and_intCutoff_vals(self)
    865     self.vprint(f"Loaded saturation_dMag values from {saturation_dMag_path}")
    866 else:
--> 867     self.saturation_dMag = OS.calc_saturation_dMag(
    868         self, sInds, fZ, fEZ, self.int_WA, mode, TK=None
    869     )
    871     with open(saturation_dMag_path, "wb") as f:
    872         pickle.dump(self.saturation_dMag, f)

File ~/github/EXOSIMS/EXOSIMS/OpticalSystem/Nemati.py:523, in Nemati.calc_saturation_dMag(self, TL, sInds, fZ, fEZ, WA, mode, TK)
    513 for i, sInd in enumerate(tqdm(sInds, desc="Calculating saturation_dMag")):
    514     args = (
    515         TL,
    516         [sInd],
   (...)
    521         TK,
    522     )
--> 523     singularity_res = root_scalar(
    524         self.int_time_denom_obj,
    525         args=args,
    526         method="brentq",
    527         bracket=[10, 40],
    528     )
    529     singularity_dMag = singularity_res.root
    530     saturation_dMag[i] = singularity_dMag

File ~/miniconda3/envs/astroconda/lib/python3.11/site-packages/scipy/optimize/_root_scalar.py:275, in root_scalar(f, args, method, bracket, fprime, fprime2, x0, x1, xtol, rtol, maxiter, options)
    272         raise ValueError('Bracket needed for %s' % method)
    274     a, b = bracket[:2]
--> 275     r, sol = methodc(f, a, b, args=args, **kwargs)
    276 elif meth in ['secant']:
    277     if x0 is None:

File ~/miniconda3/envs/astroconda/lib/python3.11/site-packages/scipy/optimize/_zeros_py.py:784, in brentq(f, a, b, args, xtol, rtol, maxiter, full_output, disp)
    782 if rtol < _rtol:
    783     raise ValueError("rtol too small (%g < %g)" % (rtol, _rtol))
--> 784 r = _zeros._brentq(f, a, b, xtol, rtol, maxiter, args, full_output, disp)
    785 return results_c(full_output, r)

ValueError: f(a) and f(b) must have different signs```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions