Skip to content

Commit

Permalink
Merge branch 'master' into pep621
Browse files Browse the repository at this point in the history
  • Loading branch information
mfixstsci authored Aug 21, 2023
2 parents 1e1155e + d6a9b6f commit ce9248c
Show file tree
Hide file tree
Showing 105 changed files with 793,521 additions and 334,312 deletions.
26 changes: 26 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
builder: html
configuration: docs/conf.py
fail_on_warning: true

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
install:
- method: pip
path: .
extra_requirements:
- docs

# Optionally build your docs in additional formats such as PDF and ePub
formats:
- htmlzip
- pdf
7 changes: 3 additions & 4 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Changes included in this version
--------------------------------

Edit this template to detail updates to the codebase
v0.19.1
-------
- Patch for new numpy version release (1.25.0). This version deprecated np.int and np.float. This release removes mention of these old methods.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,37 +59,37 @@ Plotting (only a small subset of options is illustrated):
</p>

````
import matplotlib.pyplot as pl
import matplotlib.pyplot as plt
pl.figure(figsize=(4, 4), facecolor='w', edgecolor='k'); pl.clf()
plt.figure(figsize=(4, 4), facecolor='w', edgecolor='k'); plt.clf()
# plot single aperture
nis_cen.plot()
# plot all apertures in SIAF
for aperture_name, aperture in siaf.apertures.items():
aperture.plot()
pl.show()
plt.show()
````
````
# plot 'master' apertures
from pysiaf.siaf import plot_master_apertures
pl.figure(figsize=(8, 8), facecolor='w', edgecolor='k'); pl.clf()
plt.figure(figsize=(8, 8), facecolor='w', edgecolor='k'); plt.clf()
plot_master_apertures(mark_ref=True)
pl.show()
plt.show()
````
````
# plot HST apertures
siaf = pysiaf.Siaf('HST')
aperture_names = ['FGS1', 'FGS2', 'FGS3', 'IUVIS1FIX', 'IUVIS2FIX', 'JWFC1FIX', 'JWFC2FIX']
pl.figure(figsize=(4, 4), facecolor='w', edgecolor='k')
plt.figure(figsize=(4, 4), facecolor='w', edgecolor='k')
for aperture_name in aperture_names:
siaf[aperture_name].plot(color='r', fill_color='darksalmon', mark_ref=True)
ax = pl.gca()
ax = plt.gca()
ax.set_aspect('equal')
ax.invert_yaxis()
pl.show()
plt.show()
````

Expand Down Expand Up @@ -133,7 +133,7 @@ The following describes the typical work flow for contributing to the pysiaf pro
11. Delete your local copy of your branch.

### Installation
This package is supported in python 3.7, 3.8 and 3.9
This package is supported in python 3.8 and 3.9

`pip install pysiaf`

Expand Down
3 changes: 3 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,3 +430,6 @@ def check_sphinx_version(expected_version):

# If false, no index is generated.
# epub_use_index = True

# Enable nitpicky mode - which ensures that all references in the docs resolve.
nitpicky = True
2 changes: 1 addition & 1 deletion generate/generate_fgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
polynomial_coefficients = iando.read.read_siaf_distortion_coefficients(instrument, AperName)

number_of_coefficients = len(polynomial_coefficients)
polynomial_degree = np.int((np.sqrt(8 * number_of_coefficients + 1) - 3) / 2)
polynomial_degree = int((np.sqrt(8 * number_of_coefficients + 1) - 3) / 2)

# set polynomial coefficients
siaf_indices = ['{:02d}'.format(d) for d in polynomial_coefficients['siaf_index'].tolist()]
Expand Down
46 changes: 28 additions & 18 deletions generate/generate_nircam.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
polynomial_coefficients = iando.read.read_siaf_distortion_coefficients(instrument, AperName)

number_of_coefficients = len(polynomial_coefficients)
polynomial_degree = np.int((np.sqrt(8 * number_of_coefficients + 1) - 3) / 2)
polynomial_degree = int((np.sqrt(8 * number_of_coefficients + 1) - 3) / 2)
aperture.Sci2IdlDeg = polynomial_degree

# set polynomial coefficients
Expand Down Expand Up @@ -163,8 +163,8 @@
if (sca_name == 'NRCA5') and (('MASK335R' in aperture.AperName) or ('MASK430R' in aperture.AperName)):
# see https://jira.stsci.edu/browse/JWSTSIAF-77
sca_name += '335R430R'
v2_offset = np.float(wedge_offsets['v2_offset'][wedge_offsets['name'] == sca_name])
v3_offset = np.float(wedge_offsets['v3_offset'][wedge_offsets['name'] == sca_name])
v2_offset = float(wedge_offsets['v2_offset'][wedge_offsets['name'] == sca_name])
v3_offset = float(wedge_offsets['v3_offset'][wedge_offsets['name'] == sca_name])
aperture.V2Ref += v2_offset
aperture.V3Ref += v3_offset
elif dependency_type == 'dhspil_wedge':
Expand Down Expand Up @@ -388,21 +388,31 @@

create_jira_plots = True
if create_jira_plots:
# # make figures for JWSTSIAF-245 Jira ticket
selected_aperture_names = [['NRCA1_FULL_WEDGE_RND','NRCA2_FULL_WEDGE_RND','NRCA3_FULL_WEDGE_RND','NRCA4_FULL_WEDGE_RND','NRCA2_MASK210R'],
['NRCA1_FULL_WEDGE_BAR','NRCA2_FULL_WEDGE_BAR','NRCA3_FULL_WEDGE_BAR','NRCA4_FULL_WEDGE_BAR','NRCA4_MASKSWB'],
['NRCA5_FULL_WEDGE_RND','NRCA5_MASK335R','NRCA5_MASK430R'],
['NRCA5_FULL_WEDGE_BAR','NRCA5_MASKLWB'],
['NRCA2_MASK210R','NRCA2_TAMASK210R','NRCA2_FSTAMASK210R'],
['NRCA4_MASKSWB','NRCA4_MASKSWB_F182M','NRCA4_MASKSWB_F187N','NRCA4_MASKSWB_F210M','NRCA4_MASKSWB_F212N','NRCA4_MASKSWB_F200W','NRCA4_MASKSWB_NARROW',
'NRCA4_TAMASKSWB','NRCA4_TAMASKSWBS','NRCA4_FSTAMASKSWB' ],
['NRCA5_MASK335R','NRCA5_TAMASK335R','NRCA5_FSTAMASK335R'],
['NRCA5_MASK430R','NRCA5_TAMASK430R','NRCA5_FSTAMASK430R'],
['NRCA5_MASKLWB','NRCA5_MASKLWB_F250M','NRCA5_MASKLWB_F300M','NRCA5_MASKLWB_F277W','NRCA5_MASKLWB_F335M','NRCA5_MASKLWB_F360M','NRCA5_MASKLWB_F356W',
'NRCA5_MASKLWB_F410M','NRCA5_MASKLWB_F430M','NRCA5_MASKLWB_F460M','NRCA5_MASKLWB_F480M','NRCA5_MASKLWB_F444W','NRCA5_MASKLWB_NARROW',
'NRCA5_TAMASKLWB','NRCA5_TAMASKLWBL','NRCA5_FSTAMASKLWB']
]

# # make figures for JWSTSIAF-189 Jira ticket
selected_aperture_names = [['NRCA2_MASK210R', 'NRCA5_MASK210R','NRCA2_FULL_MASK210R', 'NRCA5_FULL_MASK210R'],
['NRCA5_MASK335R', 'NRCA2_MASK335R','NRCA5_FULL_MASK335R', 'NRCA2_FULL_MASK335R','NRCA5_MASK430R', 'NRCA2_MASK430R',
'NRCA5_FULL_MASK430R', 'NRCA2_FULL_MASK430R'],
['NRCA4_MASKSWB', 'NRCA5_MASKSWB','NRCA4_MASKSWB_F182M', 'NRCA5_MASKSWB_F182M','NRCA4_MASKSWB_F187N',
'NRCA5_MASKSWB_F187N','NRCA4_MASKSWB_F210M', 'NRCA5_MASKSWB_F210M','NRCA4_MASKSWB_F212N',
'NRCA5_MASKSWB_F212N','NRCA4_MASKSWB_F200W', 'NRCA5_MASKSWB_F200W','NRCA4_MASKSWB_NARROW', 'NRCA5_MASKSWB_NARROW'],
['NRCA4_FULL_MASKSWB', 'NRCA5_FULL_MASKSWB','NRCA4_FULL_MASKSWB_F182M', 'NRCA5_FULL_MASKSWB_F182M','NRCA4_FULL_MASKSWB_F187N',
'NRCA5_FULL_MASKSWB_F187N','NRCA4_FULL_MASKSWB_F210M', 'NRCA5_FULL_MASKSWB_F210M','NRCA4_FULL_MASKSWB_F212N', 'NRCA5_FULL_MASKSWB_F212N',
'NRCA4_FULL_MASKSWB_F200W', 'NRCA5_FULL_MASKSWB_F200W','NRCA4_FULL_MASKSWB_NARROW', 'NRCA5_FULL_MASKSWB_NARROW'],
['NRCA5_400X256_MASKLWB', 'NRCA4_400X256_MASKLWB','NRCA5_400X256_MASKLWB_F250M', 'NRCA4_400X256_MASKLWB_F250M',
'NRCA5_400X256_MASKLWB_F300M', 'NRCA4_400X256_MASKLWB_F300M','NRCA5_400X256_MASKLWB_F277W', 'NRCA4_400X256_MASKLWB_F277W',
'NRCA5_400X256_MASKLWB_F335M', 'NRCA4_400X256_MASKLWB_F335M','NRCA5_400X256_MASKLWB_F360M', 'NRCA4_400X256_MASKLWB_F360M',
'NRCA5_400X256_MASKLWB_F356W', 'NRCA4_400X256_MASKLWB_F356W','NRCA5_400X256_MASKLWB_F410M', 'NRCA4_400X256_MASKLWB_F410M',
'NRCA5_400X256_MASKLWB_F430M', 'NRCA4_400X256_MASKLWB_F430M','NRCA5_400X256_MASKLWB_F460M', 'NRCA4_400X256_MASKLWB_F460M',
'NRCA5_400X256_MASKLWB_F480M', 'NRCA4_400X256_MASKLWB_F480M','NRCA5_400X256_MASKLWB_F444W', 'NRCA4_400X256_MASKLWB_F444W',
'NRCA5_400X256_MASKLWB_NARROW', 'NRCA4_400X256_MASKLWB_NARROW'],
['NRCA5_FULL_MASKLWB', 'NRCA4_FULL_MASKLWB','NRCA5_FULL_MASKLWB_F250M', 'NRCA4_FULL_MASKLWB_F250M',
'NRCA5_FULL_MASKLWB_F300M', 'NRCA4_FULL_MASKLWB_F300M','NRCA5_FULL_MASKLWB_F277W', 'NRCA4_FULL_MASKLWB_F277W',
'NRCA5_FULL_MASKLWB_F335M', 'NRCA4_FULL_MASKLWB_F335M','NRCA5_FULL_MASKLWB_F360M', 'NRCA4_FULL_MASKLWB_F360M',
'NRCA5_FULL_MASKLWB_F356W', 'NRCA4_FULL_MASKLWB_F356W','NRCA5_FULL_MASKLWB_F410M', 'NRCA4_FULL_MASKLWB_F410M',
'NRCA5_FULL_MASKLWB_F430M', 'NRCA4_FULL_MASKLWB_F430M','NRCA5_FULL_MASKLWB_F460M', 'NRCA4_FULL_MASKLWB_F460M',
'NRCA5_FULL_MASKLWB_F480M', 'NRCA4_FULL_MASKLWB_F480M','NRCA5_FULL_MASKLWB_F444W', 'NRCA4_FULL_MASKLWB_F444W',
'NRCA5_FULL_MASKLWB_NARROW', 'NRCA4_FULL_MASKLWB_NARROW']
]

for selected_aperture_name in selected_aperture_names:
compare.compare_inspection_figures(pre_delivery_siaf, reference_siaf_input=ref_siaf,
Expand Down
2 changes: 1 addition & 1 deletion generate/generate_niriss.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
polynomial_coefficients = iando.read.read_siaf_distortion_coefficients(instrument, AperName)

number_of_coefficients = len(polynomial_coefficients)
polynomial_degree = np.int((np.sqrt(8 * number_of_coefficients + 1) - 3) / 2)
polynomial_degree = int((np.sqrt(8 * number_of_coefficients + 1) - 3) / 2)

# set polynomial coefficients
siaf_indices = ['{:02d}'.format(d) for d in polynomial_coefficients['siaf_index'].tolist()]
Expand Down
14 changes: 7 additions & 7 deletions generate/generate_nirspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def read_pcf_gtp(file_name):
# transform to numpy array when possible
for key in data.keys():
try:
data[key] = np.array(data[key][0].split()).astype(np.float)
data[key] = np.array(data[key][0].split()).astype(float)
except:
pass

Expand Down Expand Up @@ -802,7 +802,7 @@ def rows(pcfName, new_pcf_format=False):
# 'F140X_GWA_OTE', 'F110W_GWA_OTE', 'CLEAR_GWA_OTE']
elif AperName in pcf_file_mapping.keys():
number_of_coefficients = len(pcf_data[AperName]['A'])
polynomial_degree = np.int((np.sqrt(8 * number_of_coefficients + 1) - 3) / 2)
polynomial_degree = int((np.sqrt(8 * number_of_coefficients + 1) - 3) / 2)
aperture.Sci2IdlDeg = polynomial_degree
k = 0
# polynomial coefficients for transformation that goes directly from the GWA pupil plane to the sky
Expand All @@ -816,10 +816,10 @@ def rows(pcfName, new_pcf_format=False):

# coefficients to apply the reflection in the MIRROR taking into account the correction
# to the GWA position as derived from the sensor readings and their calibration relation
aperture.XSciScale = np.float(disperser_mirror_tiltx['CoeffsTemperature00'][0])
aperture.YSciScale = np.float(disperser_mirror_tilty['CoeffsTemperature00'][0])
aperture.XSciRef = np.float(disperser_mirror_tiltx['Zeroreadings'][0])
aperture.YSciRef = np.float(disperser_mirror_tilty['Zeroreadings'][0])
aperture.XSciScale = float(disperser_mirror_tiltx['CoeffsTemperature00'][0])
aperture.YSciScale = float(disperser_mirror_tilty['CoeffsTemperature00'][0])
aperture.XSciRef = float(disperser_mirror_tiltx['Zeroreadings'][0])
aperture.YSciRef = float(disperser_mirror_tilty['Zeroreadings'][0])
aperture.DDCName = 'None'

# TRANSFORM apertures for the conversion between the OTE image plane and the MSA plane
Expand All @@ -838,7 +838,7 @@ def rows(pcfName, new_pcf_format=False):
fore_pcf_data = read_pcf_gtp(fore_pcf)

# deal with different formats of the .pcf files
fore_year = np.int(fore_pcf_data['DATE'][0][0:4])
fore_year = int(fore_pcf_data['DATE'][0][0:4])
if fore_year > 2016:
new_pcf_format = True
else:
Expand Down
6 changes: 3 additions & 3 deletions generate/generate_reference_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ def generate_siaf_pre_flight_reference_files_nircam():

#generate distortion reference file
number_of_coefficients = len(A)
polynomial_degree = np.int((np.sqrt(8 * number_of_coefficients + 1) - 3) / 2)
polynomial_degree = int((np.sqrt(8 * number_of_coefficients + 1) - 3) / 2)
siaf_index = []
exponent_x = []
exponent_y = []
Expand Down Expand Up @@ -1143,7 +1143,7 @@ def generate_siaf_pre_flight_reference_files_niriss(distortion_file_name, verbos


number_of_coefficients = len(AR)
polynomial_degree = np.int((np.sqrt(8 * number_of_coefficients + 1) - 3) / 2)
polynomial_degree = int((np.sqrt(8 * number_of_coefficients + 1) - 3) / 2)

# if oss is False:
if 1:
Expand Down Expand Up @@ -1294,7 +1294,7 @@ def generate_siaf_pre_flight_reference_files_fgs(verbose=False, mode='siaf'):
-2.81501600E-15, -1.73025000E-15, 2.57732600E-15, 1.75268080E-15, 2.95238320E-15])

number_of_coefficients = len(A)
polynomial_degree = np.int((np.sqrt(8 * number_of_coefficients + 1) - 3) / 2)
polynomial_degree = int((np.sqrt(8 * number_of_coefficients + 1) - 3) / 2)

# generate distortion coefficient files
siaf_index = []
Expand Down
2 changes: 1 addition & 1 deletion pysiaf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# Check PRD version is up to date
try:
req = requests.get('https://github.com/spacetelescope/pysiaf/tree/master/pysiaf/prd_data/JWST').text
p = re.compile("/spacetelescope/pysiaf/tree/master/pysiaf/prd_data/JWST/(.*?)/SIAFXML")
p = re.compile("pysiaf/prd_data/JWST/(.*?)/SIAFXML")
prd_list = p.findall(req)
prd_list.sort()
newest_prd = [prd for i, prd in enumerate(prd_list) if
Expand Down
8 changes: 4 additions & 4 deletions pysiaf/aperture.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def set_distortion_coefficients_from_file(self, file_name):
polynomial_coefficients = read.read_siaf_distortion_coefficients(file_name=file_name)

number_of_coefficients = len(polynomial_coefficients)
polynomial_degree = np.int((np.sqrt(8 * number_of_coefficients + 1) - 3) / 2)
polynomial_degree = int((np.sqrt(8 * number_of_coefficients + 1) - 3) / 2)
self.Sci2IdlDeg = polynomial_degree

# set polynomial coefficients
Expand Down Expand Up @@ -910,7 +910,7 @@ def distortion_transform(self, from_system, to_system, include_offset=True):
# Get the coefficients for "science" to "ideal" transformation (and back)

# degree of distortion polynomial
degree = np.int(getattr(self, 'Sci2IdlDeg'))
degree = int(getattr(self, 'Sci2IdlDeg'))

number_of_coefficients = polynomial.number_of_coefficients(degree)
all_keys = self.__dict__.keys()
Expand Down Expand Up @@ -1513,8 +1513,8 @@ def dms_corner(self):
This corresponds to the OSS corner position (x: ColCorner, y: RowCorner).
The notation for OSS is 1-based, i.e. the lower left corner of a FULL subarray is (1,1)
"""
col_corner = np.ceil(np.min(self.corners('det')[0])).astype(np.int_)
row_corner = np.ceil(np.min(self.corners('det')[1])).astype(np.int_)
col_corner = np.ceil(np.min(self.corners('det')[0])).astype(int)
row_corner = np.ceil(np.min(self.corners('det')[1])).astype(int)

return col_corner, row_corner

Expand Down
Loading

0 comments on commit ce9248c

Please sign in to comment.