Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding stcal-alignment sub-package. #196

Merged
merged 133 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from 132 commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
856ffba
Update .gitignore file.
mairanteodoro Jun 29, 2023
a4fed92
Create subpackage and initial module structure.
mairanteodoro Jun 29, 2023
f57851a
Add methods to alignment.util.
mairanteodoro Jun 30, 2023
556279d
Update .gitignore.
mairanteodoro Jul 5, 2023
1a3628e
Remove unused modules.
mairanteodoro Jul 5, 2023
a09e0cb
Clean module.
mairanteodoro Jul 6, 2023
9ab2e44
Update .gitignore.
mairanteodoro Jul 6, 2023
9441dd4
Add methods necessary for resample.
mairanteodoro Jul 6, 2023
f0013aa
Small changes to accommodate both JWST and RST datamodels.
mairanteodoro Jul 7, 2023
66ea089
Add CHANGES.rst entry.
mairanteodoro Jul 7, 2023
48e3d60
Add PR number to CHANGES.rst entry.
mairanteodoro Jul 7, 2023
66ba3fe
use protocols
nden Jul 9, 2023
3906abf
temp
nden Jul 9, 2023
3467f81
add dependencies
nden Jul 9, 2023
13c342f
add CI testing to alignment branch
nden Jul 9, 2023
42423d3
add CI testing to alignment branch
nden Jul 9, 2023
b8b8cc0
fix test
nden Jul 10, 2023
fa86a3e
Add setting of number_extended_events (#178)
mwregan2 Jul 7, 2023
0eea0e5
Rename variables with FITS keywords names.
mairanteodoro Jul 10, 2023
7c136a7
Style reformating.
mairanteodoro Jul 10, 2023
cc7d689
Update docs to include stcal.alignment.
mairanteodoro Jul 12, 2023
f4f379d
Revert "Rename variables with FITS keywords names."
mairanteodoro Jul 12, 2023
afa9e7a
Updates to address most comments.
mairanteodoro Jul 12, 2023
0cd3621
Fix misplaced comment.
mairanteodoro Jul 12, 2023
a8839a9
Code refactoring and additional unit test.
mairanteodoro Jul 13, 2023
47f785b
Silencing style check warning F403.
mairanteodoro Jul 13, 2023
424fd38
Small style refactoring.
mairanteodoro Jul 13, 2023
d67e0b9
Set minimum asdf version.
mairanteodoro Jul 13, 2023
1229f02
Update matplotlib's inventory URL.
mairanteodoro Jul 13, 2023
500479a
Set lower version for gwcs.
mairanteodoro Jul 13, 2023
eeccb1b
Bump astropy version to >= 5.1.
mairanteodoro Jul 13, 2023
7e6dbf3
Fix docs style issues.
mairanteodoro Jul 14, 2023
d52c609
Style check fix.
mairanteodoro Jul 14, 2023
0a1fa45
Add methods necessary for resample.
mairanteodoro Jul 6, 2023
846d6f0
Small changes to accommodate both JWST and RST datamodels.
mairanteodoro Jul 7, 2023
ec98251
Add CHANGES.rst entry.
mairanteodoro Jul 7, 2023
d74b115
Add PR number to CHANGES.rst entry.
mairanteodoro Jul 7, 2023
57a3ef9
use protocols
nden Jul 9, 2023
727c7a1
temp
nden Jul 9, 2023
233ce46
add dependencies
nden Jul 9, 2023
c723e32
add CI testing to alignment branch
nden Jul 9, 2023
da051fb
add CI testing to alignment branch
nden Jul 9, 2023
520464f
fix test
nden Jul 10, 2023
07912e0
Add setting of number_extended_events (#178)
mwregan2 Jul 7, 2023
22d46e9
Rename variables with FITS keywords names.
mairanteodoro Jul 10, 2023
3f1f677
Style reformating.
mairanteodoro Jul 10, 2023
66840c3
Update docs to include stcal.alignment.
mairanteodoro Jul 12, 2023
dddbea6
Revert "Rename variables with FITS keywords names."
mairanteodoro Jul 12, 2023
2c0d44e
Updates to address most comments.
mairanteodoro Jul 12, 2023
376f7fe
Fix misplaced comment.
mairanteodoro Jul 12, 2023
d78b736
Code refactoring and additional unit test.
mairanteodoro Jul 13, 2023
b72978b
Silencing style check warning F403.
mairanteodoro Jul 13, 2023
8f1828a
Small style refactoring.
mairanteodoro Jul 13, 2023
9c7ee1e
Set minimum asdf version.
mairanteodoro Jul 13, 2023
f2d5e21
Update matplotlib's inventory URL.
mairanteodoro Jul 13, 2023
6649fa5
Set lower version for gwcs.
mairanteodoro Jul 13, 2023
f83f041
Bump astropy version to >= 5.1.
mairanteodoro Jul 13, 2023
ae168c0
Fix docs style issues.
mairanteodoro Jul 14, 2023
dc47316
Style check fix.
mairanteodoro Jul 14, 2023
bc7fdbc
Fix issue with bounding boxes in tests.
mairanteodoro Jul 18, 2023
6fe6df8
Fix issue with bounding boxes in tests.
mairanteodoro Jul 18, 2023
b97a839
Merge branch 'stcal-alignment' of github.com:mairanteodoro/stcal into…
mairanteodoro Jul 18, 2023
f03a11c
Fix issue with bounding box when creating WCS for tests. (#181)
mairanteodoro Aug 2, 2023
c09bd55
Add new methods required by resample_step.
mairanteodoro Aug 10, 2023
176845f
Small refactoring and clean ups.
mairanteodoro Aug 17, 2023
bc706e9
RCAL-632: add unit tests for new methods.
mairanteodoro Aug 17, 2023
53571f1
Resolve conflicts.
mairanteodoro Aug 17, 2023
0522779
Fix style check errors.
mairanteodoro Aug 17, 2023
3baee3b
Set sphinx version for compatibility with sphinx-rtd-theme.
mairanteodoro Aug 17, 2023
7d03957
Added working module.
s-goldman Aug 17, 2023
88e90f5
Added functional unit testing
s-goldman Aug 21, 2023
f81fbd9
Merge branch 'stcal-alignment' into stcal-alignment
mairanteodoro Aug 22, 2023
474d917
Added reproject.
s-goldman Aug 22, 2023
142e276
removed print statement
s-goldman Aug 22, 2023
2d12e10
Merge remote-tracking branch 'upstream/stcal-alignment' into stcal-al…
mairanteodoro Aug 22, 2023
665f1b3
Fix style issues.
mairanteodoro Aug 22, 2023
a89196b
Revert reproject commit.
mairanteodoro Aug 22, 2023
8acd94c
HLA-1096: Added Reproject function (#193)
s-goldman Aug 22, 2023
4644bdc
Resolve conflicts.
mairanteodoro Aug 22, 2023
77bbf75
RCAL-632: add unit tests for additional methods. (#190)
mairanteodoro Aug 22, 2023
4ebe12a
Merge remote-tracking branch 'upstream/stcal-alignment' into stcal-al…
mairanteodoro Aug 22, 2023
34ea51a
Small changes to accommodate both JWST and RST datamodels.
mairanteodoro Jul 7, 2023
1edc1c8
fix test
nden Jul 10, 2023
e238120
Rename variables with FITS keywords names.
mairanteodoro Jul 10, 2023
a26f046
Revert "Rename variables with FITS keywords names."
mairanteodoro Jul 12, 2023
97dccaf
Code refactoring and additional unit test.
mairanteodoro Jul 13, 2023
578fac3
Bump astropy version to >= 5.1.
mairanteodoro Jul 13, 2023
2a46a49
Fix docs style issues.
mairanteodoro Jul 14, 2023
3f31c44
Small refactoring and clean ups.
mairanteodoro Aug 17, 2023
759f796
Fix style issues.
mairanteodoro Aug 22, 2023
9ac8694
Revert reproject commit.
mairanteodoro Aug 22, 2023
220656f
Revert "Revert reproject commit."
mairanteodoro Aug 22, 2023
97c798f
Fix issue caused by bad conflict resolution.
mairanteodoro Aug 22, 2023
b42a922
Fix duplicate code.
mairanteodoro Aug 22, 2023
3771110
Style check fixes. (#194)
mairanteodoro Aug 23, 2023
8fa6112
Merge remote-tracking branch 'upstream/stcal-alignment' into stcal-al…
mairanteodoro Aug 23, 2023
10bb2a4
Merge branch 'main' into stcal-alignment
mairanteodoro Aug 23, 2023
497789d
Syncing stcal-alignment and main. (#195)
mairanteodoro Aug 23, 2023
3f32679
Moved test for alignment.reproject, remove ipynb.
s-goldman Aug 23, 2023
1bb82fc
Merge branch 'stcal-alignment' into alignment
s-goldman Aug 24, 2023
e0fad8c
Removed unnecessary file.
mairanteodoro Aug 24, 2023
9109381
Update test_alignment.py
s-goldman Aug 24, 2023
6a75ddc
Added astropy.io.fits
s-goldman Aug 24, 2023
55f0a31
Added import for highlevel WCS
s-goldman Aug 28, 2023
0f29409
Small text change.
s-goldman Aug 28, 2023
161d9fd
Files moved, added calculate_pixmap
s-goldman Aug 28, 2023
d426201
Ken's suggestions.
s-goldman Aug 28, 2023
23f2003
consistently named imports
s-goldman Aug 28, 2023
15c3ecd
formatting
s-goldman Aug 28, 2023
d6818d6
formatting
s-goldman Aug 28, 2023
87d732b
using pixel shape instead of bounding box
s-goldman Aug 28, 2023
b8a3b9c
Update src/stcal/alignment/resample_utils.py
s-goldman Aug 29, 2023
6c5242e
Update src/stcal/alignment/util.py
s-goldman Aug 29, 2023
bed60fa
Added correct shape, gwcs.WCS instead of WCS
s-goldman Aug 29, 2023
6b2ba14
Merge remote-tracking branch 'upstream/stcal-alignment' into alignment
s-goldman Aug 29, 2023
9753c59
added test_calc_pixmap
s-goldman Aug 29, 2023
ab413c0
relative import of util
s-goldman Aug 29, 2023
6281ba2
tests passing
s-goldman Aug 29, 2023
dc0e521
removed doubly imported reproject
s-goldman Sep 5, 2023
d6df8d4
output shape corrected
s-goldman Sep 7, 2023
6502ad7
Removed whitespace
s-goldman Sep 12, 2023
0381ab2
Added Nadia's code suggestions
s-goldman Sep 14, 2023
a841505
HLA-1096: Added reproject and calculate_pixmap functions with high-le…
s-goldman Sep 14, 2023
4751d30
Merge branch 'main' into stcal-alignment
mairanteodoro Sep 27, 2023
e7801dd
Fix docstring returned type issue.
mairanteodoro Sep 28, 2023
2626396
use PyPI upload workflow from OpenAstronomy (#214)
zacharyburnett Sep 28, 2023
af275b0
download WebbPSF data for downstream tests
zacharyburnett Sep 28, 2023
5c4dff9
pass env var
zacharyburnett Sep 28, 2023
7735528
Merge branch 'main' into stcal-alignment
mairanteodoro Sep 29, 2023
bab0c14
expand build matrix with more Python versions (#219)
zacharyburnett Oct 2, 2023
e0cc4f2
Updates to docs and CI.
mairanteodoro Oct 5, 2023
bef042f
Merge branch 'main' into stcal-alignment
mairanteodoro Oct 5, 2023
88d659e
Move CHANGES.rst entry.
mairanteodoro Oct 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ coverage.xml
.hypothesis/
.pytest_cache/
cover/
coverage/
cov.xml

# Translations
*.mo
Expand Down Expand Up @@ -86,7 +88,7 @@ ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
Expand Down Expand Up @@ -143,4 +145,7 @@ src/stcal/_version.py

# auto-generated API docs
docs/source/api
.DS_Store
.DS_Store

# VSCode stuff
.vscode
13 changes: 13 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Other
1.4.4 (2023-09-15)
==================

- Added ``alignment`` sub-package. [#179]
mairanteodoro marked this conversation as resolved.
Show resolved Hide resolved

Other
-----

Expand Down Expand Up @@ -88,6 +90,17 @@ Bug Fixes
jump
~~~~

- Added setting of number_extended_events for non-multiprocessing
mode. This is the value that is put into the header keyword EXTNCRS. [#178]

1.4.1 (2023-06-29)

Bug Fixes
---------

jump
~~~~

- Added statement to prevent the number of cores used in multiprocessing from
being larger than the number of rows. This was causing some CI tests to fail. [#176]

Expand Down
2 changes: 2 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
BUILDDIR = _build
APIDIR = api

# Internal variables
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
Expand All @@ -25,6 +26,7 @@ help:

clean:
-rm -rf $(BUILDDIR)/*
-rm -rf $(APIDIR)/*

html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
Expand Down
2 changes: 1 addition & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
stcall API
stcal API
==========

.. automodapi:: stcal
34 changes: 28 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
from pathlib import Path

import stsci_rtd_theme

if sys.version_info < (3, 11):
import tomli as tomllib
else:
import tomllib


def setup(app):
try:
Expand All @@ -27,7 +28,7 @@ def setup(app):
# values here:
with open(REPO_ROOT / "pyproject.toml", "rb") as configuration_file:
conf = tomllib.load(configuration_file)
setup_metadata = conf['project']
setup_metadata = conf["project"]

project = setup_metadata["name"]
primary_author = setup_metadata["authors"][0]
Expand All @@ -38,19 +39,40 @@ def setup(app):
version = package.__version__.split("-", 1)[0]
release = package.__version__

# Configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None),
"numpy": ("https://numpy.org/devdocs", None),
"scipy": ("http://scipy.github.io/devdocs", None),
"matplotlib": ("https://matplotlib.org/stable", None),
"gwcs": ("https://gwcs.readthedocs.io/en/latest/", None),
"astropy": ("https://docs.astropy.org/en/stable/", None),
}

extensions = [
"pytest_doctestplus.sphinx.doctestplus",
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
"sphinx.ext.coverage",
"sphinx.ext.inheritance_diagram",
"sphinx.ext.viewcode",
"sphinx.ext.autosummary",
"sphinx.ext.napoleon",
"sphinx_automodapi.automodapi",
"numpydoc",
"sphinx_automodapi.automodsumm",
"sphinx_automodapi.autodoc_enhancements",
"sphinx_automodapi.smart_resolver",
"sphinx_asdf",
"sphinx.ext.mathjax",
]

autosummary_generate = True
numpydoc_show_class_members = False
autoclass_content = "both"

html_theme = "stsci_rtd_theme"
html_theme_options = {
"collapse_navigation": True
}
html_theme_options = {"collapse_navigation": True}
html_theme_path = [stsci_rtd_theme.get_html_theme_path()]
html_domain_indices = True
html_sidebars = {"**": ["globaltoc.html", "relations.html", "searchbox.html"]}
Expand Down
4 changes: 4 additions & 0 deletions docs/stcal/alignment/description.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Description
============

This sub-package contains all the modules common to all missions.
12 changes: 12 additions & 0 deletions docs/stcal/alignment/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.. _alignment:

===============
Alignment Utils
===============

.. toctree::
:maxdepth: 2

description.rst

.. automodapi:: stcal.alignment
1 change: 1 addition & 0 deletions docs/stcal/package_index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ Package Index

jump/index.rst
ramp_fitting/index.rst
alignment/index.rst
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,21 @@ dependencies = [
'scipy >=1.6.0',
'numpy >=1.20',
'opencv-python-headless >=4.6.0.66',
'asdf >=2.15.0',
'gwcs >= 0.18.1',
]
dynamic = ['version']

[project.optional-dependencies]
docs = [
'numpydoc',
'packaging >=17',
'sphinx',
'sphinx<7.0.0',
'sphinx-asdf',
'sphinx-astropy',
'sphinx-rtd-theme',
'stsci-rtd-theme',
'tomli; python_version <"3.11"',
'tomli; python_version <="3.11"',
]
test = [
'psutil',
Expand Down
1 change: 1 addition & 0 deletions src/stcal/alignment/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .util import * # noqa: F403
40 changes: 40 additions & 0 deletions src/stcal/alignment/resample_utils.py
mairanteodoro marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import logging
import numpy as np
from stcal.alignment import util
from gwcs.wcstools import grid_from_bounding_box

log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)


def calc_pixmap(in_wcs, out_wcs, shape=None):
"""Return a pixel grid map from input frame to output frame
Parameters
----------
in_wcs : `~astropy.wcs.WCS`
Input WCS objects or transforms.
out_wcs : `~astropy.wcs.WCS` or `~gwcs.wcs.WCS`
output WCS objects or transforms.
shape : tuple, optional
Shape of grid in pixels. The default is None.
Returns
-------
pixmap : ndarray of shape (xdim, ydim, 2)
Reprojected pixel grid map. `pixmap[xin, yin]` returns `xout,
yout` indices in the output image.
"""
if shape:
bb = util.wcs_bbox_from_shape(shape)
log.debug("Bounding box from data shape: {}".format(bb))
else:
bb = util.wcs_bbox_from_shape(in_wcs.pixel_shape)
log.debug("Bounding box from WCS: {}".format(bb))

# creates 2 grids, one with rows of all x values * len(y) rows,
# and the reverse for all y columns
grid = grid_from_bounding_box(bb)
transform_function = util.reproject(in_wcs, out_wcs)
pixmap = np.dstack(transform_function(grid[0], grid[1]))
return pixmap
Loading
Loading