quicklook-package 1.3.2__tar.gz → 1.6__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 (122) hide show
  1. quicklook_package-1.6/.github/workflows/build-and-test.yml +66 -0
  2. {quicklook_package-1.3.2 → quicklook_package-1.6}/.github/workflows/release.yml +12 -7
  3. {quicklook_package-1.3.2 → quicklook_package-1.6}/.gitignore +10 -1
  4. quicklook_package-1.6/.pre-commit-config.yaml +13 -0
  5. quicklook_package-1.6/.readthedocs.yaml +16 -0
  6. quicklook_package-1.6/CLAUDE.md +55 -0
  7. {quicklook_package-1.3.2 → quicklook_package-1.6}/LICENSE +0 -0
  8. quicklook_package-1.6/LIGHTKURVE_TGLC_BUG_REPORT.txt +202 -0
  9. quicklook_package-1.6/MANIFEST.in +1 -0
  10. quicklook_package-1.6/PKG-INFO +300 -0
  11. quicklook_package-1.6/README.md +254 -0
  12. quicklook_package-1.6/README_DEV.md +69 -0
  13. quicklook_package-1.6/TODO.md +43 -0
  14. quicklook_package-1.6/check_pyproject_deps.py +88 -0
  15. quicklook_package-1.6/docs/api.md +152 -0
  16. quicklook_package-1.6/docs/batch.md +104 -0
  17. quicklook_package-1.6/docs/cli.md +160 -0
  18. quicklook_package-1.6/docs/faq.md +92 -0
  19. quicklook_package-1.6/docs/getting-started.md +87 -0
  20. quicklook_package-1.6/docs/gui.md +73 -0
  21. quicklook_package-1.6/docs/img/ql-gui-gallery.png +0 -0
  22. quicklook_package-1.6/docs/img/ql-gui-joblog.png +0 -0
  23. quicklook_package-1.6/docs/img/ql-gui.png +0 -0
  24. quicklook_package-1.6/docs/index.md +39 -0
  25. quicklook_package-1.6/docs/installation.md +74 -0
  26. quicklook_package-1.6/docs/pipeline.md +133 -0
  27. quicklook_package-1.6/docs/requirements.txt +3 -0
  28. quicklook_package-1.6/mkdocs.yml +52 -0
  29. quicklook_package-1.6/notebook/examples.ipynb +1321 -0
  30. quicklook_package-1.6/notebook/experiment_tglc.ipynb +698 -0
  31. quicklook_package-1.6/notebook/window_length.ipynb +499 -0
  32. quicklook_package-1.6/pyproject.toml +111 -0
  33. {quicklook_package-1.3.2 → quicklook_package-1.6}/pytest.ini +0 -0
  34. quicklook_package-1.6/ql.batch +7 -0
  35. quicklook_package-1.6/quicklook/__init__.py +47 -0
  36. quicklook_package-1.6/quicklook/app/__init__.py +0 -0
  37. quicklook_package-1.6/quicklook/app/app.py +1507 -0
  38. quicklook_package-1.6/quicklook/app/jobs_db.py +114 -0
  39. quicklook_package-1.6/quicklook/app/static/css/quicklook.css +186 -0
  40. quicklook_package-1.6/quicklook/app/static/js/quicklook.js +58 -0
  41. quicklook_package-1.6/quicklook/app/templates/base.html +26 -0
  42. quicklook_package-1.6/quicklook/app/templates/compare.html +268 -0
  43. quicklook_package-1.6/quicklook/app/templates/gallery.html +553 -0
  44. quicklook_package-1.6/quicklook/app/templates/index.html +1936 -0
  45. quicklook_package-1.6/quicklook/app/templates/partials/_components.html +15 -0
  46. quicklook_package-1.6/quicklook/app/templates/partials/topbar.html +14 -0
  47. quicklook_package-1.6/quicklook/app/templates/tls_summary.html +900 -0
  48. quicklook_package-1.6/quicklook/cli/__init__.py +0 -0
  49. quicklook_package-1.6/quicklook/cli/app.py +746 -0
  50. quicklook_package-1.6/quicklook/cli/ql.py +38 -0
  51. quicklook_package-1.6/quicklook/cli/rank_tls.py +16 -0
  52. quicklook_package-1.6/quicklook/cli/read_tls.py +16 -0
  53. quicklook_package-1.6/quicklook/data/TOIs.csv +7242 -0
  54. {quicklook_package-1.3.2 → quicklook_package-1.6/quicklook}/data/simbad_obj_types.csv +0 -0
  55. quicklook_package-1.6/quicklook/exceptions.py +17 -0
  56. {quicklook_package-1.3.2 → quicklook_package-1.6}/quicklook/gls.py +77 -123
  57. quicklook_package-1.6/quicklook/h5io.py +121 -0
  58. quicklook_package-1.6/quicklook/inject.py +199 -0
  59. {quicklook_package-1.3.2 → quicklook_package-1.6}/quicklook/measure.py +109 -104
  60. quicklook_package-1.6/quicklook/notch_locor.py +488 -0
  61. quicklook_package-1.6/quicklook/pipelines.py +56 -0
  62. quicklook_package-1.6/quicklook/plot.py +1312 -0
  63. quicklook_package-1.6/quicklook/science.mplstyle +52 -0
  64. quicklook_package-1.6/quicklook/tglc.py +2451 -0
  65. quicklook_package-1.6/quicklook/tql.py +2510 -0
  66. {quicklook_package-1.3.2 → quicklook_package-1.6}/quicklook/utils.py +207 -67
  67. quicklook_package-1.6/quicklook_package.egg-info/PKG-INFO +300 -0
  68. quicklook_package-1.6/quicklook_package.egg-info/SOURCES.txt +98 -0
  69. quicklook_package-1.6/quicklook_package.egg-info/entry_points.txt +6 -0
  70. quicklook_package-1.6/quicklook_package.egg-info/requires.txt +37 -0
  71. quicklook_package-1.6/quicklook_package.egg-info/scm_file_list.json +94 -0
  72. quicklook_package-1.6/quicklook_package.egg-info/scm_version.json +8 -0
  73. quicklook_package-1.6/scripts/screenshot_gui.py +198 -0
  74. quicklook_package-1.6/tests/WASP-21_s83_pdcsap_sc.png +0 -0
  75. {quicklook_package-1.3.2 → quicklook_package-1.6}/tests/conftest.py +0 -0
  76. quicklook_package-1.6/tests/test_cancel_flow.py +123 -0
  77. quicklook_package-1.6/tests/test_cli.py +167 -0
  78. quicklook_package-1.6/tests/test_gpu_tls.py +153 -0
  79. quicklook_package-1.6/tests/test_h5io.py +112 -0
  80. {quicklook_package-1.3.2 → quicklook_package-1.6}/tests/test_import.py +10 -0
  81. quicklook_package-1.6/tests/test_iterative_search.py +344 -0
  82. quicklook_package-1.6/tests/test_jobs_db.py +118 -0
  83. quicklook_package-1.6/tests/test_notch_locor.py +146 -0
  84. {quicklook_package-1.3.2 → quicklook_package-1.6}/tests/test_notebooks.py +8 -10
  85. quicklook_package-1.6/tests/test_phase_xlim.py +60 -0
  86. quicklook_package-1.6/tests/test_rank_filters.py +106 -0
  87. quicklook_package-1.6/tests/test_sanitize_target_name.py +81 -0
  88. quicklook_package-1.6/tests/test_tglc.py +149 -0
  89. {quicklook_package-1.3.2 → quicklook_package-1.6}/tests/test_tql.py +317 -36
  90. quicklook_package-1.6/tests/test_use_priors.py +403 -0
  91. quicklook_package-1.6/tests/test_utils.py +98 -0
  92. quicklook_package-1.6/tests/test_utils_funcs.py +180 -0
  93. quicklook_package-1.6/tests/test_yline.py +86 -0
  94. quicklook_package-1.6/tests/web/test_app.py +252 -0
  95. quicklook_package-1.6/tests/web/test_prefix.py +57 -0
  96. quicklook_package-1.6/tox.ini +47 -0
  97. quicklook_package-1.6/uv.lock +5906 -0
  98. quicklook_package-1.3.2/.flake8 +0 -5
  99. quicklook_package-1.3.2/.github/workflows/build-and-test.yml +0 -76
  100. quicklook_package-1.3.2/.pre-commit-config.yaml +0 -16
  101. quicklook_package-1.3.2/PKG-INFO +0 -161
  102. quicklook_package-1.3.2/README.md +0 -131
  103. quicklook_package-1.3.2/environment.yml +0 -12
  104. quicklook_package-1.3.2/notebook/examples.ipynb +0 -1552
  105. quicklook_package-1.3.2/pyproject.toml +0 -59
  106. quicklook_package-1.3.2/quicklook/__init__.py +0 -11
  107. quicklook_package-1.3.2/quicklook/compat.py +0 -61
  108. quicklook_package-1.3.2/quicklook/plot.py +0 -988
  109. quicklook_package-1.3.2/quicklook/science.mplstyle +0 -66
  110. quicklook_package-1.3.2/quicklook/tql.py +0 -1366
  111. quicklook_package-1.3.2/quicklook_package.egg-info/PKG-INFO +0 -161
  112. quicklook_package-1.3.2/quicklook_package.egg-info/SOURCES.txt +0 -35
  113. quicklook_package-1.3.2/quicklook_package.egg-info/requires.txt +0 -12
  114. quicklook_package-1.3.2/requirements.txt +0 -20
  115. quicklook_package-1.3.2/scripts/ql +0 -259
  116. quicklook_package-1.3.2/scripts/read_tls +0 -58
  117. quicklook_package-1.3.2/setup.py +0 -22
  118. quicklook_package-1.3.2/tests/TOI5071_s46_pdcsap_sc.png +0 -0
  119. quicklook_package-1.3.2/tests/TOI5071_s46_pdcsap_sc_tls.h5 +0 -0
  120. {quicklook_package-1.3.2 → quicklook_package-1.6}/quicklook_package.egg-info/dependency_links.txt +0 -0
  121. {quicklook_package-1.3.2 → quicklook_package-1.6}/quicklook_package.egg-info/top_level.txt +0 -0
  122. {quicklook_package-1.3.2 → quicklook_package-1.6}/setup.cfg +0 -0
@@ -0,0 +1,66 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ${{ matrix.os }}
12
+ # Hard ceiling so a stalled external call (e.g. astroquery/astropy reaching
13
+ # a service) fails the job in minutes instead of hanging until GitHub's
14
+ # 6-hour default and surfacing only as "The operation was canceled."
15
+ timeout-minutes: 30
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ os: [ubuntu-latest, macos-latest]
20
+ python-version: ["3.10", "3.12"]
21
+
22
+ steps:
23
+ - uses: actions/checkout@v7
24
+ with:
25
+ fetch-depth: 0
26
+
27
+ - name: Set up Python ${{ matrix.python-version }}
28
+ uses: actions/setup-python@v6
29
+ with:
30
+ python-version: ${{ matrix.python-version }}
31
+
32
+ - name: Cache pip packages
33
+ uses: actions/cache@v6
34
+ with:
35
+ path: ~/.cache/pip
36
+ key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
37
+ restore-keys: |
38
+ ${{ runner.os }}-pip-
39
+
40
+ - name: Cache Lightkurve data
41
+ uses: actions/cache@v6
42
+ with:
43
+ path: ~/.lightkurve/cache/mastDownload
44
+ key: ${{ runner.os }}-lightkurve-${{ hashFiles('pyproject.toml') }}
45
+ restore-keys: |
46
+ ${{ runner.os }}-lightkurve-
47
+
48
+ - name: Remove corrupted FITS (if any)
49
+ run: |
50
+ find ~/.lightkurve/cache/mastDownload -type f -name "*.fits" -size -1M -delete || true
51
+
52
+ - name: Install dependencies
53
+ run: |
54
+ python -m pip install --upgrade pip
55
+ pip install -e ".[dev,gui]"
56
+
57
+ - name: Run tests
58
+ # --timeout converts a hung test (e.g. an unmocked network call) into a
59
+ # failure with a traceback pinpointing the stall, instead of wedging the
60
+ # whole -n auto run. thread method is xdist-safe and cross-platform.
61
+ run: pytest -v -m "not notebook and not network" -n auto --timeout=180 --timeout-method=thread
62
+
63
+ - name: Verify package builds cleanly
64
+ run: |
65
+ pip install --upgrade build
66
+ python -m build --sdist --wheel
@@ -3,27 +3,32 @@ name: Publish to PyPI
3
3
  on:
4
4
  workflow_dispatch: #optional manual run
5
5
  release:
6
- types: [published] # run only when published after creating a tag (e.g. v.1.4)
6
+ types: [published]
7
7
 
8
8
  jobs:
9
9
  publish:
10
10
  runs-on: ubuntu-latest
11
11
  steps:
12
- - uses: actions/checkout@v3
12
+ - uses: actions/checkout@v7
13
13
  with:
14
14
  fetch-depth: 0
15
15
 
16
16
  - name: Set up Python
17
- uses: actions/setup-python@v4
17
+ uses: actions/setup-python@v6
18
18
  with:
19
- python-version: "3.10"
19
+ python-version: "3.12"
20
20
 
21
21
  - name: Install build tools
22
- run: |
23
- pip install build twine
22
+ run: pip install --upgrade build twine
23
+
24
+ - name: Clean old builds
25
+ run: rm -rf dist/*
24
26
 
25
27
  - name: Build package
26
- run: python -m build
28
+ run: python -m build --sdist --wheel
29
+
30
+ - name: Verify distributions
31
+ run: twine check dist/*
27
32
 
28
33
  - name: Publish to PyPI
29
34
  run: twine upload dist/*
@@ -76,7 +76,7 @@ docs/_build/
76
76
  target/
77
77
 
78
78
  # Jupyter Notebook
79
- .ipynb_checkpoints
79
+ .ipynb_checkpoints*
80
80
 
81
81
  # IPython
82
82
  profile_default/
@@ -152,6 +152,15 @@ dmypy.json
152
152
  # Cython debug symbols
153
153
  cython_debug/
154
154
 
155
+ # GUI runtime outputs (generated by ql-gui)
156
+ quicklook/app/static/outputs/
157
+
158
+ # Local test run artifacts (HDF5 outputs produced by manual TLS runs in tests/)
159
+ tests/*.h5
160
+
161
+ # MkDocs build output
162
+ site/
163
+
155
164
  # PyCharm
156
165
  # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157
166
  # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
@@ -0,0 +1,13 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v6.0.0
4
+ hooks:
5
+ - id: check-yaml
6
+ - id: end-of-file-fixer
7
+ - id: trailing-whitespace
8
+ - repo: https://github.com/astral-sh/ruff-pre-commit
9
+ rev: v0.13.1
10
+ hooks:
11
+ - id: ruff-check
12
+ args: [--fix]
13
+ - id: ruff-format
@@ -0,0 +1,16 @@
1
+ # Read the Docs configuration file
2
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3
+
4
+ version: 2
5
+
6
+ build:
7
+ os: ubuntu-24.04
8
+ tools:
9
+ python: "3.12"
10
+
11
+ mkdocs:
12
+ configuration: mkdocs.yml
13
+
14
+ python:
15
+ install:
16
+ - requirements: docs/requirements.txt
@@ -0,0 +1,55 @@
1
+ # Python Package Management with uv
2
+
3
+ Use uv exclusively for Python package management in this project.
4
+
5
+ ## Package Management Commands
6
+
7
+ - All Python dependencies **must be installed, synchronized, and locked** using uv
8
+ - Never use pip, pip-tools, poetry, or conda directly for dependency management
9
+
10
+ Use these commands:
11
+
12
+ - Install dependencies: `uv add <package>`
13
+ - Remove dependencies: `uv remove <package>`
14
+ - Sync environment: `uv sync`
15
+ - Lock dependencies: `uv lock`
16
+
17
+ ## Running Python Code
18
+
19
+ - Run a Python script with `uv run <script-name>.py`
20
+ - Run Python tools with `uv run <tool>` (e.g. `uv run pytest`, `uv run ruff`, `uv run mypy`, `uv run pre-commit`)
21
+ - Launch a Python REPL with `uv run python`
22
+
23
+
24
+ ## Linting and formatting
25
+
26
+ This project uses Ruff for both linting and formatting. Do not call Black,
27
+ flake8, isort, or pylint.
28
+
29
+ - Lint: `uv run ruff check .`
30
+ - Lint and auto-fix: `uv run ruff check --fix .`
31
+ - Format: `uv run ruff format .`
32
+ - Check formatting without writing: `uv run ruff format --check .`
33
+ - Always invoke Ruff through `uv run` so it resolves to the project's
34
+ virtual environment.
35
+
36
+ Ruff configuration lives in `pyproject.toml` under `[tool.ruff]`. Do not
37
+ add a separate `ruff.toml` or `.ruff.toml`. Do not add inline `# noqa`
38
+ comments without a rule code.
39
+
40
+ ## Create test, Update readme, and Git commit for each new feature
41
+ Create a unit tests. Add tests as new features are added. Organize the tests accordingly.
42
+ Update readme.md.
43
+ Create a detailed git commit after accomplishing a unique feature.
44
+
45
+ ## Screenshot
46
+ Take a screenshot by running scripts/screenshot_gui.py whenever the GUI is changed.
47
+ Then use the new figure in readme.md
48
+
49
+ ## gitignore
50
+ Do not track large files locally and in git history. Update .gitignore if needed.
51
+
52
+ ## Session limit
53
+ When the prompt starts `session limit`, it means we hit a session limit and restarted.
54
+ The goal is marked with `goal`. Based on git status, the modified files are marked with
55
+ `file1`. Review these local files, check the current implementation, and tell me what the immediate next step should be.
@@ -0,0 +1,202 @@
1
+ # OverflowError reading TGLC light curves with `quality_bitmask='hardest'` under NumPy 2
2
+
3
+ ## Summary
4
+
5
+ Calling `LightCurve.read(path, format="tglc", quality_bitmask="hardest")` —
6
+ or the equivalent via `search.download(quality_bitmask="hardest")` — fails
7
+ with:
8
+
9
+ ```
10
+ OverflowError: Python integer 65535 out of bounds for int16
11
+ ```
12
+
13
+ which `lightkurve` surfaces to the user as:
14
+
15
+ ```
16
+ LightkurveError: Error in reading Data product <path> of type TGLC.
17
+ This file may be corrupt due to an interrupted download. Please remove it
18
+ from your disk and try again.
19
+ ```
20
+
21
+ The diagnostic is misleading: **the file is not corrupt** — `astropy.io.fits.verify('exception')` passes on it. The failure is in the TGLC reader's quality-mask step, and it is triggered purely by the choice of `quality_bitmask`. `"none"`, `"default"`, and `"hard"` work; `"hardest"` does not.
22
+
23
+ ## Reproducer (synthetic, no network)
24
+
25
+ ```python
26
+ import numpy as np
27
+ from lightkurve.utils import TessQualityFlags
28
+
29
+ # TGLC HLSP stores ``tess_flags`` as signed int16 (FITS format='I').
30
+ quality = np.zeros(100, dtype=np.int16)
31
+
32
+ TessQualityFlags.create_quality_mask(
33
+ quality_array=quality,
34
+ bitmask=TessQualityFlags.HARDEST_BITMASK, # 65535
35
+ )
36
+ # -> OverflowError: Python integer 65535 out of bounds for int16
37
+ ```
38
+
39
+ ## Reproducer (real data)
40
+
41
+ ```python
42
+ import lightkurve as lk
43
+
44
+ search = lk.search_lightcurve("TIC 360906004", author="TGLC")
45
+ lc = search[0].download(quality_bitmask="hardest")
46
+ # -> LightkurveError: Error in reading Data product ... of type TGLC.
47
+ ```
48
+
49
+ (Any TGLC HLSP file reproduces this; TIC 360906004 sector 11 is a small one.)
50
+
51
+ ## Full traceback
52
+
53
+ ```
54
+ Traceback (most recent call last):
55
+ File ".../lightkurve/io/read.py", line 134, in read
56
+ out = self.registry.read(cls, *args, **kwargs)
57
+ File ".../astropy/io/registry/core.py", line 221, in read
58
+ data = reader(*args, **kwargs)
59
+ File ".../lightkurve/io/tglc.py", line 55, in read_tglc_lightcurve
60
+ quality_mask = TessQualityFlags.create_quality_mask(
61
+ File ".../lightkurve/utils.py", line 114, in create_quality_mask
62
+ quality_mask = (quality_array & bitmask) == 0
63
+ OverflowError: Python integer 65535 out of bounds for int16
64
+
65
+ The above exception was the direct cause of the following exception:
66
+
67
+ LightkurveError: Error in reading Data product
68
+ <cache>/hlsp_tglc_tess_ffi_gaiaid-5842130724965127040-s0011-cam3-ccd1_tess_v1_llc.fits
69
+ of type TGLC.
70
+ This file may be corrupt due to an interrupted download. Please remove it
71
+ from your disk and try again.
72
+ ```
73
+
74
+ ## Root cause
75
+
76
+ The TGLC HLSP stores `tess_flags` as **signed 16-bit int** (FITS column
77
+ `format='I'`). `read_tglc_lightcurve` feeds that column straight into
78
+ `TessQualityFlags.create_quality_mask`, which performs:
79
+
80
+ ```python
81
+ quality_mask = (quality_array & bitmask) == 0
82
+ ```
83
+
84
+ When `bitmask` is a Python `int` larger than the int16 max (32767), NumPy
85
+ 2.0+ refuses the bitwise AND and raises `OverflowError`. NumPy 1.x silently
86
+ truncated this. The relevant `TessQualityFlags` constants:
87
+
88
+ | Bitmask name | Value | Fits int16? |
89
+ |-------------------|-------|-------------|
90
+ | `DEFAULT_BITMASK` | 175 | yes |
91
+ | `HARD_BITMASK` | 24319 | yes |
92
+ | `HARDEST_BITMASK` | 65535 | **no** |
93
+
94
+ So the bug is exposed for any reader/caller that combines a TGLC quality
95
+ column with `quality_bitmask="hardest"` (or any integer > 32767).
96
+
97
+ Two notes:
98
+
99
+ * The reader's user-facing error blames a "corrupt download", which is
100
+ incorrect and sends users on a futile redownload loop. The cause is an
101
+ adapter-level dtype mismatch, not a transport issue.
102
+ * Other lightkurve readers that route int32 quality columns through the
103
+ same helper are unaffected — this is specifically the int16 column the
104
+ TGLC HLSP exposes.
105
+
106
+ ## Proposed fix
107
+
108
+ Cast the quality column to int32 before the bitwise AND. One-line change
109
+ in `src/lightkurve/io/tglc.py`:
110
+
111
+ ```diff
112
+ --- a/src/lightkurve/io/tglc.py
113
+ +++ b/src/lightkurve/io/tglc.py
114
+ @@
115
+ - quality_mask = TessQualityFlags.create_quality_mask(
116
+ - quality_array=lc["quality"], bitmask=quality_bitmask
117
+ - )
118
+ + # TGLC stores ``tess_flags`` as signed int16. Cast to int32 before the
119
+ + # bitwise AND in create_quality_mask so masks > 32767 (e.g. HARDEST =
120
+ + # 65535) don't raise ``OverflowError`` under NumPy 2.
121
+ + quality_mask = TessQualityFlags.create_quality_mask(
122
+ + quality_array=np.asarray(lc["quality"], dtype=np.int32),
123
+ + bitmask=quality_bitmask,
124
+ + )
125
+ ```
126
+
127
+ `numpy` is already imported in this module (`import numpy as np` at the top).
128
+ The cast is local to the mask computation; the stored `lc["quality"]` column
129
+ keeps its original dtype.
130
+
131
+ A slightly broader fix would normalize the dtype inside
132
+ `TessQualityFlags.create_quality_mask` itself (e.g. with
133
+ `np.asarray(quality_array, dtype=np.int32)`), which would also protect any
134
+ other reader that ever passes a sub-int32 quality column. Either fix
135
+ resolves the symptom; the reader-local cast is the minimal change.
136
+
137
+ ## Suggested regression test
138
+
139
+ ```python
140
+ def test_tglc_hardest_bitmask_no_int16_overflow():
141
+ """TGLC reader must not overflow int16 when HARDEST_BITMASK is used.
142
+
143
+ The TGLC HLSP stores ``tess_flags`` as int16 (FITS format='I').
144
+ Under NumPy 2, ``int16_array & 65535`` raises OverflowError; the
145
+ reader must cast to a wider dtype before the bitwise AND.
146
+ """
147
+ import lightkurve as lk
148
+
149
+ res = lk.search_lightcurve("TIC 360906004", author="TGLC")
150
+ assert len(res) > 0, "TIC 360906004 should have at least one TGLC product"
151
+ lc = res[0].download(quality_bitmask="hardest")
152
+ assert lc is not None
153
+ assert len(lc) > 0
154
+ ```
155
+
156
+ A network-free variant using only `lightkurve.utils.TessQualityFlags`:
157
+
158
+ ```python
159
+ def test_create_quality_mask_accepts_int16_quality_array():
160
+ import numpy as np
161
+ from lightkurve.utils import TessQualityFlags
162
+
163
+ quality = np.zeros(8, dtype=np.int16)
164
+ mask = TessQualityFlags.create_quality_mask(
165
+ quality_array=quality,
166
+ bitmask=TessQualityFlags.HARDEST_BITMASK,
167
+ )
168
+ assert mask.all()
169
+ ```
170
+
171
+ ## Environment
172
+
173
+ * Python 3.10
174
+ * lightkurve 2.6.0
175
+ * numpy 2.2.6
176
+ * astropy 6.1.7
177
+
178
+ The bug is **dtype-driven** (int16 column + Python int > 32767) and the
179
+ behavior change is **NumPy 2** (which rejects out-of-bounds Python ints in
180
+ bitwise ops with smaller-dtype arrays). It will reproduce on any combination
181
+ of lightkurve >= the TGLC reader's introduction with NumPy >= 2.0.
182
+
183
+ ## Impact
184
+
185
+ Any pipeline that requests `quality_bitmask="hardest"` (or any custom
186
+ integer > 32767) when reading TGLC HLSP light curves fails immediately on
187
+ download/read. The misleading "file may be corrupt" message wastes user time
188
+ on redownload attempts that cannot succeed. Downstream tools that wrap
189
+ lightkurve (e.g. quicklook pipelines that use TGLC for FFI targets) inherit
190
+ the failure.
191
+
192
+ ## Verified locally
193
+
194
+ Applied the one-line patch to a venv copy of
195
+ `lightkurve/io/tglc.py` and re-ran with `quality_bitmask="hardest"`:
196
+
197
+ ```
198
+ sector: 11 cadences: 1180 finite cal_psf_flux: 1180/1180
199
+ ```
200
+
201
+ i.e. the read now succeeds and produces the same light curve as
202
+ `quality_bitmask="default"`, with the user's selected mask applied.
@@ -0,0 +1 @@
1
+ include quicklook/data/*.csv