Skip to content

problem interpolating atmosphere in desisim.specsim.get_simulator #564

@moustakas

Description

@moustakas
from desisim.simexp import simulate_spectra
from desisim.templates import ELG
flux, wave, meta, obj = ELG().make_templates(1, seed=1)
sim1 = simulate_spectra(wave, flux)
INFO:iers.py:82:freeze_iers: Freezing IERS table used by astropy time, coordinates.
DEBUG:simexp.py:418:simulate_spectra: loading specsim desi config desi
DEBUG:simexp.py:422:simulate_spectra: creating specsim desi simulator
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-9-f559ab1da86b> in <module>
----> 1 sim1 = simulate_spectra(wave, flux)

~/code/desihub/desisim/py/desisim/simexp.py in simulate_spectra(wave, flux, fibermap, obsconditions, redshift, dwave_out, seed, psfconvolve, specsim_config_file)
    422     log.debug('creating specsim desi simulator')
    423     # desi = specsim.simulator.Simulator(config, num_fibers=nspec)
--> 424     desi = desisim.specsim.get_simulator(config, num_fibers=nspec,
    425         camera_output=psfconvolve)
    426

~/code/desihub/desisim/py/desisim/specsim.py in get_simulator(config, num_fibers, camera_output)
     50         #- New config; create Simulator object
     51         import specsim.simulator
---> 52         qsim = specsim.simulator.Simulator(config, num_fibers,
     53             camera_output=camera_output)
     54

~/code/desihub/specsim/specsim/simulator.py in __init__(self, config, num_fibers, camera_output, verbose)
     72
     73         # Initalize our component models.
---> 74         self.atmosphere = specsim.atmosphere.initialize(config)
     75         self.instrument = specsim.instrument.initialize(config, camera_output)
     76         self.source = specsim.source.initialize(config)

~/code/desihub/specsim/specsim/atmosphere.py in initialize(config)
    709
    710     # Load tabulated data.
--> 711     surface_brightness_dict = config.load_table(
    712         atm_config.sky, 'surface_brightness', as_dict=True)
    713     extinction_coefficient = config.load_table(

~/code/desihub/specsim/specsim/config.py in load_table(self, parent, column_names, interpolate, as_dict)
    486                         kind='linear', copy=False,
    487                         bounds_error=bounds_error, fill_value=fill_value)
--> 488                     interpolated_values = interpolator(self.wavelength.value)
    489                     unit = loaded_columns[column_name].unit
    490                     if unit:

~/opt/anaconda3/envs/desi/lib/python3.8/site-packages/scipy/interpolate/polyint.py in __call__(self, x)
     76         """
     77         x, x_shape = self._prepare_x(x)
---> 78         y = self._evaluate(x)
     79         return self._finish_y(y, x_shape)
     80

~/opt/anaconda3/envs/desi/lib/python3.8/site-packages/scipy/interpolate/interpolate.py in _evaluate(self, x_new)
    682         y_new = self._call(self, x_new)
    683         if not self._extrapolate:
--> 684             below_bounds, above_bounds = self._check_bounds(x_new)
    685             if len(y_new) > 0:
    686                 # Note fill_value must be broadcast up to the proper size

~/opt/anaconda3/envs/desi/lib/python3.8/site-packages/scipy/interpolate/interpolate.py in _check_bounds(self, x_new)
    714                              "range.")
    715         if self.bounds_error and above_bounds.any():
--> 716             raise ValueError("A value in x_new is above the interpolation "
    717                              "range.")
    718

ValueError: A value in x_new is above the interpolation range.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions