Skip to content

Commit

Permalink
Merge pull request #385 from dsavransky/obsModeIndex
Browse files Browse the repository at this point in the history
adding index to observingMode definition and fixing #368 and #386
  • Loading branch information
dsavransky authored Aug 26, 2024
2 parents 0c6fc47 + 315fef1 commit 9eb7192
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
6 changes: 4 additions & 2 deletions EXOSIMS/Prototypes/OpticalSystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -1081,7 +1081,8 @@ def populate_observingModes_extra(self):

def genObsModeHex(self):
"""Generate a unique hash for every observing mode to be used in downstream
identification and caching.
identification and caching. Also adds an integer index to the mode corresponding
to its order in the observingModes list.
The hash will be based on the _outspec entries for the obsmode, its science
instrument and its starlight suppression system.
Expand All @@ -1106,6 +1107,7 @@ def genObsModeHex(self):
)

mode["hex"] = genHexStr(modestr)
mode["index"] = nmode

def get_core_mean_intensity(
self,
Expand Down Expand Up @@ -1887,7 +1889,7 @@ def Cp_Cb_Csp_helper(self, TL, sInds, fZ, fEZ, dMag, WA, mode):
lam, WA, TL.diameter[sInds]
)
# also, if we're here, we must have a platescale defined
core_platescale = syst["core_platescale"]
core_platescale = syst["core_platescale"].copy()
# furthermore, if we're a coronagraph, we have to scale by wavelength
if not (syst["occulter"]) and (syst["lam"] != mode["lam"]):
core_platescale *= mode["lam"] / syst["lam"]
Expand Down
5 changes: 2 additions & 3 deletions EXOSIMS/Prototypes/SimulatedUniverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class SimulatedUniverse(object):
Planet inclinations are sampled as normally distributed about a
common system plane. Defaults to False
commonSystemPlaneParams (list(float)):
[inclination mean, inclination standard deviation, Omega mean,
Omega standard deviation] defining the normal distribution of
[inclination mean, inclination standard deviation, Omega mean, Omega
standard deviation] defining the normal distribution of
inclinations and longitudes of the ascending node about a common
system plane in units of degrees. Ignored if commonSystemPlane is
False. Defaults to [0 2.25, 0, 2.25], where the standard deviation
Expand All @@ -40,7 +40,6 @@ class SimulatedUniverse(object):
**specs:
:ref:`sec:inputspec`
Attributes:
_outspec (dict):
:ref:`sec:outspec`
Expand Down
2 changes: 1 addition & 1 deletion EXOSIMS/Prototypes/SurveySimulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1907,7 +1907,7 @@ def observation_detection(self, sInd, intTime, mode):
smin = np.minimum(smin, sminFA) if smin is not None else sminFA
log_FA = " - False Alarm (WA=%s, dMag=%s)" % (
np.round(WA, 3),
round(dMag, 1),
np.round(dMag, 1),
)
self.logger.info(log_FA)
self.vprint(log_FA)
Expand Down
4 changes: 4 additions & 0 deletions documentation/arglist.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ The table below includes a list of all Prototype module inputs.
- :py:class:`~EXOSIMS.Prototypes.OpticalSystem.OpticalSystem`
* - ``csv_angsep_colname``
- :py:class:`~EXOSIMS.Prototypes.OpticalSystem.OpticalSystem`
* - ``debug_plot_path``
- :py:class:`~EXOSIMS.Prototypes.SurveySimulation.SurveySimulation`
* - ``defaultAddExoplanetObsTime``
- :py:class:`~EXOSIMS.Prototypes.SurveySimulation.SurveySimulation`
* - ``defburnPortion``
Expand Down Expand Up @@ -154,6 +156,8 @@ The table below includes a list of all Prototype module inputs.
- :py:class:`~EXOSIMS.Prototypes.ZodiacalLight.ZodiacalLight`
* - ``magZ``
- :py:class:`~EXOSIMS.Prototypes.ZodiacalLight.ZodiacalLight`
* - ``make_debug_bird_plots``
- :py:class:`~EXOSIMS.Prototypes.SurveySimulation.SurveySimulation`
* - ``maxdVpct``
- :py:class:`~EXOSIMS.Prototypes.Observatory.Observatory`
* - ``MDP``
Expand Down
4 changes: 4 additions & 0 deletions documentation/opticalsystem.rst
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@ If any bandpass values are not set in the ``observingMode`` inputs, they will be

Upon instantiation, each ``ObservingMode`` will define its bandpass (stored in attribute ``bandpass``) as a :py:class:`~synphot.spectrum.SpectralElement` object. The model used will be either a :py:class:`~EXOSIMS.util.photometricModels.Box1D` (default) or :py:class:`~synphot.models.Gaussian1D`, toggled by attribute ``bandpass_model``. For a :py:class:`~EXOSIMS.util.photometricModels.Box1D` model, a step size can also be specified via attribute ``bandpass_step`` (default is 1 :math:`\mathring{A}`).

Observing Mode Identification
"""""""""""""""""""""""""""""""""
Each observing mode dictionary includes two keys that can be used to identify the mode in any downstream bookkeeping tasks. These are ``hex`` and ``index``. The ``hex`` key contains the MD5 hash of the entire contents of the inputs to the mode's instrument, starlight suppression system, and the mode itself. The hash is run over all of the keys in each dictionary, sorted by key in alphabetical order, and represents a fully unique identifier of everything related to the observing mode. The ``index`` key is the integer value of the index of the mode dictionary in the full list of observing modes. That is, it is a value between 0 and the number of observing modes minus 1. It represents the index of the observing mode in the :py:attr:`~EXOSIMS.Prototypes.OpticalSystem.OpticalSystem.observingModes` attribute of the optical system. As the ordering of the observing mode list is dependent on the order of the modes in the JSON script input, this index cannot be treated as a unique identifier, even in the case where two JSON scripts include exactly the same set of observing modes. However, within the context of a single simulation (or simulation ensemble) this index can be safely used to uniquely identify an observing mode.

Initialization
^^^^^^^^^^^^^^^^^^^^^^

Expand Down

0 comments on commit 9eb7192

Please sign in to comment.