Skip to content

Commit

Permalink
Merge pull request #339 from dsavransky/surveysim_updates
Browse files Browse the repository at this point in the history
process_opticalsys_package bugfix
  • Loading branch information
dsavransky authored Apr 14, 2023
2 parents a37ee17 + b21ce81 commit 59f6a02
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 10 deletions.
48 changes: 39 additions & 9 deletions EXOSIMS/Prototypes/TargetList.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ class TargetList(object):
Bolometric correction (V band)
Binary_Cut (numpy.ndarray):
Boolean - True is target has close companion.
blackbody_spectra (numpy.ndarray):
Storage array for blackbody spectra (populated as needed)
Bmag (numpy.ndarray):
B band magniutde
BV (numpy.ndarray):
Expand All @@ -125,6 +127,11 @@ class TargetList(object):
:ref:`Completeness` object
coords (astropy.coordinates.sky_coordinate.SkyCoord):
Target coordinates
default_mode (dict):
:ref:`OpticalSystem` observingMode dictionary. Either the detection mode
(default) or first characterization mode (if ``filter_for_char`` is True).
diameter (astropy.units.quantity.Quantity):
Stellar diameter in angular units.
dist (astropy.units.quantity.Quantity):
Target distances
earths_only (bool):
Expand Down Expand Up @@ -164,6 +171,9 @@ class TargetList(object):
calculation
int_dMag_offset (int):
Offset applied to int_dMag when scaleWAdMag is True.
int_tmin (astropy.units.quantity.Quantity):
Integration times corresponding to `int_dMag` with global minimum local zodi
contribution.
int_WA (astropy.units.quantity.Quantity):
Working angle used for integration time calculation (angle)
intCutoff_comp (numpy.ndarray):
Expand Down Expand Up @@ -224,17 +234,28 @@ class TargetList(object):
that WA is within the IWA/OWA.
Spec (numpy.ndarray):
Spectral type strings. Will be strictly in G0V format.
specdatapath (str):
Full path to spectral data folder
specdict (dict):
Dictionary of spectral types
specindex (dict):
Index of spectral types
Dictionary of numerical mappings for spectral classes (O = 0, M = 6).
spectral_catalog_index (dict):
Dictionary mapping spectral type strings (keys) to template spectra files
on disk (values).
spectral_catalog_types (numpy.ndarray):
nx4 ndarray (n is the number of template spectra avaiable). First three
columns are spectral class (str), subclass (int), and luinosity class (str).
The fourth column is a spectral class numeric representation, equaling
``specdict[specclass]*10 + subclass``.
spectral_class (numpy.ndarray):
nStars x 3. First column is spectral class, second is spectral subclass and
third is luminosity class.
spectypenum (numpy.ndarray):
Numerical value of spectral type for matching
nStars x 4 array. Same column definitions as ``spectral_catalog_types`` but
evaluated for the target stars rather than the template spectra.
standard_bands (dict):
Dictionary mapping UVBRIJHK (keys are single characters) to
:py:class:`synphot.spectrum.SpectralElement` objects of the filter profiles.
standard_bands_deltaLam (astropy.units.quantity.Quantity):
Effective bandpasses of the profiles in `standard_bands`.
standard_bands_lam (astropy.units.quantity.Quantity):
Effective central wavelengths of the profiles in `standard_bands`.
standard_bands_letters (str):
Concatenation of the keys of `standard_bands`.
star_fluxes (dict):
Internal storage of pre-computed star flux values that is populated
each time a flux is requested for a particular target. Keyed by observing
Expand All @@ -244,6 +265,8 @@ class TargetList(object):
positions.
Teff (astropy.units.Quantity):
Stellar effective temperature.
template_spectra (dict):
Dictionary of template spectra objects (populated as needed).
Umag (numpy.ndarray):
U band magnitudes
Vmag (numpy.ndarray):
Expand Down Expand Up @@ -775,6 +798,7 @@ def calc_saturation_and_intCutoff_vals(self):
else:
mode = detmode
self.calc_char_int_comp = False
self.default_mode = mode

# grab zodi vals for any required calculations
sInds = np.arange(self.nStars)
Expand Down Expand Up @@ -989,11 +1013,17 @@ def calc_saturation_and_intCutoff_vals(self):
if int_dMag_val > self.intCutoff_dMag[i]:
self.int_dMag[i] = self.intCutoff_dMag[i]

# Finally, compute the nominal integration time at minimum zodi
self.int_tmin = self.OpticalSystem.calc_intTime(
self, sInds, fZ, fEZ, self.int_dMag, self.int_WA, mode
)

# update catalog attributes for any future filtering
self.catalog_atts.append("intCutoff_dMag")
self.catalog_atts.append("intCutoff_comp")
self.catalog_atts.append("saturation_dMag")
self.catalog_atts.append("saturation_comp")
self.catalog_atts.append("int_tmin")

def fillPhotometryVals(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion EXOSIMS/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging

name = "EXOSIMS"
__version__ = "3.1.0"
__version__ = "3.1.1"

# Set up a default logging handler to avoid "No handler found" warnings.
# Other handlers can add to this one.
Expand Down
12 changes: 12 additions & 0 deletions EXOSIMS/util/process_opticalsys_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def process_opticalsys_package(

# Sky (Occulter) Transmission Map: tau_occ (T_sky):
if data["sky_trans"] is not None:
print("Processing sky (occulter) transmission map.")
occ_trans_vals, _, bc = radial_average(
data["sky_trans"],
center=[headers["sky_trans"]["XCENTER"], headers["sky_trans"]["YCENTER"]],
Expand All @@ -150,6 +151,7 @@ def process_opticalsys_package(

# Off-Axis PSF maps: core_thruput, tau_core (Upsilon)
if (data["offax_psf_offset"] is not None) and (data["offax_psf"] is not None):
print("Processing off-axis PSF maps.")
# pixel scale must be the same in both files
assert (
headers["offax_psf_offset"]["PIXSCALE"] == headers["offax_psf"]["PIXSCALE"]
Expand Down Expand Up @@ -265,11 +267,21 @@ def process_opticalsys_package(

# Stellar intensity maps: core_mean_intensity (I_xy)
if (data["intens"] is not None) and (data["intens_diam"] is not None):
print("Processing stellar intensity maps.")
# pixel scale must be the same in both files
assert (
headers["intens"]["PIXSCALE"] == headers["intens_diam"]["PIXSCALE"]
), "PIXSCALE in intens and intens_diam files is different."

# if intens_diam is 2D, ensure that it only has one non-singleton dim and then
# flatten it
if len(data["intens_diam"].shape) > 1:
assert np.where(np.array(data["intens_diam"].shape) != 1)[0].size == 1, (
"intens_diam is multi-dimensionsal with more than one non-singleton "
"dimension. I dont' know how to process this."
)
data["intens_diam"] = data["intens_diam"].flatten()

# stellar diameter list must be the same length as data
assert len(data["intens_diam"]) == len(
data["intens"]
Expand Down

0 comments on commit 59f6a02

Please sign in to comment.