acstools 3.7.0__tar.gz → 3.7.2__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 (96) hide show
  1. acstools-3.7.2/.github/dependabot.yml +28 -0
  2. acstools-3.7.2/.github/labeler.yml +61 -0
  3. {acstools-3.7.0 → acstools-3.7.2}/.github/workflows/ci_workflows.yml +2 -2
  4. {acstools-3.7.0 → acstools-3.7.2}/.github/workflows/codeql-analysis.yml +3 -3
  5. {acstools-3.7.0 → acstools-3.7.2}/.github/workflows/open_actions.yml +2 -3
  6. {acstools-3.7.0 → acstools-3.7.2}/.github/workflows/predeps_workflows.yml +5 -5
  7. {acstools-3.7.0 → acstools-3.7.2}/.github/workflows/publish-to-pypi.yml +1 -1
  8. {acstools-3.7.0 → acstools-3.7.2}/CITATION.md +3 -1
  9. {acstools-3.7.0 → acstools-3.7.2}/PKG-INFO +2 -2
  10. {acstools-3.7.0 → acstools-3.7.2}/acstools/findsat_mrt.py +9 -3
  11. {acstools-3.7.0 → acstools-3.7.2}/acstools/satdet.py +1 -1
  12. {acstools-3.7.0 → acstools-3.7.2}/acstools/tests/test_wfc_destripe.py +3 -1
  13. {acstools-3.7.0 → acstools-3.7.2}/acstools/tests/test_wfc_findsat_mrt.py +3 -0
  14. {acstools-3.7.0 → acstools-3.7.2}/acstools/tests/test_wfc_satdet.py +4 -0
  15. {acstools-3.7.0 → acstools-3.7.2}/acstools/utils_findsat_mrt.py +95 -11
  16. {acstools-3.7.0 → acstools-3.7.2}/acstools/version.py +2 -2
  17. {acstools-3.7.0 → acstools-3.7.2}/acstools.egg-info/PKG-INFO +2 -2
  18. {acstools-3.7.0 → acstools-3.7.2}/acstools.egg-info/requires.txt +1 -1
  19. {acstools-3.7.0 → acstools-3.7.2}/doc/source/index.rst +8 -1
  20. {acstools-3.7.0 → acstools-3.7.2}/setup.cfg +2 -1
  21. {acstools-3.7.0 → acstools-3.7.2}/tox.ini +3 -4
  22. acstools-3.7.0/.github/dependabot.yml +0 -8
  23. acstools-3.7.0/.github/labeler.yml +0 -43
  24. {acstools-3.7.0 → acstools-3.7.2}/.bandit.yaml +0 -0
  25. {acstools-3.7.0 → acstools-3.7.2}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  26. {acstools-3.7.0 → acstools-3.7.2}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  27. {acstools-3.7.0 → acstools-3.7.2}/.github/ISSUE_TEMPLATE/question.md +0 -0
  28. {acstools-3.7.0 → acstools-3.7.2}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  29. {acstools-3.7.0 → acstools-3.7.2}/.gitignore +0 -0
  30. {acstools-3.7.0 → acstools-3.7.2}/.readthedocs.yaml +0 -0
  31. {acstools-3.7.0 → acstools-3.7.2}/CHANGES.rst +0 -0
  32. {acstools-3.7.0 → acstools-3.7.2}/CODE_OF_CONDUCT.md +0 -0
  33. {acstools-3.7.0 → acstools-3.7.2}/LICENSE.md +0 -0
  34. {acstools-3.7.0 → acstools-3.7.2}/MANIFEST.in +0 -0
  35. {acstools-3.7.0 → acstools-3.7.2}/README.rst +0 -0
  36. {acstools-3.7.0 → acstools-3.7.2}/acstools/__init__.py +0 -0
  37. {acstools-3.7.0 → acstools-3.7.2}/acstools/acs2d.py +0 -0
  38. {acstools-3.7.0 → acstools-3.7.2}/acstools/acs_destripe.py +0 -0
  39. {acstools-3.7.0 → acstools-3.7.2}/acstools/acs_destripe_plus.py +0 -0
  40. {acstools-3.7.0 → acstools-3.7.2}/acstools/acsccd.py +0 -0
  41. {acstools-3.7.0 → acstools-3.7.2}/acstools/acscte.py +0 -0
  42. {acstools-3.7.0 → acstools-3.7.2}/acstools/acscteforwardmodel.py +0 -0
  43. {acstools-3.7.0 → acstools-3.7.2}/acstools/acsphotcte.py +0 -0
  44. {acstools-3.7.0 → acstools-3.7.2}/acstools/acsrej.py +0 -0
  45. {acstools-3.7.0 → acstools-3.7.2}/acstools/acssum.py +0 -0
  46. {acstools-3.7.0 → acstools-3.7.2}/acstools/acszpt.py +0 -0
  47. {acstools-3.7.0 → acstools-3.7.2}/acstools/calacs.py +0 -0
  48. {acstools-3.7.0 → acstools-3.7.2}/acstools/data/polarizer_tables.yaml +0 -0
  49. {acstools-3.7.0 → acstools-3.7.2}/acstools/data/rt_line_kernel_width15.fits +0 -0
  50. {acstools-3.7.0 → acstools-3.7.2}/acstools/data/rt_line_kernel_width3.fits +0 -0
  51. {acstools-3.7.0 → acstools-3.7.2}/acstools/data/rt_line_kernel_width7.fits +0 -0
  52. {acstools-3.7.0 → acstools-3.7.2}/acstools/focus_diverse_epsfs.py +0 -0
  53. {acstools-3.7.0 → acstools-3.7.2}/acstools/polarization_tools.py +0 -0
  54. {acstools-3.7.0 → acstools-3.7.2}/acstools/tests/.gitattributes +0 -0
  55. {acstools-3.7.0 → acstools-3.7.2}/acstools/tests/__init__.py +0 -0
  56. {acstools-3.7.0 → acstools-3.7.2}/acstools/tests/data/input/ja0x03ojq_flt.fits +0 -0
  57. {acstools-3.7.0 → acstools-3.7.2}/acstools/tests/data/input/jb5g05ubq_flt.fits +0 -0
  58. {acstools-3.7.0 → acstools-3.7.2}/acstools/tests/data/input/jc2z03cvq_blv_tmp.fits +0 -0
  59. {acstools-3.7.0 → acstools-3.7.2}/acstools/tests/data/input/jc5001soq_flt.fits +0 -0
  60. {acstools-3.7.0 → acstools-3.7.2}/acstools/tests/data/input/jc8m10syq_flc.fits +0 -0
  61. {acstools-3.7.0 → acstools-3.7.2}/acstools/tests/data/input/jc8m32j5q_flc.fits +0 -0
  62. {acstools-3.7.0 → acstools-3.7.2}/acstools/tests/data/input/jc8o04ghq_flt.fits +0 -0
  63. {acstools-3.7.0 → acstools-3.7.2}/acstools/tests/data/input/jc8o04ghq_mask1.fits +0 -0
  64. {acstools-3.7.0 → acstools-3.7.2}/acstools/tests/data/input/jc8o04ghq_mask2.fits +0 -0
  65. {acstools-3.7.0 → acstools-3.7.2}/acstools/tests/data/truth/ja0x03ojq_flt_ref.fits +0 -0
  66. {acstools-3.7.0 → acstools-3.7.2}/acstools/tests/data/truth/jb5g05ubq_flt_ref.fits +0 -0
  67. {acstools-3.7.0 → acstools-3.7.2}/acstools/tests/data/truth/jc2z03cvq_blv_tmp_ref.fits +0 -0
  68. {acstools-3.7.0 → acstools-3.7.2}/acstools/tests/data/truth/jc5001soq_flt_ref.fits +0 -0
  69. {acstools-3.7.0 → acstools-3.7.2}/acstools/tests/data/truth/jc8m10syq_flc_ref.fits +0 -0
  70. {acstools-3.7.0 → acstools-3.7.2}/acstools/tests/data/truth/jc8m32j5q_flc_mask_ref.fits +0 -0
  71. {acstools-3.7.0 → acstools-3.7.2}/acstools/tests/data/truth/jc8o04ghq_flt_ref.fits +0 -0
  72. {acstools-3.7.0 → acstools-3.7.2}/acstools/tests/helpers.py +0 -0
  73. {acstools-3.7.0 → acstools-3.7.2}/acstools/tests/test_polarization.py +0 -0
  74. {acstools-3.7.0 → acstools-3.7.2}/acstools/utils_calib.py +0 -0
  75. {acstools-3.7.0 → acstools-3.7.2}/acstools.egg-info/SOURCES.txt +0 -0
  76. {acstools-3.7.0 → acstools-3.7.2}/acstools.egg-info/dependency_links.txt +0 -0
  77. {acstools-3.7.0 → acstools-3.7.2}/acstools.egg-info/entry_points.txt +0 -0
  78. {acstools-3.7.0 → acstools-3.7.2}/acstools.egg-info/not-zip-safe +0 -0
  79. {acstools-3.7.0 → acstools-3.7.2}/acstools.egg-info/top_level.txt +0 -0
  80. {acstools-3.7.0 → acstools-3.7.2}/conftest.py +0 -0
  81. {acstools-3.7.0 → acstools-3.7.2}/doc/Makefile +0 -0
  82. {acstools-3.7.0 → acstools-3.7.2}/doc/make.bat +0 -0
  83. {acstools-3.7.0 → acstools-3.7.2}/doc/source/_static/stsci_pri_combo_mark_white.png +0 -0
  84. {acstools-3.7.0 → acstools-3.7.2}/doc/source/_templates/.gitignore +0 -0
  85. {acstools-3.7.0 → acstools-3.7.2}/doc/source/acs_destripe.rst +0 -0
  86. {acstools-3.7.0 → acstools-3.7.2}/doc/source/acsphotcte.rst +0 -0
  87. {acstools-3.7.0 → acstools-3.7.2}/doc/source/acszpt.rst +0 -0
  88. {acstools-3.7.0 → acstools-3.7.2}/doc/source/calacs.rst +0 -0
  89. {acstools-3.7.0 → acstools-3.7.2}/doc/source/conf.py +0 -0
  90. {acstools-3.7.0 → acstools-3.7.2}/doc/source/findsat_mrt.rst +0 -0
  91. {acstools-3.7.0 → acstools-3.7.2}/doc/source/focus_diverse_epsfs.rst +0 -0
  92. {acstools-3.7.0 → acstools-3.7.2}/doc/source/polarization_tools.rst +0 -0
  93. {acstools-3.7.0 → acstools-3.7.2}/doc/source/satdet.rst +0 -0
  94. {acstools-3.7.0 → acstools-3.7.2}/doc/source/utils_calib.rst +0 -0
  95. {acstools-3.7.0 → acstools-3.7.2}/pyproject.toml +0 -0
  96. {acstools-3.7.0 → acstools-3.7.2}/setup.py +0 -0
@@ -0,0 +1,28 @@
1
+ version: 2
2
+ updates:
3
+
4
+ # Maintain dependencies for GitHub Actions
5
+ - package-ecosystem: "github-actions"
6
+ directory: ".github/workflows"
7
+ target-branch: "master"
8
+ schedule:
9
+ interval: monthly
10
+ time: "03:10"
11
+ groups:
12
+ actions:
13
+ patterns:
14
+ - "*"
15
+ open-pull-requests-limit: 10
16
+
17
+ # Maintain dependencies for pip
18
+ - package-ecosystem: "pip"
19
+ directory: "/"
20
+ target-branch: "master"
21
+ schedule:
22
+ interval: monthly
23
+ time: "03:00"
24
+ groups:
25
+ actions:
26
+ patterns:
27
+ - "*"
28
+ open-pull-requests-limit: 10
@@ -0,0 +1,61 @@
1
+ docs:
2
+ - changed-files:
3
+ - any-glob-to-any-file:
4
+ - .github/**/*.md
5
+ - .readthedocs.yaml
6
+ - doc/**/*
7
+ - '*.md'
8
+ - all-globs-to-any-file:
9
+ - '*.rst'
10
+ - '!CHANGES.rst'
11
+
12
+ testing:
13
+ - changed-files:
14
+ - any-glob-to-any-file:
15
+ - .bandit.yaml
16
+ - .github/**/*.yml
17
+ - conftest.py
18
+ - acstools/tests/**/*
19
+
20
+ CALACS:
21
+ - changed-files:
22
+ - any-glob-to-any-file:
23
+ - acstools/acs2d.py
24
+ - acstools/acsccd.py
25
+ - acstools/acscteforwardmodel.py
26
+ - acstools/acscte.py
27
+ - acstools/acsrej.py
28
+ - acstools/acssum.py
29
+ - acstools/calacs.py
30
+ - acstools/utils_calib.py
31
+
32
+ CTE:
33
+ - changed-files:
34
+ - any-glob-to-any-file:
35
+ - acstools/acscteforwardmodel.py
36
+ - acstools/acscte.py
37
+ - acstools/acsphotcte.py
38
+
39
+ Destripe:
40
+ - changed-files:
41
+ - any-glob-to-any-file:
42
+ - acstools/acs_destripe_plus.py
43
+ - acstools/acs_destripe.py
44
+
45
+ Polarization:
46
+ - changed-files:
47
+ - any-glob-to-any-file:
48
+ - acstools/polarization_tools.py
49
+ - acstools/data/polarizer_tables.yaml
50
+
51
+ Satellite Detection:
52
+ - changed-files:
53
+ - any-glob-to-any-file:
54
+ - acstools/satdet.py
55
+ - acstools/findsat_mrt.py
56
+ - acstools/utils_findsat_mrt.py
57
+
58
+ Zeropoints:
59
+ - changed-files:
60
+ - any-glob-to-any-file:
61
+ - acstools/acszpt.py
@@ -21,7 +21,7 @@ jobs:
21
21
  runs-on: ubuntu-latest
22
22
  steps:
23
23
  - name: Check base branch
24
- uses: actions/github-script@v6
24
+ uses: actions/github-script@v7
25
25
  if: github.event_name == 'pull_request'
26
26
  with:
27
27
  script: |
@@ -59,6 +59,6 @@ jobs:
59
59
  linux: py39-test-alldeps
60
60
  posargs: --remote-data -v
61
61
 
62
- - name: Python 3.12 with remote data
62
+ - name: Python 3.12 with remote data and dev dependencies
63
63
  linux: py312-test-devdeps
64
64
  posargs: --remote-data -v
@@ -41,7 +41,7 @@ jobs:
41
41
 
42
42
  # Initializes the CodeQL tools for scanning.
43
43
  - name: Initialize CodeQL
44
- uses: github/codeql-action/init@v2
44
+ uses: github/codeql-action/init@v3
45
45
  with:
46
46
  languages: ${{ matrix.language }}
47
47
  # If you wish to specify custom queries, you can do so here or in a config file.
@@ -52,7 +52,7 @@ jobs:
52
52
  # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
53
53
  # If this step fails, then you should remove it and run the build manually (see below)
54
54
  - name: Autobuild
55
- uses: github/codeql-action/autobuild@v2
55
+ uses: github/codeql-action/autobuild@v3
56
56
 
57
57
  # ℹ️ Command-line programs to run using the OS shell.
58
58
  # 📚 https://git.io/JvXDl
@@ -66,4 +66,4 @@ jobs:
66
66
  # make release
67
67
 
68
68
  - name: Perform CodeQL Analysis
69
- uses: github/codeql-action/analyze@v2
69
+ uses: github/codeql-action/analyze@v3
@@ -17,13 +17,12 @@ jobs:
17
17
  runs-on: ubuntu-latest
18
18
  steps:
19
19
  - name: Label PR
20
- uses: actions/labeler@v4
20
+ uses: actions/labeler@v5
21
21
  if: github.event_name == 'pull_request_target' || github.event_name == 'pull_request'
22
22
  with:
23
23
  repo-token: "${{ secrets.GITHUB_TOKEN }}"
24
- sync-labels: ''
25
24
  - name: 'Comment Draft PR'
26
- uses: actions/github-script@v6
25
+ uses: actions/github-script@v7
27
26
  if: github.event.pull_request.draft == true
28
27
  with:
29
28
  github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -18,8 +18,8 @@ jobs:
18
18
  jref: "https://ssb.stsci.edu/trds_open/jref"
19
19
  submodules: false
20
20
  coverage: ''
21
- # TODO: Enable more OSes when possible.
22
- envs: |
23
- - name: Python 3.11 with pre-release
24
- linux: py311-test-predeps
25
- posargs: --remote-data -v
21
+ # TODO: Enable more OSes when possible.
22
+ envs: |
23
+ - name: Python 3.11 with pre-release
24
+ linux: py311-test-predeps
25
+ posargs: --remote-data -v
@@ -36,7 +36,7 @@ jobs:
36
36
  with:
37
37
  fetch-depth: 0
38
38
 
39
- - uses: actions/setup-python@v4
39
+ - uses: actions/setup-python@v5
40
40
  with:
41
41
  python-version: '3.11'
42
42
 
@@ -1,7 +1,9 @@
1
1
  If you use acstools, please cite as:
2
2
 
3
- [![ascl:2011.024](https://img.shields.io/badge/ascl-2011.024-blue.svg?colorB=262255)](https://ascl.net/2011.024)
3
+ [![NASA/ADS-ACStools](https://img.shields.io/badge/NASA%2FADS-ACStools-blue)](https://ui.adsabs.harvard.edu/abs/2020ascl.soft11024L/abstract)
4
4
 
5
5
  #### Other forms of citation
6
6
 
7
+ [![ascl:2011.024](https://img.shields.io/badge/ascl-2011.024-blue.svg?colorB=262255)](https://ascl.net/2011.024)
8
+
7
9
  [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7406933.svg)](https://doi.org/10.5281/zenodo.7406933)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: acstools
3
- Version: 3.7.0
3
+ Version: 3.7.2
4
4
  Summary: Python Tools for HST ACS
5
5
  Home-page: https://github.com/spacetelescope/acstools
6
6
  Author: Matt Davis, Warren Hack, Norman Grogin, Pey Lian Lim, Sara Ogaz, Leonardo Ubeda, Mihai Cara, David Borncamp, Nathan Miles, Tyler Desjardins, Jenna Ryon, David Stark, Gagandeep Anand, Yotam Cohen
@@ -39,7 +39,7 @@ Requires-Dist: pytest-astropy-header; extra == "test"
39
39
  Requires-Dist: pytest-remotedata; extra == "test"
40
40
  Requires-Dist: ci-watson; extra == "test"
41
41
  Provides-Extra: docs
42
- Requires-Dist: sphinx<7; extra == "docs"
42
+ Requires-Dist: sphinx; extra == "docs"
43
43
  Requires-Dist: sphinx-automodapi; extra == "docs"
44
44
  Requires-Dist: sphinx-rtd-theme; extra == "docs"
45
45
 
@@ -1290,8 +1290,8 @@ class WfcWrapper(TrailFinder):
1290
1290
 
1291
1291
  @binsize.setter
1292
1292
  def binsize(self, value):
1293
- if value is not None and not isinstance(value, int):
1294
- raise ValueError(f"binsize must be None or int but got: {value}")
1293
+ if value is not None and not (isinstance(value, int) and value >= 1):
1294
+ raise ValueError(f"binsize must be None or int >= 1 but got: {value}") # noqa
1295
1295
  self._binsize = value
1296
1296
 
1297
1297
  @property
@@ -1360,6 +1360,12 @@ class WfcWrapper(TrailFinder):
1360
1360
 
1361
1361
  LOG.info('Rebinning the data by {}'.format(self.binsize))
1362
1362
 
1363
+ # trigger a warning if the image dimensions are not even
1364
+ if (((self.image.shape[0] % self.binsize != 0)) |
1365
+ ((self.image.shape[1] % self.binsize != 0))):
1366
+ LOG.warning('Image dimensions do not evenly divide by bin size.'
1367
+ '\nExtra rows/columns will be trimmed first.')
1368
+
1363
1369
  # setting a warning filter for the nansum calculations. These
1364
1370
  # warnings are inconsequential and already accounted for in the code
1365
1371
  with warnings.catch_warnings():
@@ -1406,4 +1412,4 @@ class WfcWrapper(TrailFinder):
1406
1412
  raise ValueError(f'DQ array can only be updated for FLC/FLT images, not {self.image_type}') # noqa
1407
1413
 
1408
1414
  update_dq(self.image_file, self.extension + 2, self.mask, dqval=dqval,
1409
- verbose=verbose)
1415
+ verbose=verbose, expand_mask=True)
@@ -285,7 +285,7 @@ def _detsat_one(filename, ext, sigma=2.0, low_thresh=0.1, h_thresh=0.5,
285
285
  trail_angle = trail_angle[mask]
286
286
  result = result[mask]
287
287
 
288
- ang, num = stats.mode(round_angle)
288
+ ang, num = stats.mode(round_angle, keepdims=True)
289
289
 
290
290
  # do the filtering
291
291
  truth = round_angle == ang[0]
@@ -26,7 +26,9 @@ class TestDestripe(BaseACSTOOLS):
26
26
  mask1=masks[0], mask2=masks[1])
27
27
 
28
28
  # Compare results
29
- self.compare_outputs([(outputfile, truthfile)], rtol=1e-6)
29
+ # NOTE: atol instead of rtol was set due to numpy 2.0,
30
+ # see https://github.com/spacetelescope/acstools/issues/184
31
+ self.compare_outputs([(outputfile, truthfile)], atol=0.01)
30
32
 
31
33
  # jb5g05ubq = calibrated post-SM4 WFC full-frame exposures without masks
32
34
  # ja0x03ojq = calibrated polarizer WFC subarray exposures
@@ -1,11 +1,14 @@
1
1
  '''Test satellite trail detection and masking using findsat_mrt.'''
2
2
  import os
3
3
 
4
+ import pytest
4
5
  from astropy.io.fits import FITSDiff
5
6
  from astropy.utils.data import get_pkg_data_filename
6
7
 
7
8
  from acstools.findsat_mrt import WfcWrapper
8
9
 
10
+ pytest.importorskip("skimage")
11
+
9
12
 
10
13
  def test_WfcWrapper(tmp_path):
11
14
  """Identify and mask trails in WFC extension 4."""
@@ -3,10 +3,14 @@
3
3
  .. note:: Cannot test ``detsat()`` because PHT results change from run to run!
4
4
 
5
5
  """
6
+ import pytest
7
+
6
8
  from acstools import satdet
7
9
  from acstools.utils_findsat_mrt import update_dq
8
10
  from acstools.tests.helpers import BaseACSTOOLS
9
11
 
12
+ pytest.importorskip("skimage")
13
+
10
14
 
11
15
  class TestSatDet(BaseACSTOOLS):
12
16
  detector = 'wfc'
@@ -10,7 +10,7 @@ import numpy as np
10
10
  from astropy.convolution import convolve, Gaussian2DKernel
11
11
  from astropy.io import fits
12
12
  from astropy.modeling import models, fitting
13
- from astropy.nddata import Cutout2D
13
+ from astropy.nddata import Cutout2D, block_replicate
14
14
  from astropy.stats import sigma_clip
15
15
  from astropy.table import Table, vstack
16
16
  from astropy.utils.exceptions import AstropyUserWarning
@@ -20,8 +20,8 @@ try:
20
20
  from skimage import transform
21
21
  from skimage.transform._warps import warp
22
22
  from skimage._shared.utils import convert_to_float
23
- except ImportError:
24
- warnings.warn('skimage not installed. MRT calculation will not work.')
23
+ except ImportError as e:
24
+ warnings.warn(f'skimage not installed. MRT calculation will not work: {repr(e)}') # noqa
25
25
 
26
26
  # check for scipy
27
27
  try:
@@ -108,8 +108,8 @@ def merge_tables(tbls, theta_sep=10, rho_sep=10):
108
108
  drho = np.abs(t['ycentroid'] - s['ycentroid'])
109
109
  sel = (dtheta < theta_sep) & (drho < rho_sep)
110
110
  keep[sel] = False
111
- # Silence MergeConflictWarning for "date" metadata because
112
- # the tables were created with different timestamps. The last entry is kept.
111
+ # Silence MergeConflictWarning for "date" metadata because the tables
112
+ # were created with different timestamps. The last entry is kept.
113
113
  src = vstack([src, t[keep]], metadata_conflicts="silent")
114
114
  return src
115
115
 
@@ -1179,7 +1179,8 @@ def radon(image, theta=None, circle=False, *, preserve_range=False,
1179
1179
  return radon_image
1180
1180
 
1181
1181
 
1182
- def update_dq(filename, ext, mask, dqval=16384, verbose=True):
1182
+ def update_dq(filename, ext, mask, dqval=16384, verbose=True,
1183
+ expand_mask=False):
1183
1184
  """Update the given image and DQ extension with the given
1184
1185
  satellite trails mask and flag.
1185
1186
 
@@ -1199,10 +1200,85 @@ def update_dq(filename, ext, mask, dqval=16384, verbose=True):
1199
1200
  tailored for ACS/WFC.
1200
1201
  verbose : bool, optional
1201
1202
  Print extra information to the terminal.
1203
+ expand_mask : bool, optional
1204
+ Allows the mask to be expanded to match the size of the original mask.
1205
+ This is relevant for masks that were generated used binned versions of
1206
+ the original image.
1202
1207
 
1203
1208
  """
1204
1209
  with fits.open(filename, mode='update') as pf:
1205
1210
  dqarr = pf[ext].data
1211
+
1212
+ # check that the old mask and new mask are the same size
1213
+ same_size = mask.shape == dqarr.shape
1214
+ mask_larger = np.any([mask.shape[i] > dqarr.shape[i]
1215
+ for i in range(mask.ndim)])
1216
+
1217
+ # provide informative error messages depending on mask/dqarr size
1218
+ if not same_size:
1219
+ LOG.info('Inconsistent mask sizes: \n'
1220
+ 'Input mask: {} \n'
1221
+ 'DQ array: {}'.format(mask.shape, dqarr.shape))
1222
+
1223
+ if mask_larger:
1224
+ LOG.error('Mask is larger than the DQ array in one or more '
1225
+ 'dimensions.\nThis routine cannot currently rescale '
1226
+ 'masks that are larger than the origin input image')
1227
+ return
1228
+
1229
+ elif not mask_larger and not expand_mask:
1230
+ LOG.error('Cannot proceed due to size mismatch.\n'
1231
+ 'Set expand_mask=True if the mask was generated '
1232
+ 'with binned data and needs to be enlarged to the '
1233
+ 'original size.')
1234
+ return
1235
+ else:
1236
+ LOG.info('Enlarging mask to original size.')
1237
+
1238
+ # Determine factor by which to scale-up image. Scales should
1239
+ # be the same for the x and y dimensions, after we round down
1240
+ # to the nearest integer in case there are extra rows/columns
1241
+ # that do not divide evenly. These extra rows/columns will be
1242
+ # added back at the end. This approach is the reverse of
1243
+ # astropy.nddata.block_reduce, which trims extra rows/cols
1244
+ # first.
1245
+
1246
+ factor_x = np.floor(dqarr.shape[1]/mask.shape[1]).astype(int)
1247
+ factor_y = np.floor(dqarr.shape[0]/mask.shape[0]).astype(int)
1248
+ if factor_x != factor_y:
1249
+
1250
+ mask_aspect = mask.shape[1]/mask.shape[0]
1251
+ dq_aspect = dqarr.shape[1]/dqarr.shape[0]
1252
+
1253
+ raise ValueError('Mask and DQ array axis aspect ratios are'
1254
+ ' too different\n'
1255
+ 'Mask dimensions (x,y) = {}\n'
1256
+ 'Mask aspect ratio (x/y) = {}\n'
1257
+ 'DQ array dimensions (y,x) = {}\n'
1258
+ 'DQ array aspect ratio (x/y) = {}'
1259
+ .format(mask.shape, mask_aspect,
1260
+ dqarr.shape, dq_aspect))
1261
+
1262
+ else:
1263
+ factor = factor_x
1264
+
1265
+ # assess whether there will be extra rows/columns after scaling
1266
+ extra_cols = dqarr.shape[1] - mask.shape[1]*factor
1267
+ extra_rows = dqarr.shape[0] - mask.shape[0]*factor
1268
+
1269
+ mask = block_replicate(mask, factor,
1270
+ conserve_sum=False)
1271
+
1272
+ if extra_rows > 0:
1273
+ LOG.info('Duplicating end rows to match orig size')
1274
+ while mask.shape[0] != dqarr.shape[0]:
1275
+ mask = np.vstack([mask, mask[-1, :]])
1276
+
1277
+ if extra_cols > 0:
1278
+ LOG.info('Duplicating end columns to match orig size')
1279
+ while mask.shape[1] != dqarr.shape[1]:
1280
+ mask = np.hstack([mask, mask[:, -1].reshape(mask.shape[0], 1)]) # noqa
1281
+
1206
1282
  old_mask = (dqval & dqarr) != 0 # Existing flagged trails
1207
1283
  new_mask = mask & ~old_mask # Only flag previously unflagged trails
1208
1284
  npix_updated = np.count_nonzero(new_mask)
@@ -1356,16 +1432,24 @@ def create_mrt_line_kernel(width, sigma, outfile=None, shape=(1024, 2048),
1356
1432
  LOG.info('Inteprolating onto new grid to center kernel')
1357
1433
  theta_arr = np.arange(cutout.shape[1])
1358
1434
  rho_arr = np.arange(cutout.shape[0])
1359
- theta_grid, rho_grid = np.meshgrid(theta_arr, rho_arr)
1360
1435
 
1361
1436
  new_theta_arr = theta_arr + theta_shift
1362
1437
  new_rho_arr = rho_arr + rho_shift
1363
1438
  new_theta_grid, new_rho_grid = np.meshgrid(new_theta_arr, new_rho_arr)
1364
1439
 
1365
- # inteprolate onto new grid
1366
- f = interpolate.interp2d(theta_grid, rho_grid, cutout.data,
1367
- kind='cubic')
1368
- cutout = f(new_theta_arr, new_rho_arr) # overwrite old cutout
1440
+ f = interpolate.RegularGridInterpolator((rho_arr, theta_arr),
1441
+ cutout.data,
1442
+ bounds_error=False,
1443
+ fill_value=0,
1444
+ method='cubic')
1445
+
1446
+ # unable to provide 2D grid of points for interpolation. Switching to
1447
+ # 1D, and then will switch back
1448
+ points = [[r, t] for r, t in zip(np.ravel(new_rho_grid),
1449
+ np.ravel(new_theta_grid))]
1450
+
1451
+ # return to original shape and replace the old cutout
1452
+ cutout = np.reshape(f(points), cutout.data.shape)
1369
1453
 
1370
1454
  if ax:
1371
1455
  fig4, ax4 = plt.subplots()
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '3.7.0'
16
- __version_tuple__ = version_tuple = (3, 7, 0)
15
+ __version__ = version = '3.7.2'
16
+ __version_tuple__ = version_tuple = (3, 7, 2)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: acstools
3
- Version: 3.7.0
3
+ Version: 3.7.2
4
4
  Summary: Python Tools for HST ACS
5
5
  Home-page: https://github.com/spacetelescope/acstools
6
6
  Author: Matt Davis, Warren Hack, Norman Grogin, Pey Lian Lim, Sara Ogaz, Leonardo Ubeda, Mihai Cara, David Borncamp, Nathan Miles, Tyler Desjardins, Jenna Ryon, David Stark, Gagandeep Anand, Yotam Cohen
@@ -39,7 +39,7 @@ Requires-Dist: pytest-astropy-header; extra == "test"
39
39
  Requires-Dist: pytest-remotedata; extra == "test"
40
40
  Requires-Dist: ci-watson; extra == "test"
41
41
  Provides-Extra: docs
42
- Requires-Dist: sphinx<7; extra == "docs"
42
+ Requires-Dist: sphinx; extra == "docs"
43
43
  Requires-Dist: sphinx-automodapi; extra == "docs"
44
44
  Requires-Dist: sphinx-rtd-theme; extra == "docs"
45
45
 
@@ -13,7 +13,7 @@ photutils
13
13
  dask
14
14
 
15
15
  [docs]
16
- sphinx<7
16
+ sphinx
17
17
  sphinx-automodapi
18
18
  sphinx-rtd-theme
19
19
 
@@ -5,7 +5,7 @@ ACSTOOLS
5
5
  ########
6
6
 
7
7
  Software tools for
8
- `Advanced Camera for Surveys (ACS) <http://www.stsci.edu/hst/acs/>`_.
8
+ `Advanced Camera for Surveys (ACS) <https://www.stsci.edu/hst/acs/>`_.
9
9
 
10
10
  Different ways to install the latest release of this package::
11
11
 
@@ -52,3 +52,10 @@ Indices and tables
52
52
  * :ref:`genindex`
53
53
  * :ref:`modindex`
54
54
  * :ref:`search`
55
+
56
+ ******************
57
+ Citation
58
+ ******************
59
+
60
+ * Please cite `acstools <https://ui.adsabs.harvard.edu/abs/2020ascl.soft11024L/abstract>`_ if you have used it in your work.
61
+
@@ -52,7 +52,7 @@ test =
52
52
  pytest-remotedata
53
53
  ci-watson
54
54
  docs =
55
- sphinx<7
55
+ sphinx
56
56
  sphinx-automodapi
57
57
  sphinx-rtd-theme
58
58
 
@@ -83,6 +83,7 @@ filterwarnings =
83
83
  ignore:pkg_resources is deprecated as an API:DeprecationWarning
84
84
  ignore:.*utcfromtimestamp:DeprecationWarning
85
85
  ignore:.*numpy\.core.*:DeprecationWarning
86
+ ignore:skimage not installed
86
87
 
87
88
  [flake8]
88
89
  ignore = E221,E226,E262,E265,E501,E704,W504
@@ -11,7 +11,7 @@ envlist =
11
11
  passenv = HOME,CI,jref
12
12
 
13
13
  setenv =
14
- devdeps: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/astropy/simple https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
14
+ devdeps: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/astropy/simple https://pypi.anaconda.org/liberfa/simple https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
15
15
 
16
16
  # Run the tests in a temporary directory to make sure that we don't import
17
17
  # package from the source tree
@@ -38,8 +38,9 @@ deps =
38
38
  devdeps: scipy>=0.0.dev0
39
39
  devdeps: matplotlib>=0.0.dev0
40
40
  devdeps: scikit-image>=0.0.dev0
41
+ devdeps: pyerfa>=0.0.dev0
41
42
  devdeps: astropy>=0.0.dev0
42
- devdeps: git+https://github.com/astropy/photutils.git
43
+ devdeps: photutils>=0.0.dev0
43
44
  devdeps: git+https://github.com/spacetelescope/ci_watson.git
44
45
  devdeps: stsci.tools
45
46
 
@@ -49,8 +50,6 @@ extras =
49
50
  predeps: all
50
51
 
51
52
  commands =
52
- # Force numpy-dev after matplotlib downgrades it (https://github.com/matplotlib/matplotlib/issues/26847)
53
- devdeps: python -m pip install --pre --upgrade --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy
54
53
  pip freeze
55
54
  pytest --pyargs acstools {toxinidir}/doc {posargs}
56
55
 
@@ -1,8 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: pip
4
- directory: "/"
5
- schedule:
6
- interval: monthly
7
- time: "03:00"
8
- open-pull-requests-limit: 10
@@ -1,43 +0,0 @@
1
- docs:
2
- - .github/**/*.md
3
- - .readthedocs.yaml
4
- - doc/**/*
5
- - '*.md'
6
- - any: ['*.rst', '!CHANGES.rst']
7
-
8
- testing:
9
- - .bandit.yaml
10
- - .github/**/*.yml
11
- - conftest.py
12
- - acstools/tests/**/*
13
- - Jenkinsfile
14
- - JenkinsfileRT
15
-
16
- CALACS:
17
- - acstools/acs2d.py
18
- - acstools/acsccd.py
19
- - acstools/acscteforwardmodel.py
20
- - acstools/acscte.py
21
- - acstools/acsrej.py
22
- - acstools/acssum.py
23
- - acstools/calacs.py
24
- - acstools/utils_calib.py
25
-
26
- CTE:
27
- - acstools/acscteforwardmodel.py
28
- - acstools/acscte.py
29
- - acstools/acsphotcte.py
30
-
31
- Destripe:
32
- - acstools/acs_destripe_plus.py
33
- - acstools/acs_destripe.py
34
-
35
- Polarization:
36
- - acstools/polarization_tools.py
37
- - acstools/data/polarizer_tables.yaml
38
-
39
- Satellite Detection:
40
- - acstools/satdet.py
41
-
42
- Zeropoints:
43
- - acstools/acszpt.py
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes