wfc3tools 1.6.0__tar.gz → 1.6.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/.github/CODEOWNERS +1 -1
  2. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/.github/dependabot.yml +2 -1
  3. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/.github/workflows/build.yml +1 -1
  4. wfc3tools-1.6.1/.github/workflows/tests.yml +33 -0
  5. wfc3tools-1.6.1/.pre-commit-config.yaml +14 -0
  6. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/.readthedocs.yaml +2 -2
  7. wfc3tools-1.6.1/.ruff.toml +24 -0
  8. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/CHANGES.rst +4 -0
  9. {wfc3tools-1.6.0/wfc3tools.egg-info → wfc3tools-1.6.1}/PKG-INFO +12 -21
  10. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/README.rst +9 -19
  11. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/rtd_environment.yaml +1 -3
  12. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/pyproject.toml +2 -7
  13. wfc3tools-1.6.1/tox.ini +17 -0
  14. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/wfc3tools/calwf3.py +13 -12
  15. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/wfc3tools/embedsub.py +29 -31
  16. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/wfc3tools/pstack.py +11 -14
  17. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/wfc3tools/pstat.py +31 -23
  18. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/wfc3tools/sampinfo.py +17 -19
  19. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/wfc3tools/sub2full.py +16 -17
  20. wfc3tools-1.6.1/wfc3tools/tests/test_calwf3.py +14 -0
  21. wfc3tools-1.6.1/wfc3tools/tests/test_pstack.py +56 -0
  22. wfc3tools-1.6.1/wfc3tools/tests/test_pstat.py +82 -0
  23. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/wfc3tools/tests/test_sampinfo.py +19 -21
  24. wfc3tools-1.6.1/wfc3tools/tests/test_sub2full.py +52 -0
  25. wfc3tools-1.6.1/wfc3tools/util.py +64 -0
  26. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/wfc3tools/version.py +3 -3
  27. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/wfc3tools/wf32d.py +29 -19
  28. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/wfc3tools/wf3ccd.py +27 -18
  29. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/wfc3tools/wf3cte.py +5 -6
  30. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/wfc3tools/wf3ir.py +5 -5
  31. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/wfc3tools/wf3rej.py +29 -16
  32. {wfc3tools-1.6.0 → wfc3tools-1.6.1/wfc3tools.egg-info}/PKG-INFO +12 -21
  33. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/wfc3tools.egg-info/SOURCES.txt +2 -0
  34. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/wfc3tools.egg-info/requires.txt +2 -1
  35. wfc3tools-1.6.0/.github/workflows/tests.yml +0 -20
  36. wfc3tools-1.6.0/tox.ini +0 -53
  37. wfc3tools-1.6.0/wfc3tools/tests/test_calwf3.py +0 -22
  38. wfc3tools-1.6.0/wfc3tools/tests/test_pstack.py +0 -31
  39. wfc3tools-1.6.0/wfc3tools/tests/test_pstat.py +0 -36
  40. wfc3tools-1.6.0/wfc3tools/tests/test_sub2full.py +0 -55
  41. wfc3tools-1.6.0/wfc3tools/util.py +0 -60
  42. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/.gitignore +0 -0
  43. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/CODE_OF_CONDUCT.md +0 -0
  44. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/LICENSE.txt +0 -0
  45. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/MANIFEST.in +0 -0
  46. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/Makefile +0 -0
  47. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/_static/calwf3_flow.png +0 -0
  48. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/_static/ir_data_format.png +0 -0
  49. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/_static/pstack_example.png +0 -0
  50. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/_static/pstat_example.png +0 -0
  51. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/_static/raw_uvis_format.png +0 -0
  52. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/_static/stsci_pri_combo_mark_white.png +0 -0
  53. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/_static/sub2full_translate.png +0 -0
  54. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/_static/uvis_data_format.png +0 -0
  55. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/_static/wfc3_Ch33_1.png +0 -0
  56. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/_static/wfc3_Ch33_5.png +0 -0
  57. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/_static/wfc_logo.png +0 -0
  58. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/conf.py +0 -0
  59. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/exts/numfig.py +0 -0
  60. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/index.rst +0 -0
  61. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/make.bat +0 -0
  62. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/notebooks/README +0 -0
  63. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/notebooks/wf3persist.ipynb +0 -0
  64. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/wfc3tools/calwf3.rst +0 -0
  65. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/wfc3tools/embedsub.rst +0 -0
  66. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/wfc3tools/history.rst +0 -0
  67. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/wfc3tools/ir_pipeline.inc +0 -0
  68. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/wfc3tools/pstack.rst +0 -0
  69. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/wfc3tools/pstat.rst +0 -0
  70. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/wfc3tools/sampinfo.rst +0 -0
  71. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/wfc3tools/sub2full.rst +0 -0
  72. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/wfc3tools/uvis_pipeline.inc +0 -0
  73. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/wfc3tools/wf32d.rst +0 -0
  74. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/wfc3tools/wf3ccd.rst +0 -0
  75. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/wfc3tools/wf3cte.rst +0 -0
  76. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/wfc3tools/wf3ir.rst +0 -0
  77. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/docs/wfc3tools/wf3rej.rst +0 -0
  78. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/setup.cfg +0 -0
  79. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/wfc3tools/__init__.py +0 -0
  80. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/wfc3tools.egg-info/dependency_links.txt +0 -0
  81. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/wfc3tools.egg-info/not-zip-safe +0 -0
  82. {wfc3tools-1.6.0 → wfc3tools-1.6.1}/wfc3tools.egg-info/top_level.txt +0 -0
@@ -1,3 +1,3 @@
1
1
  # automatically requests pull request reviews for files matching the given pattern; the last match takes precendence
2
2
 
3
- * @spacetelescope/wfc3tools-maintainers
3
+ * @pllim
@@ -7,8 +7,9 @@ updates:
7
7
  target-branch: "main"
8
8
  schedule:
9
9
  interval: monthly
10
- time: "03:30"
11
10
  groups:
12
11
  actions:
13
12
  patterns:
14
13
  - "*"
14
+ cooldown:
15
+ default-days: 7
@@ -8,7 +8,7 @@ on:
8
8
 
9
9
  jobs:
10
10
  build:
11
- uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@v2
11
+ uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@9f1fedda61294df4c004c05519a3fbf3b8e1f32f # v2.3.1
12
12
  with:
13
13
  upload_to_pypi: ${{ (github.event_name == 'release') && (github.event.action == 'released') }}
14
14
  secrets:
@@ -0,0 +1,33 @@
1
+ name: tests
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - '*x'
8
+ tags:
9
+ - '*'
10
+ pull_request:
11
+ schedule:
12
+ # Weekly Wednesday 9AM build
13
+ - cron: "0 9 * * 3"
14
+ workflow_dispatch:
15
+
16
+ concurrency:
17
+ group: ${{ github.workflow }}-${{ github.ref }}
18
+ cancel-in-progress: true
19
+
20
+ permissions:
21
+ contents: read
22
+
23
+ jobs:
24
+ test:
25
+ uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@9f1fedda61294df4c004c05519a3fbf3b8e1f32f # v2.3.1
26
+ with:
27
+ conda: true
28
+ envs: |
29
+ - linux: py311
30
+ - linux: py312
31
+ - macos: py313
32
+ # https://github.com/OpenAstronomy/github-actions-workflows/issues/342
33
+ #- linux: py314
@@ -0,0 +1,14 @@
1
+ ci:
2
+ autofix_prs: false
3
+ autoupdate_schedule: monthly
4
+
5
+ repos:
6
+ # lint and format
7
+ - repo: https://github.com/astral-sh/ruff-pre-commit
8
+ rev: v0.14.14
9
+ hooks:
10
+ - id: ruff-check
11
+ args:
12
+ - --fix
13
+ - --show-fixes
14
+ - id: ruff-format
@@ -3,9 +3,9 @@
3
3
  version: 2
4
4
 
5
5
  build:
6
- os: ubuntu-22.04
6
+ os: ubuntu-24.04
7
7
  tools:
8
- python: mambaforge-4.10
8
+ python: mambaforge-latest
9
9
 
10
10
  conda:
11
11
  environment: docs/rtd_environment.yaml
@@ -0,0 +1,24 @@
1
+ exclude = [
2
+ "docs",
3
+ ".tox",
4
+ ".eggs",
5
+ "build",
6
+ "__init__.py",
7
+ ]
8
+ line-length = 127
9
+
10
+ target-version = "py311"
11
+
12
+ [format]
13
+ quote-style = "double"
14
+ indent-style = "space"
15
+
16
+ [lint]
17
+ select = [
18
+ "F401", # Module imported but unused
19
+ "F811", # Redefinition of unused
20
+ "I", # isort
21
+ ]
22
+
23
+ [lint.isort]
24
+ known-first-party = ["wfc3tools"]
@@ -1,3 +1,7 @@
1
+ 1.6.1 (2026-02-06)
2
+ ------------------
3
+ - Maintenance release for CALDP build. No functional change.
4
+
1
5
  1.6.0 (2025-10-21)
2
6
  ------------------
3
7
  - Follow PEP621 to move build configuration pyproject.toml [#90]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wfc3tools
3
- Version: 1.6.0
3
+ Version: 1.6.1
4
4
  Summary: Python Tools for HST WFC3 Data
5
5
  Author: STScI
6
6
  Project-URL: Homepage, http://wfc3tools.readthedocs.io/
@@ -23,31 +23,30 @@ Requires-Dist: scipy>=1.8.0
23
23
  Provides-Extra: tests
24
24
  Requires-Dist: pytest; extra == "tests"
25
25
  Requires-Dist: astroquery; extra == "tests"
26
+ Requires-Dist: ci-watson; extra == "tests"
26
27
  Provides-Extra: docs
27
28
  Requires-Dist: sphinx; extra == "docs"
28
29
  Requires-Dist: sphinx-automodapi; extra == "docs"
29
- Requires-Dist: sphinx-rtd-theme; extra == "docs"
30
+ Requires-Dist: sphinx-rtd-theme>1.2.0; extra == "docs"
30
31
  Dynamic: license-file
31
32
 
32
33
  WFC3TOOLS
33
34
  =========
34
35
 
36
+ .. image:: https://github.com/spacetelescope/wfc3tools/actions/workflows/tests.yml/badge.svg?branch=main
37
+ :target: https://github.com/spacetelescope/wfc3tools/actions/workflows/tests.yml
38
+ :alt: tests
39
+
35
40
  .. image:: https://readthedocs.org/projects/wfc3tools/badge/?version=latest
36
- :target: http://wfc3tools.readthedocs.io/en/latest/?badge=latest
41
+ :target: https://wfc3tools.readthedocs.io/en/latest/?badge=latest
37
42
  :alt: Documentation Status
38
43
 
39
- .. image:: http://img.shields.io/badge/powered%20by-AstroPy-orange.svg?style=flat
40
- :target: http://www.astropy.org
44
+ .. image:: https://img.shields.io/badge/powered%20by-AstroPy-orange.svg?style=flat
45
+ :target: https://www.astropy.org
41
46
  :alt: Powered by Astropy Badge
42
47
 
43
48
 
44
- For more information please see the `online documentation <http://wfc3tools.readthedocs.io/>`_.
45
-
46
- You can also display the docs locally after install, import ``wfc3tools`` and then issue the following command to display the help docs in your local browser:
47
-
48
- ::
49
-
50
- wfc3tools.display_help()
49
+ For more information please see the `online documentation <https://wfc3tools.readthedocs.io/>`_.
51
50
 
52
51
  To install using pip:
53
52
 
@@ -73,19 +72,11 @@ or haven't used github before, please feel free to contact `HST Help Desk <https
73
72
  Feedback and feature requests? Is there something missing you would like
74
73
  to see? Please open an issue or contact `HST Help Desk <https://stsci.service-now.com/hst>`_.
75
74
 
76
- ``wfc3tools`` follows the `Astropy Code of Conduct`_ and strives to provide a
75
+ ``wfc3tools`` follows the STScI Code of Conduct and strives to provide a
77
76
  welcoming community to all of our users and contributors.
78
77
 
79
- Want more information about how to make a contribution? Take a look at
80
- the the astropy `contributing`_ and `developer`_ documentation.
81
-
82
78
 
83
79
  License
84
80
  -------
85
81
 
86
82
  ``wfc3tools`` is licensed under a 3-clause BSD style license (see the ``LICENSE.txt`` file).
87
-
88
- .. _AstroPy: http://www.astropy.org/
89
- .. _contributing: http://docs.astropy.org/en/stable/index.html#contributing
90
- .. _developer: http://docs.astropy.org/en/stable/index.html#developer-documentation
91
- .. _Astropy Code of Conduct: http://www.astropy.org/about.html#codeofconduct
@@ -1,22 +1,20 @@
1
1
  WFC3TOOLS
2
2
  =========
3
3
 
4
+ .. image:: https://github.com/spacetelescope/wfc3tools/actions/workflows/tests.yml/badge.svg?branch=main
5
+ :target: https://github.com/spacetelescope/wfc3tools/actions/workflows/tests.yml
6
+ :alt: tests
7
+
4
8
  .. image:: https://readthedocs.org/projects/wfc3tools/badge/?version=latest
5
- :target: http://wfc3tools.readthedocs.io/en/latest/?badge=latest
9
+ :target: https://wfc3tools.readthedocs.io/en/latest/?badge=latest
6
10
  :alt: Documentation Status
7
11
 
8
- .. image:: http://img.shields.io/badge/powered%20by-AstroPy-orange.svg?style=flat
9
- :target: http://www.astropy.org
12
+ .. image:: https://img.shields.io/badge/powered%20by-AstroPy-orange.svg?style=flat
13
+ :target: https://www.astropy.org
10
14
  :alt: Powered by Astropy Badge
11
15
 
12
16
 
13
- For more information please see the `online documentation <http://wfc3tools.readthedocs.io/>`_.
14
-
15
- You can also display the docs locally after install, import ``wfc3tools`` and then issue the following command to display the help docs in your local browser:
16
-
17
- ::
18
-
19
- wfc3tools.display_help()
17
+ For more information please see the `online documentation <https://wfc3tools.readthedocs.io/>`_.
20
18
 
21
19
  To install using pip:
22
20
 
@@ -42,19 +40,11 @@ or haven't used github before, please feel free to contact `HST Help Desk <https
42
40
  Feedback and feature requests? Is there something missing you would like
43
41
  to see? Please open an issue or contact `HST Help Desk <https://stsci.service-now.com/hst>`_.
44
42
 
45
- ``wfc3tools`` follows the `Astropy Code of Conduct`_ and strives to provide a
43
+ ``wfc3tools`` follows the STScI Code of Conduct and strives to provide a
46
44
  welcoming community to all of our users and contributors.
47
45
 
48
- Want more information about how to make a contribution? Take a look at
49
- the the astropy `contributing`_ and `developer`_ documentation.
50
-
51
46
 
52
47
  License
53
48
  -------
54
49
 
55
50
  ``wfc3tools`` is licensed under a 3-clause BSD style license (see the ``LICENSE.txt`` file).
56
-
57
- .. _AstroPy: http://www.astropy.org/
58
- .. _contributing: http://docs.astropy.org/en/stable/index.html#contributing
59
- .. _developer: http://docs.astropy.org/en/stable/index.html#developer-documentation
60
- .. _Astropy Code of Conduct: http://www.astropy.org/about.html#codeofconduct
@@ -1,8 +1,6 @@
1
- name: rtd311
2
1
  channels:
3
2
  - conda-forge
4
3
  dependencies:
5
- - python=3.11
4
+ - python=3.13
6
5
  - pip
7
6
  - graphviz
8
- - sphinx_rtd_theme>1.2.0
@@ -38,11 +38,12 @@ Help = "https://hsthelp.stsci.edu"
38
38
  tests = [
39
39
  "pytest",
40
40
  "astroquery",
41
+ "ci-watson",
41
42
  ]
42
43
  docs = [
43
44
  "sphinx",
44
45
  "sphinx-automodapi",
45
- "sphinx-rtd-theme",
46
+ "sphinx-rtd-theme>1.2.0",
46
47
  ]
47
48
 
48
49
  [build-system]
@@ -62,9 +63,3 @@ namespaces = false
62
63
 
63
64
  [tool.setuptools_scm]
64
65
  version_file = "wfc3tools/version.py"
65
-
66
- [tool.ruff]
67
- extend-ignore = [
68
- "E501", # Line too long
69
- ]
70
- line-length = 127
@@ -0,0 +1,17 @@
1
+ [tox]
2
+ env_list =
3
+ py{311,312,313,314}
4
+ isolated_build = True
5
+
6
+ [testenv]
7
+ description =
8
+ run tests
9
+ extras = tests
10
+ conda_deps =
11
+ hstcal
12
+ conda_channels =
13
+ conda-forge
14
+ commands_pre =
15
+ pip freeze
16
+ commands =
17
+ pytest -v {posargs}
@@ -29,11 +29,13 @@ import subprocess
29
29
 
30
30
  # STSCI
31
31
  from stsci.tools import parseinput
32
+
32
33
  from .util import error_code
33
34
 
34
35
 
35
- def calwf3(input=None, printtime=False, save_tmp=False,
36
- verbose=False, debug=False, parallel=True, version=False, log_func=print):
36
+ def calwf3(
37
+ input=None, printtime=False, save_tmp=False, verbose=False, debug=False, parallel=True, version=False, log_func=print
38
+ ):
37
39
  """
38
40
  Run the calwf3.e executable as from the shell.
39
41
 
@@ -137,33 +139,32 @@ def calwf3(input=None, printtime=False, save_tmp=False,
137
139
 
138
140
  """
139
141
 
140
- call_list = ['calwf3.e']
142
+ call_list = ["calwf3.e"]
141
143
  return_code = None
142
144
 
143
145
  if printtime:
144
- call_list.append('-t')
146
+ call_list.append("-t")
145
147
 
146
148
  if save_tmp:
147
- call_list.append('-s')
149
+ call_list.append("-s")
148
150
 
149
151
  if verbose:
150
- call_list.append('-v')
152
+ call_list.append("-v")
151
153
 
152
154
  if version:
153
- call_list.append('--version')
155
+ call_list.append("--version")
154
156
 
155
157
  if debug:
156
- call_list.append('-d')
158
+ call_list.append("-d")
157
159
 
158
160
  if not parallel:
159
- call_list.append('-1')
161
+ call_list.append("-1")
160
162
 
161
163
  infiles, dummy = parseinput.parseinput(input)
162
164
  if (len(parseinput.irafglob(input)) == 0) and not version:
163
165
  raise IOError("No valid image specified")
164
166
  if len(parseinput.irafglob(input)) > 1:
165
- raise IOError("calwf3 can only accept 1 file for"
166
- "input at a time: {0}".format(infiles))
167
+ raise IOError("calwf3 can only accept 1 file forinput at a time: {0}".format(infiles))
167
168
 
168
169
  for image in infiles:
169
170
  if not os.path.exists(image):
@@ -180,7 +181,7 @@ def calwf3(input=None, printtime=False, save_tmp=False,
180
181
 
181
182
  if log_func is not None:
182
183
  for line in proc.stdout:
183
- log_func(line.decode('utf8'))
184
+ log_func(line.decode("utf8"))
184
185
 
185
186
  return_code = proc.wait()
186
187
  ec = error_code(return_code)
@@ -1,13 +1,13 @@
1
- from .sub2full import sub2full
1
+ import numpy
2
2
 
3
3
  # STDLIB
4
4
  from astropy.io import fits
5
- import os
6
- import numpy
7
5
 
8
6
  # STSCI
9
7
  from stsci.tools import parseinput
10
8
 
9
+ from .sub2full import sub2full
10
+
11
11
  __taskname__ = "embedsub"
12
12
 
13
13
 
@@ -36,14 +36,13 @@ def embedsub(files):
36
36
 
37
37
  # process all the input subarrays
38
38
  for filename in infiles:
39
-
40
39
  # Make sure the input name conforms to normal style
41
- if '_flt' not in filename:
40
+ if "_flt" not in filename:
42
41
  print("Warning: Can't properly parse '%s'; Skipping" % files)
43
42
 
44
43
  # Extract the root name and build SPT and output file names
45
- root = filename[0:filename.find('_flt')]
46
- full = root[0:len(root)-1] + 'f_flt.fits'
44
+ root = filename[0 : filename.find("_flt")]
45
+ full = root[0 : len(root) - 1] + "f_flt.fits"
47
46
 
48
47
  try:
49
48
  # open input file read-only
@@ -51,14 +50,13 @@ def embedsub(files):
51
50
  except EnvironmentError:
52
51
  print("Problem opening fits file %s" % (filename))
53
52
 
54
- detector = flt[0].header['DETECTOR']
55
- if 'UVIS' in detector:
53
+ detector = flt[0].header["DETECTOR"]
54
+ if "UVIS" in detector:
56
55
  uvis = True
57
56
 
58
57
  # compute subarray corners assuming the raw image location
59
58
  x1, x2, y1, y2 = sub2full(filename, fullExtent=True)[0]
60
- print("Subarray image section [x1,x2,y1,y2] = [%d:%d,%d:%d]" % (x1, x2,
61
- y1, y2))
59
+ print("Subarray image section [x1,x2,y1,y2] = [%d:%d,%d:%d]" % (x1, x2, y1, y2))
62
60
 
63
61
  if uvis:
64
62
  xaxis = uvis_full_x
@@ -74,44 +72,44 @@ def embedsub(files):
74
72
  err = numpy.zeros([xaxis, yaxis], dtype=numpy.float32)
75
73
  dq = numpy.zeros([xaxis, yaxis], dtype=numpy.int16) + 4
76
74
 
77
- sci[y1-1:y2, x1-1:x2] = flt[1].data
78
- err[y1-1:y2, x1-1:x2] = flt[2].data
79
- dq[y1-1:y2, x1-1:x2] = flt[3].data
75
+ sci[y1 - 1 : y2, x1 - 1 : x2] = flt[1].data
76
+ err[y1 - 1 : y2, x1 - 1 : x2] = flt[2].data
77
+ dq[y1 - 1 : y2, x1 - 1 : x2] = flt[3].data
80
78
 
81
79
  if not uvis:
82
80
  samp = numpy.zeros([xaxis, yaxis], dtype=numpy.int16)
83
81
  time = numpy.zeros([xaxis, yaxis], dtype=numpy.float32)
84
- samp[y1-1:y2, x1-1:x2] = flt[4].data
85
- time[y1-1:y2, x1-1:x2] = flt[5].data
82
+ samp[y1 - 1 : y2, x1 - 1 : x2] = flt[4].data
83
+ time[y1 - 1 : y2, x1 - 1 : x2] = flt[5].data
86
84
 
87
85
  # Reset a few WCS values to make them appropriate for a
88
86
  # full-chip image
89
- crpix1 = flt[1].header['CRPIX1']
90
- crpix2 = flt[1].header['CRPIX2']
87
+ crpix1 = flt[1].header["CRPIX1"]
88
+ crpix2 = flt[1].header["CRPIX2"]
91
89
 
92
- flt[1].header['sizaxis1'] = yaxis
93
- flt[1].header['sizaxis2'] = xaxis
90
+ flt[1].header["sizaxis1"] = yaxis
91
+ flt[1].header["sizaxis2"] = xaxis
94
92
 
95
93
  for i in range(1, 4):
96
- if 'CRPIX1' in flt[i].header:
97
- flt[i].header['crpix1'] = crpix1 + x1 - 1
98
- flt[i].header['crpix2'] = crpix2 + y1 - 1
99
- if 'LTV1' in flt[i].header:
100
- flt[i].header['ltv1'] = 0.0
101
- flt[i].header['ltv2'] = 0.0
94
+ if "CRPIX1" in flt[i].header:
95
+ flt[i].header["crpix1"] = crpix1 + x1 - 1
96
+ flt[i].header["crpix2"] = crpix2 + y1 - 1
97
+ if "LTV1" in flt[i].header:
98
+ flt[i].header["ltv1"] = 0.0
99
+ flt[i].header["ltv2"] = 0.0
102
100
 
103
101
  # set the header value of SUBARRAY to False since it's now
104
102
  # regular size image
105
- flt[0].header['SUBARRAY'] = False
106
-
103
+ flt[0].header["SUBARRAY"] = False
104
+
107
105
  # Now write out the SCI, ERR, DQ extensions to the full-chip file
108
- flt[1].data = sci
106
+ flt[1].data = sci
109
107
  flt[2].data = err
110
108
  flt[3].data = dq
111
-
109
+
112
110
  if not uvis:
113
111
  flt[4].data = samp
114
- flt[5].data = time
112
+ flt[5].data = time
115
113
 
116
114
  flt.writeto(full, overwrite=False)
117
115
 
@@ -42,16 +42,14 @@ Usage:
42
42
  """
43
43
 
44
44
  # STDLIB
45
- import os
46
- from astropy.io import fits
47
45
  import numpy as np
46
+ from astropy.io import fits
48
47
  from matplotlib import pyplot as plt
49
48
 
50
49
  plt.ion()
51
50
 
52
51
 
53
- def pstack(filename, column=0, row=0, extname="sci", units="counts",
54
- title=None, xlabel=None, ylabel=None, plot=True):
52
+ def pstack(filename, column=0, row=0, extname="sci", units="counts", title=None, xlabel=None, ylabel=None, plot=True):
55
53
  """
56
54
  A function to plot the statistics of one pixels up the IR ramp image.
57
55
  Original implementation in the iraf nicmos package. Pixel values here are
@@ -139,28 +137,28 @@ def pstack(filename, column=0, row=0, extname="sci", units="counts",
139
137
 
140
138
  for i in range(1, nsamp, 1):
141
139
  if time:
142
- yaxis[i-1] = myfile["SCI", i].header['SAMPTIME']
140
+ yaxis[i - 1] = myfile["SCI", i].header["SAMPTIME"]
143
141
  else:
144
142
  # Numpy is row-major with array indices written row-first
145
143
  # (lexicographical access order)
146
- yaxis[i-1] = myfile[extname.upper(), i].data[row, column]
147
- xaxis[i-1] = myfile["SCI", i].header['SAMPTIME']
144
+ yaxis[i - 1] = myfile[extname.upper(), i].data[row, column]
145
+ xaxis[i - 1] = myfile["SCI", i].header["SAMPTIME"]
148
146
 
149
147
  # convert to countrate
150
148
  if "rate" in units.lower() and "/" not in bunit.lower():
151
- exptime = myfile["SCI", i].header['SAMPTIME']
152
- yaxis[i-1] /= exptime
149
+ exptime = myfile["SCI", i].header["SAMPTIME"]
150
+ yaxis[i - 1] /= exptime
153
151
  # convert to counts
154
152
  if "counts" in units.lower() and "/" in bunit.lower():
155
- exptime = myfile["SCI", i].header['SAMPTIME']
156
- yaxis[i-1] *= exptime
153
+ exptime = myfile["SCI", i].header["SAMPTIME"]
154
+ yaxis[i - 1] *= exptime
157
155
 
158
156
  if not ylabel:
159
157
  if "rate" in units.lower():
160
158
  if "/" in bunit.lower():
161
159
  ylabel = bunit
162
160
  else:
163
- ylabel = bunit+" per second"
161
+ ylabel = bunit + " per second"
164
162
  else:
165
163
  if "/" in bunit:
166
164
  stop_index = bunit.find("/")
@@ -177,8 +175,7 @@ def pstack(filename, column=0, row=0, extname="sci", units="counts",
177
175
  plt.xlabel("Sample time")
178
176
 
179
177
  if not title:
180
- title = "%s Pixel stack for col=%d, row=%d" % (filename, column,
181
- row)
178
+ title = "%s Pixel stack for col=%d, row=%d" % (filename, column, row)
182
179
  plt.title(title)
183
180
 
184
181
  if time: