Skip to content

Commit da8fadf

Browse files
committed
updates to files
1 parent b001cdf commit da8fadf

File tree

6 files changed

+98
-77
lines changed

6 files changed

+98
-77
lines changed

jwst/cube_build/blot_cube_build.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import logging
33

44
from jwst.datamodels import ModelContainer
5-
65
from ..assign_wcs import nirspec
76
from gwcs import wcstools
87
from jwst.assign_wcs.util import in_ifu_slice
@@ -64,13 +63,13 @@ def __init__(self, median_model, input_models):
6463
self.median_skycube.meta.wcs.bounding_box, step=(1, 1, 1)
6564
)
6665

67-
# using wcs of ifu cube determine ra,dec,lambda
66+
# using wcs of ifu cube determine ra, dec, lambda
6867
self.cube_ra, self.cube_dec, self.cube_wave = self.median_skycube.meta.wcs(
6968
xcube + 1, ycube + 1, zcube + 1
7069
)
7170

7271
# pull out flux from the median sky cube that matches with
73-
# cube_ra,dec,wave
72+
# cube_ra, dec, wave
7473
self.cube_flux = self.median_skycube.data
7574

7675
# remove all the nan values - just in case
@@ -152,8 +151,8 @@ def blot_images_miri(self):
152151
153152
This is the main routine for blotting the MIRI median sky cube back to
154153
the detector space and creating a blotting image for each input model
155-
1. Loop over every data model to be blotted and find ra,dec,wavelength
156-
for every pixel in a valid slice on the detector.
154+
1. Loop over every data model to be blotted and find ra, dec and
155+
wavelength for every pixel in a valid slice on the detector.
157156
2. Loop over every input model and using the inverse (backwards) transform
158157
convert the median sky cube values ra, dec, lambda to the blotted
159158
x, y detector value (x_cube, y_cube).

jwst/cube_build/coord.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ def radec2std(crval1, crval2, ra, dec, rot_angle=None):
1212
Parameters
1313
----------
1414
crval1 : float
15-
RA value of tangent point
15+
Ra value of tangent point
1616
crval2 : float
17-
DEC value of tangent point
17+
Dec value of tangent point
1818
ra : numpy.ndarray or float
1919
A list (or single value) of ra points to convert
2020
dec : numpy.ndarray or float
@@ -71,15 +71,15 @@ def std2radec(crval1, crval2, xi, eta):
7171
7272
Compute the ra,dec values of tangent plane rectangular coordinates using
7373
crval1, crval2(the tangent point). This routine takes the rectangular
74-
plane and projects it to the spherical plane using crval1, crval2 as
74+
plane and projects it onto the spherical plane using crval1, crval2 as
7575
the tangent plane.
7676
7777
Parameters
7878
----------
7979
crval1 : float
80-
RA value of tangent point
80+
Ra value of tangent point
8181
crval2 : float
82-
DEC value of tangent point
82+
Dec value of tangent point
8383
xi : float
8484
Xi rectangular coordinate of tangent plane projected ra,dec
8585
eta : float

jwst/cube_build/cube_build_step.py

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@
1717

1818
class CubeBuildStep(Step):
1919
"""
20-
Creates a 3-D spectral cube.
20+
Creates a 3-D spectral cube from IFU data.
2121
2222
This is the controlling routine for building IFU Spectral Cubes.
23-
It loads and sets the various input data and parameters need by
23+
It loads and sets the various input data and parameters needed by
2424
the cube_build_step.
2525
2626
This routine does the following operations:
2727
2828
1. Extracts the input parameters from the cubepars reference file and
2929
merges them with any user-provided values.
3030
2. Creates the output WCS from the input images and defines the mapping
31-
between all the input arrays and the output array
31+
between all the input arrays and the output array.
3232
3. Passes the input data to the function to map all their input data
3333
to the output array.
34-
4. Updates the output data model with correct meta data
34+
4. Updates the output data model with correct meta data.
3535
"""
3636

3737
class_alias = "cube_build"
@@ -433,13 +433,12 @@ def read_user_input(self):
433433
"""
434434
Read user input options for channel, subchannel, filter, or grating.
435435
436-
# Determine if any of the input parameters channel, band, filter or
437-
# grating have been set by the user.
438-
439-
# This routine updates the dictionary self.pars_input with any user
440-
# provided inputs. In particular it sets pars_input['channel'],
441-
# pars_input['sub_channel'], pars_input['grating'], and
442-
# pars_input['filter'] with user provided values.
436+
Determine if any of the input parameters channel, band, filter or
437+
grating have been set by the user.
438+
This routine updates the dictionary self.pars_input with any user
439+
provided inputs. In particular it sets pars_input['channel'],
440+
pars_input['sub_channel'], pars_input['grating'], and
441+
pars_input['filter'] with user provided values.
443442
"""
444443
valid_channel = ["1", "2", "3", "4", "all"]
445444
valid_subchannel = [
@@ -560,10 +559,9 @@ def check_offset_file(self):
560559
"""
561560
Read in an optional ra and dec offset for each file.
562561
563-
Check that is file is asdf file.
564-
Check the file has the correct format using an local schema file.
565-
The schema file, ifuoffset.schema.yaml, is located in the jwst/cube_build directory.
566-
For each file in the input association check that there is a corresponding
562+
Check that the offset file is an asdf file.
563+
Check that the file has the correct format using an local schema file.
564+
For each file in the input association check that there is a corresponding
567565
file in the offset file.
568566
569567
Returns

jwst/cube_build/ifu_cube.py

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def define_cubename(self):
176176
Usually the output name is defined by the association table. However in the case
177177
of cube_build several cubes can be created from a single call of cube_build. The
178178
user can override the type of data to combine to make a cube. It is left to cube_build
179-
to determine with channels, bands, gratings or filters are used to make the IFUCube.
179+
to determine which channels, bands, gratings or filters are used to make the IFUCube.
180180
The final name includes the channel/band (MIRI) or grating/filter (NIRSpec).
181181
182182
Returns
@@ -261,13 +261,13 @@ def set_geometry(self, corner_a, corner_b, lambda_min, lambda_max):
261261
Parameters
262262
----------
263263
corner_a : numpy array
264-
Array of ra corners of the footprint of all input data
264+
Array of ra corners of the footprint of all input data.
265265
corner_b : numpy array
266-
Array of dec corners of the footprint of all input data
266+
Array of dec corners of the footprint of all input data.
267267
lambda_min : float
268-
Minimum wavelength value of the data
268+
Minimum wavelength value of the data.
269269
lambda_max : float
270-
Maximum wavelength value of the data
270+
Maximum wavelength value of the data.
271271
"""
272272
ra_min = np.min(corner_a)
273273
ra_max = np.max(corner_a)
@@ -406,20 +406,19 @@ def set_geometry_slicer(self, corner_a, corner_b, lambda_min, lambda_max):
406406
"""
407407
Set up the size of the cube in the internal IFU plane.
408408
409-
This will be a single exposure cube - small FOV assume
410-
rectangular coord system. The internal IFU Cube is in the slicer plane
411-
and is defined by along slice and across slice coordinates.
409+
This will be a single exposure cube. The internal IFU Cube is in the
410+
slicer plane and is defined by along slice and across slice coordinates.
412411
413412
Parameters
414413
----------
415414
corner_a : numpy array
416-
Array of along slice corners of the footprint of all input data
415+
Array of along slice corners of the footprint of all input data.
417416
corner_b : numpy array
418-
Array of across slice corners of the footprint of all input data
417+
Array of across slice corners of the footprint of all input data.
419418
lambda_min : float
420-
Minimum wavelength value of the data
419+
Minimum wavelength value of the data.
421420
lambda_max : float
422-
Maximum wavelength value of the data
421+
Maximum wavelength value of the data.
423422
"""
424423
self.a_min = np.min(corner_a)
425424
self.a_max = np.max(corner_a)
@@ -595,7 +594,7 @@ def print_cube_geometry(self):
595594

596595
def build_ifucube(self):
597596
"""
598-
Create the IFU cube.
597+
Create an IFU cube.
599598
600599
1. Loop over every band contained in the IFU cube and read in the data
601600
associated with the band
@@ -1196,9 +1195,8 @@ def determine_cube_parameters(self):
11961195
"""
11971196
Determine the spatial and wavelength roi size if IFU covers more than 1 band of data.
11981197
1199-
If the IFU cube covers more than 1 band - then use the rules to
1198+
If the IFU cube covers more than 1 band, then use the rules to
12001199
define the spatial and wavelength roi size to use for the cube
1201-
Current Rule: using the minimum
12021200
"""
12031201
# initialize
12041202
wave_roi = None
@@ -1467,7 +1465,7 @@ def determine_cube_parameters(self):
14671465

14681466
def setup_ifucube_wcs(self):
14691467
"""
1470-
Determine the min and max coordinates of the spectral cube.
1468+
Set up the wcs of the IFU cube.
14711469
14721470
Loop over every datamodel contained in the cube and find the WCS
14731471
of the output cube that contains all the data.
@@ -1758,9 +1756,9 @@ def map_detector_to_outputframe(self, this_par1, subtract_background, input_mode
17581756
roiw_det: numpy.ndarray
17591757
Spectral roi size associated with coord1,coord2
17601758
weight_det : numpy.ndarray
1761-
Weighting parameter association with coord1,coord2
1759+
Weighting parameter associated with coord1,coord2
17621760
softrad_det : numpy.ndarray
1763-
Weighting parameter association with coord1,coord2
1761+
Weighting parameter associated with coord1,coord2
17641762
"""
17651763
# initialize alpha_det and beta_det to None. These are filled in
17661764
# if the instrument is MIRI and the weighting is miripsf
@@ -1987,7 +1985,7 @@ def map_detector_to_outputframe(self, this_par1, subtract_background, input_mode
19871985

19881986
def map_miri_pixel_to_sky(self, input_model, this_par1, subtract_background, offsets):
19891987
"""
1990-
Loop over a file and map the detector pixels to the output cube.
1988+
Loop over a MIRI model and map the detector pixels to the output cube.
19911989
19921990
The output frame is on the SKY (ra-dec)
19931991
Return the coordinates of all the detector pixel in the output frame.
@@ -2150,7 +2148,7 @@ def map_miri_pixel_to_sky(self, input_model, this_par1, subtract_background, off
21502148
# ______________________________________________________________________
21512149
def map_nirspec_pixel_to_sky(self, input_model, offsets):
21522150
"""
2153-
Loop over a file and map the detector pixels to the output cube.
2151+
Loop over a NIRSpec model and map the detector pixels to the output cube.
21542152
21552153
The output frame is on the SKY (ra-dec)
21562154
Return the coordinates of all the detector pixel in the output frame.
@@ -2334,7 +2332,6 @@ def map_nirspec_pixel_to_sky(self, input_model, offsets):
23342332

23352333
valid_data = np.where(flag_det == 1)
23362334
y, x = valid_data
2337-
23382335
wave = lam_det[valid_data]
23392336
slice_no = slice_det[valid_data]
23402337
dwave = dwave_det[valid_data]

jwst/cube_build/instrument_defaults.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,21 +1140,6 @@ def set_wave_max(self, value, parameter1, parameter2):
11401140
"""
11411141
self.Info[parameter1][parameter2]["wavemax"] = value
11421142

1143-
# def set_spatial_roi(self, value, parameter1, parameter2):
1144-
# self.Info[parameter1][parameter2]["sroi"] = value
1145-
1146-
# def set_wave_roi(self, value, parameter1, parameter2):
1147-
# self.Info[parameter1][parameter2]["wroi"] = value
1148-
1149-
# def set_msm_power(self, value, parameter1, parameter2):
1150-
# self.Info[parameter1][parameter2]["msm_power"] = value
1151-
1152-
# def set_soft_rad(self, value, parameter1, parameter2):
1153-
# self.Info[parameter1][parameter2]["softrad"] = value
1154-
1155-
# def set_scale_rad(self, value, parameter1, parameter2):
1156-
# self.Info[parameter1][parameter2]["scalerad"] = value
1157-
11581143
# Get functions
11591144

11601145
def get_wave_roi(self, parameter1, parameter2):

0 commit comments

Comments
 (0)