Skip to content

Commit

Permalink
PEP8 and format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gmzsebastian committed Oct 11, 2023
1 parent 8e4fa3b commit eee56a3
Show file tree
Hide file tree
Showing 7 changed files with 1,194 additions and 1,643 deletions.
1,789 changes: 958 additions & 831 deletions notebooks/STIPS Advanced II - PSFs.ipynb

Large diffs are not rendered by default.

612 changes: 7 additions & 605 deletions notebooks/STIPS Basic Tutorial.ipynb

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions stips-2.0.0
Submodule stips-2.0.0 added at 8e4fa3
6 changes: 1 addition & 5 deletions stips/instruments/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@
# Local Modules
from ..stellar_module import StarGenerator
from ..astro_image import AstroImage
from ..utilities import GetStipsData
from ..utilities import OffsetPosition
from ..utilities import SelectParameter
from ..utilities import get_pandeia_background
from ..utilities import StipsDataTable
from ..utilities import GetStipsData, OffsetPosition, SelectParameter, get_pandeia_background, StipsDataTable
from ..utilities.makePSF import PSF_GRID_SIZE

class Instrument(object):
Expand Down
54 changes: 32 additions & 22 deletions stips/instruments/wfi.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
__filetype__ = "detector"

# Local Modules
from .roman_instrument import RomanInstrument
from astropy.constants import c
from astropy import units as u
from astropy.coordinates import SkyCoord, ICRS
from .roman_instrument import RomanInstrument
from soc_roman_tools.siaf import siaf
import numpy as np
from astropy.coordinates import SkyCoord, ICRS
import astropy.units as u


class WFI(RomanInstrument):
__classtype__ = "detector"
Expand All @@ -34,10 +33,10 @@ def __init__(self, **kwargs):
self.SCALE = [0.11, 0.11] # Assume for now
self.FILTERS = ('F062', 'F087', 'F106', 'F129', 'F158', 'F184', 'F146')
self.DEFAULT_FILTER = 'F184' # Assume for now
self.SCA_ROTATION = -60 # Rotation of SCA with respect to SIAF
self.SCA_ROTATION = -60 # Rotation of SCA with respect to SIAF

# Get RA and DEC that will be used for detector offset calculations
RA = kwargs.get('ra', 0)
# RA = kwargs.get('ra', 0)
DEC = kwargs.get('dec', 0)

# Calculate the detector offsets based on the Roman SIAF file from soc_roman_tools
Expand All @@ -48,9 +47,10 @@ def __init__(self, **kwargs):
rsiaf = siaf.RomanSiaf()

# Make array of SCA's
self.SCA_NAMES = ["WFI01_FULL", "WFI02_FULL", "WFI03_FULL", "WFI04_FULL", "WFI05_FULL", "WFI06_FULL",
"WFI07_FULL", "WFI08_FULL", "WFI09_FULL", "WFI10_FULL", "WFI11_FULL", "WFI12_FULL",
"WFI13_FULL", "WFI14_FULL", "WFI15_FULL", "WFI16_FULL", "WFI17_FULL", "WFI18_FULL"]
self.SCA_NAMES = ["WFI01_FULL", "WFI02_FULL", "WFI03_FULL", "WFI04_FULL", "WFI05_FULL",
"WFI06_FULL", "WFI07_FULL", "WFI08_FULL", "WFI09_FULL", "WFI10_FULL",
"WFI11_FULL", "WFI12_FULL", "WFI13_FULL", "WFI14_FULL", "WFI15_FULL",
"WFI16_FULL", "WFI17_FULL", "WFI18_FULL"]

# Default detector offsets in (arcseconds_ra,arcseconds_dec,degrees_angle)
self.DETECTOR_OFFSETS = [# SCA01 SCA02 SCA03
Expand All @@ -68,7 +68,8 @@ def __init__(self, **kwargs):

# Reference point
s01 = rsiaf['WFI01_FULL'].sci_to_tel(self.DETECTOR_SIZE[0] / 2, self.DETECTOR_SIZE[1] / 2)
center = SkyCoord(s01[0] * u.arcsec, s01[1] * u.arcsec).skyoffset_frame(self.SCA_ROTATION * u.deg)
center = SkyCoord(s01[0] * u.arcsec,
s01[1] * u.arcsec).skyoffset_frame(self.SCA_ROTATION * u.deg)

for i, sca in enumerate(self.SCA_NAMES):
# Get V2, V3 coordinate pair in the telescope frame at the center of the SCA
Expand All @@ -84,12 +85,15 @@ def __init__(self, **kwargs):
self.OFFSET_NAMES = ("SCA01", "SCA02", "SCA03", "SCA04", "SCA05", "SCA06",
"SCA07", "SCA08", "SCA09", "SCA10", "SCA11", "SCA12",
"SCA13", "SCA14", "SCA15", "SCA16", "SCA17", "SCA18")
self.N_OFFSET = {1: self.DETECTOR_OFFSETS[ 0], 2: self.DETECTOR_OFFSETS[ 1], 3: self.DETECTOR_OFFSETS[ 2],
4: self.DETECTOR_OFFSETS[ 3], 5: self.DETECTOR_OFFSETS[ 4], 6: self.DETECTOR_OFFSETS[ 5],
7: self.DETECTOR_OFFSETS[ 6], 8: self.DETECTOR_OFFSETS[ 7], 9: self.DETECTOR_OFFSETS[ 8],
10: self.DETECTOR_OFFSETS[ 9], 11: self.DETECTOR_OFFSETS[10], 12: self.DETECTOR_OFFSETS[11],
13: self.DETECTOR_OFFSETS[12], 14: self.DETECTOR_OFFSETS[13], 15: self.DETECTOR_OFFSETS[14],
16: self.DETECTOR_OFFSETS[15], 17: self.DETECTOR_OFFSETS[16], 18: self.DETECTOR_OFFSETS[17]}
self.N_OFFSET = {1: self.DETECTOR_OFFSETS[0], 2: self.DETECTOR_OFFSETS[1],
3: self.DETECTOR_OFFSETS[2], 4: self.DETECTOR_OFFSETS[3],
5: self.DETECTOR_OFFSETS[4], 6: self.DETECTOR_OFFSETS[5],
7: self.DETECTOR_OFFSETS[6], 8: self.DETECTOR_OFFSETS[7],
9: self.DETECTOR_OFFSETS[8], 10: self.DETECTOR_OFFSETS[9],
11: self.DETECTOR_OFFSETS[10], 12: self.DETECTOR_OFFSETS[11],
13: self.DETECTOR_OFFSETS[12], 14: self.DETECTOR_OFFSETS[13],
15: self.DETECTOR_OFFSETS[14], 16: self.DETECTOR_OFFSETS[15],
17: self.DETECTOR_OFFSETS[16], 18: self.DETECTOR_OFFSETS[17]}

# This is a set of offsets derived from "WFIRST-STSCI-TR1506A"
# Further, it assumes no rotation or imperfection (see ASCII diagrams).
Expand Down Expand Up @@ -126,20 +130,25 @@ def __init__(self, **kwargs):
self.DARKFILE = 'err_rdrk_wfi.fits' # IREF, IHB (use for the moment)

# Background Values
self.BACKGROUND = {'none': {'F062': 0., 'F087': 0., 'F106': 0., 'F129': 0., 'F158': 0., 'F184': 0., 'F146': 0.},
self.BACKGROUND = {'none': {'F062': 0., 'F087': 0., 'F106': 0.,
'F129': 0., 'F158': 0., 'F184': 0., 'F146': 0.},
'avg': {'F062': 1.401E+00, 'F087': 1.401E+00, 'F106': 1.401E+00, 'F129': 7.000E-01,
'F158': 7.521E-01, 'F184': 8.500E-01, 'F146': 7.000E-01}}
self.BACKGROUNDS_V = ['none', 'avg', 'med', 'max', 'min']
self.BACKGROUNDS = ['None', 'Average zodiacal background', 'Median zodiacal background', 'Maximum zodiacal background', 'Minimum zodiacal background']
self.BACKGROUNDS = ['None', 'Average zodiacal background', 'Median zodiacal background',
'Maximum zodiacal background', 'Minimum zodiacal background']
self.BGTEXT = {'none': 'None', 'avg': 'Average zodiacal background',
'med': 'Median zodiacal background', 'max': 'Maximum zodiacal background',
'min': 'Minimum zodiacal background', 'custom': 'Custom thermal background rate', 'pandeia': 'Pandeia background rate'}
'min': 'Minimum zodiacal background', 'custom': 'Custom thermal background rate',
'pandeia': 'Pandeia background rate'}
# PHOTFNU has units of Jy
# For now, just assuming similar PHOTFNU to WFC3IR.
# For now, just put them in the middle
self.PHOTPLAM = {'F062': 0.620, 'F087': 0.869, 'F106': 1.060, 'F129': 1.293, 'F158': 1.577, 'F184': 1.842, 'F146': 1.464}
self.PHOTPLAM = {'F062': 0.620, 'F087': 0.869, 'F106': 1.060, 'F129': 1.293,
'F158': 1.577, 'F184': 1.842, 'F146': 1.464}

self.ZEROPOINTS_AB = {'F062': 26.73, 'F087': 26.39, 'F106': 26.41, 'F129': 26.43, 'F158': 26.47, 'F184': 26.08, 'F146': 27.66}
self.ZEROPOINTS_AB = {'F062': 26.73, 'F087': 26.39, 'F106': 26.41, 'F129': 26.43,
'F158': 26.47, 'F184': 26.08, 'F146': 27.66}
self.PHOTFNU = {}
for i in self.ZEROPOINTS_AB:
self.PHOTFNU[i] = 10 ** (0.4 * (8.9 - self.ZEROPOINTS_AB[i]))
Expand All @@ -161,7 +170,8 @@ def __init__(self, **kwargs):
"BLOB": ["NONE", "LINE", "LINE-3PT", "BOX-MIN"]
}
self.DITHER_OFFSETS = {
"BOX-UVIS": [(-11.071, -17.744), (11.947, -17.457), (11.071, 17.744), (-11.947, 17.457)],
"BOX-UVIS": [(-11.071, -17.744), (11.947, -17.457),
(11.071, 17.744), (-11.947, 17.457)],
"BLOB": [(-1.930, -1.729), (1.930, 1.729)],
"SUBPIXEL": {
"NONE": [(0.000, 0.000)],
Expand Down
28 changes: 14 additions & 14 deletions stips/utilities/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
__all__ = ['utilities']

# Local Definitions
from .utilities import StipsEnvironment
from .utilities import SetupDataPaths
from .utilities import DownloadReferenceData
from .utilities import GetStipsDataDir
from .utilities import GetStipsData
from .utilities import SelectParameter
from .utilities import OffsetPosition
from .utilities import InstrumentList
from .utilities import read_metadata
from .utilities import read_table
from .utilities import rind
from .utilities import sersic_lum
from .utilities import get_pandeia_background
from .DataTable import StipsDataTable
from .utilities import (StipsEnvironment,
SetupDataPaths,
DownloadReferenceData,
GetStipsDataDir,
GetStipsData,
SelectParameter,
OffsetPosition,
InstrumentList,
read_metadata,
read_table,
rind,
sersic_lum,
get_pandeia_background,
StipsDataTable)
Loading

0 comments on commit eee56a3

Please sign in to comment.