quicklook-package 1.6__tar.gz → 1.7.0__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.
- quicklook_package-1.7.0/.github/workflows/release-please.yml +36 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/.github/workflows/release.yml +7 -0
- quicklook_package-1.7.0/.release-please-manifest.json +3 -0
- quicklook_package-1.7.0/CHANGELOG.md +17 -0
- {quicklook_package-1.6/quicklook_package.egg-info → quicklook_package-1.7.0}/PKG-INFO +1 -1
- {quicklook_package-1.6 → quicklook_package-1.7.0}/README_DEV.md +7 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/notebook/examples.ipynb +26 -2
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/cli/app.py +86 -2
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/tql.py +92 -21
- {quicklook_package-1.6 → quicklook_package-1.7.0/quicklook_package.egg-info}/PKG-INFO +1 -1
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook_package.egg-info/SOURCES.txt +7 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook_package.egg-info/scm_file_list.json +7 -0
- quicklook_package-1.7.0/quicklook_package.egg-info/scm_version.json +8 -0
- quicklook_package-1.7.0/release-please-config.json +12 -0
- quicklook_package-1.7.0/tests/test_sector_all.py +68 -0
- quicklook_package-1.7.0/tests/test_sectors_list.py +180 -0
- quicklook_package-1.7.0/tests/test_simbad_failure.py +55 -0
- quicklook_package-1.6/quicklook_package.egg-info/scm_version.json +0 -8
- {quicklook_package-1.6 → quicklook_package-1.7.0}/.github/workflows/build-and-test.yml +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/.gitignore +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/.pre-commit-config.yaml +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/.readthedocs.yaml +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/CLAUDE.md +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/LICENSE +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/LIGHTKURVE_TGLC_BUG_REPORT.txt +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/MANIFEST.in +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/README.md +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/TODO.md +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/check_pyproject_deps.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/docs/api.md +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/docs/batch.md +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/docs/cli.md +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/docs/faq.md +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/docs/getting-started.md +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/docs/gui.md +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/docs/img/ql-gui-gallery.png +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/docs/img/ql-gui-joblog.png +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/docs/img/ql-gui.png +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/docs/index.md +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/docs/installation.md +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/docs/pipeline.md +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/docs/requirements.txt +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/mkdocs.yml +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/notebook/experiment_tglc.ipynb +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/notebook/window_length.ipynb +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/pyproject.toml +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/pytest.ini +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/ql.batch +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/__init__.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/app/__init__.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/app/app.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/app/jobs_db.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/app/static/css/quicklook.css +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/app/static/js/quicklook.js +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/app/templates/base.html +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/app/templates/compare.html +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/app/templates/gallery.html +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/app/templates/index.html +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/app/templates/partials/_components.html +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/app/templates/partials/topbar.html +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/app/templates/tls_summary.html +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/cli/__init__.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/cli/ql.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/cli/rank_tls.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/cli/read_tls.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/data/TOIs.csv +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/data/simbad_obj_types.csv +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/exceptions.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/gls.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/h5io.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/inject.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/measure.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/notch_locor.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/pipelines.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/plot.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/science.mplstyle +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/tglc.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/utils.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook_package.egg-info/dependency_links.txt +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook_package.egg-info/entry_points.txt +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook_package.egg-info/requires.txt +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook_package.egg-info/top_level.txt +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/scripts/screenshot_gui.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/setup.cfg +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/tests/WASP-21_s83_pdcsap_sc.png +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/tests/conftest.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/tests/test_cancel_flow.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/tests/test_cli.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/tests/test_gpu_tls.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/tests/test_h5io.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/tests/test_import.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/tests/test_iterative_search.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/tests/test_jobs_db.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/tests/test_notch_locor.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/tests/test_notebooks.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/tests/test_phase_xlim.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/tests/test_rank_filters.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/tests/test_sanitize_target_name.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/tests/test_tglc.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/tests/test_tql.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/tests/test_use_priors.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/tests/test_utils.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/tests/test_utils_funcs.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/tests/test_yline.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/tests/web/test_app.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/tests/web/test_prefix.py +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/tox.ini +0 -0
- {quicklook_package-1.6 → quicklook_package-1.7.0}/uv.lock +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: Release Please
|
|
2
|
+
|
|
3
|
+
# Opens/updates a release PR from Conventional Commits on main. Merging that PR
|
|
4
|
+
# creates the tag and GitHub release (the package version itself comes from the
|
|
5
|
+
# git tag via setuptools_scm) and then publishes to PyPI.
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
push:
|
|
9
|
+
branches: [main]
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: write
|
|
13
|
+
pull-requests: write
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
release-please:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
outputs:
|
|
19
|
+
release_created: ${{ steps.release.outputs.release_created }}
|
|
20
|
+
tag_name: ${{ steps.release.outputs.tag_name }}
|
|
21
|
+
steps:
|
|
22
|
+
- uses: googleapis/release-please-action@v5
|
|
23
|
+
id: release
|
|
24
|
+
with:
|
|
25
|
+
config-file: release-please-config.json
|
|
26
|
+
manifest-file: .release-please-manifest.json
|
|
27
|
+
|
|
28
|
+
# Releases created with GITHUB_TOKEN do not trigger the `release: published`
|
|
29
|
+
# event, so publish from here instead of relying on release.yml's own trigger.
|
|
30
|
+
publish:
|
|
31
|
+
needs: release-please
|
|
32
|
+
if: ${{ needs.release-please.outputs.release_created == 'true' }}
|
|
33
|
+
uses: ./.github/workflows/release.yml
|
|
34
|
+
with:
|
|
35
|
+
ref: ${{ needs.release-please.outputs.tag_name }}
|
|
36
|
+
secrets: inherit
|
|
@@ -4,6 +4,12 @@ on:
|
|
|
4
4
|
workflow_dispatch: #optional manual run
|
|
5
5
|
release:
|
|
6
6
|
types: [published]
|
|
7
|
+
workflow_call: # called by release-please.yml after it creates a release
|
|
8
|
+
inputs:
|
|
9
|
+
ref:
|
|
10
|
+
description: Tag to build and publish
|
|
11
|
+
type: string
|
|
12
|
+
default: ""
|
|
7
13
|
|
|
8
14
|
jobs:
|
|
9
15
|
publish:
|
|
@@ -12,6 +18,7 @@ jobs:
|
|
|
12
18
|
- uses: actions/checkout@v7
|
|
13
19
|
with:
|
|
14
20
|
fetch-depth: 0
|
|
21
|
+
ref: ${{ inputs.ref }}
|
|
15
22
|
|
|
16
23
|
- name: Set up Python
|
|
17
24
|
uses: actions/setup-python@v6
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [1.7.0](https://github.com/jpdeleon/quicklook/compare/v1.6.0...v1.7.0) (2026-11-05)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add --sectors to stitch an explicit set of sectors ([ee3af86](https://github.com/jpdeleon/quicklook/commit/ee3af86038a0ba892a44245da1db14d317a2559b))
|
|
9
|
+
* add --sectors to stitch an explicit set of sectors ([508801a](https://github.com/jpdeleon/quicklook/commit/508801ab8025421daeb85e08ebf5719cb36c77ab))
|
|
10
|
+
* support --sector all in the run CLI ([dd853f1](https://github.com/jpdeleon/quicklook/commit/dd853f1fc81ad89636b30c5aa44615a0074d503b))
|
|
11
|
+
* support --sector all in the run CLI ([cb6ff3d](https://github.com/jpdeleon/quicklook/commit/cb6ff3df47da34e1e393552f203413faea52f2be))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* do not abort run when Simbad query fails ([472b5f3](https://github.com/jpdeleon/quicklook/commit/472b5f378893ce603dc5055c9c936f7c85a12f07))
|
|
17
|
+
* do not abort run when Simbad query fails ([3948602](https://github.com/jpdeleon/quicklook/commit/39486023dfb5d201e35069603bcda45cf7655c49))
|
|
@@ -58,6 +58,13 @@ def test_tql_runtime(benchmark, planet_inputs):
|
|
|
58
58
|
tox -r
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
+
- **Releases**: handled by [release-please](https://github.com/googleapis/release-please).
|
|
62
|
+
Use [Conventional Commits](https://www.conventionalcommits.org/) (`feat:`, `fix:`,
|
|
63
|
+
`feat!:` / `BREAKING CHANGE:`) on `main`; a release PR with the changelog and next
|
|
64
|
+
version is opened automatically. Merging it tags `vX.Y.Z`, creates the GitHub
|
|
65
|
+
release and publishes to PyPI (the package version comes from the tag via
|
|
66
|
+
`setuptools_scm`).
|
|
67
|
+
|
|
61
68
|
- **Check minimum Python required by dependencies**:
|
|
62
69
|
|
|
63
70
|
`check_pyproject_deps.py` reads `pyproject.toml`, looks up each dependency's
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"source": [
|
|
16
16
|
"Run the next cell to install `quicklook` and its dependencies.\n",
|
|
17
17
|
"\n",
|
|
18
|
-
"
|
|
18
|
+
"If you're on a GPU runtime (e.g. Colab's T4), skip ahead to the **GPU runtime** cell below instead, which installs the optional `gpu` extra for GPU-accelerated transit search."
|
|
19
19
|
]
|
|
20
20
|
},
|
|
21
21
|
{
|
|
@@ -35,7 +35,31 @@
|
|
|
35
35
|
"metadata": {},
|
|
36
36
|
"outputs": [],
|
|
37
37
|
"source": [
|
|
38
|
-
"!python -m pip install -U
|
|
38
|
+
"!python -m pip install -U quicklook-package"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"cell_type": "markdown",
|
|
43
|
+
"id": "b4a01fb9-2a81-42d4-ab33-1c7ef557b3a6",
|
|
44
|
+
"metadata": {},
|
|
45
|
+
"source": [
|
|
46
|
+
"### GPU runtime (optional)\n",
|
|
47
|
+
"\n",
|
|
48
|
+
"If your Colab runtime has a GPU attached (e.g. **Runtime > Change runtime type > T4 GPU**), install the `gpu` extra instead of the plain package to enable [GTLS](https://github.com/Farthing-0/GTLS) GPU-accelerated transit search:\n",
|
|
49
|
+
"```\n",
|
|
50
|
+
"!python -m pip install -U \"quicklook-package[gpu]\"\n",
|
|
51
|
+
"```\n",
|
|
52
|
+
"`quicklook` automatically falls back to the CPU-based transit search if no GPU is available or GTLS fails to initialize, so this extra is safe to skip if you're not using a GPU runtime."
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"cell_type": "code",
|
|
57
|
+
"execution_count": null,
|
|
58
|
+
"id": "1e9ad418-f055-4fa1-8fe7-d64121cc2f58",
|
|
59
|
+
"metadata": {},
|
|
60
|
+
"outputs": [],
|
|
61
|
+
"source": [
|
|
62
|
+
"!python -m pip install -U \"quicklook-package[gpu]\""
|
|
39
63
|
]
|
|
40
64
|
},
|
|
41
65
|
{
|
|
@@ -6,6 +6,7 @@ inside the functions that need them so that ``--help`` on any subcommand or
|
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
import os
|
|
9
|
+
import re
|
|
9
10
|
from typing import Optional, Tuple
|
|
10
11
|
|
|
11
12
|
import typer
|
|
@@ -48,6 +49,35 @@ def _validate_choice(value: str, choices: set[str], name: str) -> str:
|
|
|
48
49
|
# --- batch helper (heavy imports inside) ---
|
|
49
50
|
|
|
50
51
|
|
|
52
|
+
def _parse_sector(value: str):
|
|
53
|
+
"""Parse ``--sector``: an integer (-1 = latest) or the string "all"."""
|
|
54
|
+
text = str(value).strip().lower()
|
|
55
|
+
if text == "all":
|
|
56
|
+
return "all"
|
|
57
|
+
try:
|
|
58
|
+
return int(text)
|
|
59
|
+
except ValueError:
|
|
60
|
+
raise typer.BadParameter(f"--sector must be an integer or 'all', got {value!r}")
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _parse_sectors(value: str):
|
|
64
|
+
"""Parse ``--sectors`` such as "66-68,93" into a sorted, unique list of ints."""
|
|
65
|
+
sectors = set()
|
|
66
|
+
for part in str(value).split(","):
|
|
67
|
+
part = part.strip()
|
|
68
|
+
match = re.fullmatch(r"(\d+)(?:-(\d+))?", part)
|
|
69
|
+
if not match:
|
|
70
|
+
raise typer.BadParameter(
|
|
71
|
+
f"--sectors must look like '66-68,93' (numbers and ranges), got {value!r}"
|
|
72
|
+
)
|
|
73
|
+
first = int(match.group(1))
|
|
74
|
+
last = int(match.group(2)) if match.group(2) else first
|
|
75
|
+
if first < 1 or last < first:
|
|
76
|
+
raise typer.BadParameter(f"invalid sector range {part!r} in --sectors")
|
|
77
|
+
sectors.update(range(first, last + 1))
|
|
78
|
+
return sorted(sectors)
|
|
79
|
+
|
|
80
|
+
|
|
51
81
|
def _run_ql_for_sector(
|
|
52
82
|
name: str,
|
|
53
83
|
sector: int,
|
|
@@ -306,7 +336,25 @@ app = typer.Typer(
|
|
|
306
336
|
@app.command()
|
|
307
337
|
def run(
|
|
308
338
|
name: str = typer.Option(..., "--name", help="Target name"),
|
|
309
|
-
sector:
|
|
339
|
+
sector: str = typer.Option(
|
|
340
|
+
"-1",
|
|
341
|
+
"--sector",
|
|
342
|
+
help=(
|
|
343
|
+
"TESS sector number, -1 for the last available (default), or 'all' to stitch "
|
|
344
|
+
"every sector of one pipeline into a single light curve (requires --exptime "
|
|
345
|
+
"in seconds as listed by MAST, e.g. 200/600/1800; needed to recover periods "
|
|
346
|
+
"longer than one sector)"
|
|
347
|
+
),
|
|
348
|
+
),
|
|
349
|
+
sectors: Optional[str] = typer.Option(
|
|
350
|
+
None,
|
|
351
|
+
"--sectors",
|
|
352
|
+
help=(
|
|
353
|
+
"Stitch an explicit set of sectors, e.g. '66-68' or '66-68,93' (at least two; "
|
|
354
|
+
"requires --exptime). Consecutive sectors avoid the long gaps and aliasing of "
|
|
355
|
+
"'--sector all' when a target was observed years apart"
|
|
356
|
+
),
|
|
357
|
+
),
|
|
310
358
|
each_sector: bool = typer.Option(
|
|
311
359
|
False, "--each-sector", help="Run on each available sector individually"
|
|
312
360
|
),
|
|
@@ -430,6 +478,42 @@ def run(
|
|
|
430
478
|
typer.echo("Error: --each-sector and --each-pipeline are mutually exclusive.", err=True)
|
|
431
479
|
raise typer.Exit(2)
|
|
432
480
|
|
|
481
|
+
sector_arg = _parse_sector(sector)
|
|
482
|
+
if sectors is not None:
|
|
483
|
+
sector_list = _parse_sectors(sectors)
|
|
484
|
+
if sector != "-1" or each_sector or each_pipeline:
|
|
485
|
+
typer.echo(
|
|
486
|
+
"Error: --sectors cannot be combined with --sector, --each-sector or "
|
|
487
|
+
"--each-pipeline.",
|
|
488
|
+
err=True,
|
|
489
|
+
)
|
|
490
|
+
raise typer.Exit(2)
|
|
491
|
+
if len(sector_list) < 2:
|
|
492
|
+
typer.echo("Error: --sectors needs at least two sectors to stitch.", err=True)
|
|
493
|
+
raise typer.Exit(2)
|
|
494
|
+
if exptime is None:
|
|
495
|
+
typer.echo(
|
|
496
|
+
"Error: --sectors requires --exptime (seconds, e.g. 200, 600 or 1800) "
|
|
497
|
+
"so that sectors of a single cadence are stitched.",
|
|
498
|
+
err=True,
|
|
499
|
+
)
|
|
500
|
+
raise typer.Exit(2)
|
|
501
|
+
sector_arg = sector_list
|
|
502
|
+
elif sector_arg == "all":
|
|
503
|
+
if each_sector or each_pipeline:
|
|
504
|
+
typer.echo(
|
|
505
|
+
"Error: --sector all cannot be combined with --each-sector or --each-pipeline.",
|
|
506
|
+
err=True,
|
|
507
|
+
)
|
|
508
|
+
raise typer.Exit(2)
|
|
509
|
+
if exptime is None:
|
|
510
|
+
typer.echo(
|
|
511
|
+
"Error: --sector all requires --exptime (seconds, e.g. 200, 600 or 1800) "
|
|
512
|
+
"so that sectors of a single cadence are stitched.",
|
|
513
|
+
err=True,
|
|
514
|
+
)
|
|
515
|
+
raise typer.Exit(2)
|
|
516
|
+
|
|
433
517
|
if not save:
|
|
434
518
|
import sys
|
|
435
519
|
|
|
@@ -569,7 +653,7 @@ def run(
|
|
|
569
653
|
|
|
570
654
|
ql = TessQuickLook(
|
|
571
655
|
target_name=target_name,
|
|
572
|
-
sector=
|
|
656
|
+
sector=sector_arg,
|
|
573
657
|
pipeline=pipeline_lower,
|
|
574
658
|
exptime=exptime,
|
|
575
659
|
flux_type=fluxtype,
|
|
@@ -141,6 +141,17 @@ def _adapt_gtls_result(result, model):
|
|
|
141
141
|
return _TLSResult(values)
|
|
142
142
|
|
|
143
143
|
|
|
144
|
+
def format_sector_ranges(sectors):
|
|
145
|
+
"""Compact sorted sector list: [66, 67, 68, 93] -> "66-68+93"."""
|
|
146
|
+
runs = []
|
|
147
|
+
for s in sorted({int(s) for s in sectors}):
|
|
148
|
+
if runs and s == runs[-1][1] + 1:
|
|
149
|
+
runs[-1][1] = s
|
|
150
|
+
else:
|
|
151
|
+
runs.append([s, s])
|
|
152
|
+
return "+".join(str(a) if a == b else f"{a}-{b}" for a, b in runs)
|
|
153
|
+
|
|
154
|
+
|
|
144
155
|
class TessQuickLook:
|
|
145
156
|
def __init__(
|
|
146
157
|
self,
|
|
@@ -418,6 +429,35 @@ class TessQuickLook:
|
|
|
418
429
|
)
|
|
419
430
|
self.ephem_source = "TFOP" if self.toi_epoch is not None else None
|
|
420
431
|
|
|
432
|
+
def _is_multi_sector(self):
|
|
433
|
+
"""True when the light curve stitches several sectors (``sector="all"``)."""
|
|
434
|
+
return isinstance(self.sector, (list, tuple, np.ndarray))
|
|
435
|
+
|
|
436
|
+
def _sector_label(self):
|
|
437
|
+
"""Filename token for the sector.
|
|
438
|
+
|
|
439
|
+
Zero-padded number for one sector, "all" for a full stitch, or the
|
|
440
|
+
compact range (e.g. "66-68+93") when explicit sectors were requested.
|
|
441
|
+
"""
|
|
442
|
+
if not self._is_multi_sector():
|
|
443
|
+
return str(self.sector).zfill(2)
|
|
444
|
+
requested = getattr(self, "_sectors_requested", None)
|
|
445
|
+
return format_sector_ranges(requested) if requested else "all"
|
|
446
|
+
|
|
447
|
+
def _sector_display(self):
|
|
448
|
+
"""Human-readable sector text for plot titles."""
|
|
449
|
+
if self._is_multi_sector():
|
|
450
|
+
requested = getattr(self, "_sectors_requested", None)
|
|
451
|
+
if requested:
|
|
452
|
+
return f"{format_sector_ranges(requested).replace('+', ', ')} ({len(self.sector)} sectors)"
|
|
453
|
+
return f"{min(self.sector)}-{max(self.sector)} ({len(self.sector)} sectors)"
|
|
454
|
+
return str(self.sector)
|
|
455
|
+
|
|
456
|
+
@property
|
|
457
|
+
def _tpf_sector(self):
|
|
458
|
+
"""Single sector for the TPF/neighbor panel (latest one if stitched)."""
|
|
459
|
+
return max(self.sector) if self._is_multi_sector() else self.sector
|
|
460
|
+
|
|
421
461
|
def check_output_file_exists(self):
|
|
422
462
|
name = self.target_name.replace(" ", "")
|
|
423
463
|
if name.lower()[:3] == "toi":
|
|
@@ -434,7 +474,7 @@ class TessQuickLook:
|
|
|
434
474
|
lctype = self.pipeline
|
|
435
475
|
fp = Path(
|
|
436
476
|
self.outdir,
|
|
437
|
-
f"{name}_s{
|
|
477
|
+
f"{name}_s{self._sector_label()}_{lctype}_{self.cadence[0]}c",
|
|
438
478
|
)
|
|
439
479
|
if self.mask_ephem:
|
|
440
480
|
fp = fp.with_stem(fp.stem + "_mask_ephem")
|
|
@@ -455,19 +495,27 @@ class TessQuickLook:
|
|
|
455
495
|
The result of the query, if the target is resolved.
|
|
456
496
|
Otherwise, None.
|
|
457
497
|
"""
|
|
458
|
-
#
|
|
459
|
-
Simbad.
|
|
498
|
+
# The object type is optional metadata, so an unreachable or failing
|
|
499
|
+
# Simbad service (e.g. a TAP outage) must not abort the whole run.
|
|
500
|
+
try:
|
|
501
|
+
# See also: https://simbad.cds.unistra.fr/guide/otypes.htx
|
|
502
|
+
Simbad.add_votable_fields("otype")
|
|
460
503
|
|
|
461
|
-
|
|
462
|
-
|
|
504
|
+
with warnings.catch_warnings():
|
|
505
|
+
warnings.simplefilter("ignore")
|
|
463
506
|
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
507
|
+
# Try resolving the target star by name
|
|
508
|
+
for name in self.star_names:
|
|
509
|
+
r = Simbad.query_object(name)
|
|
510
|
+
if r is not None:
|
|
511
|
+
return r
|
|
512
|
+
if self.verbose:
|
|
513
|
+
logger.info(f"Simbad cannot resolve {name}.")
|
|
514
|
+
except Exception as e:
|
|
515
|
+
logger.warning(
|
|
516
|
+
f"Simbad query failed ({type(e).__name__}: {e}); continuing without object type."
|
|
517
|
+
)
|
|
518
|
+
return None
|
|
471
519
|
|
|
472
520
|
def get_simbad_obj_type(self):
|
|
473
521
|
"""
|
|
@@ -524,10 +572,16 @@ class TessQuickLook:
|
|
|
524
572
|
The retrieved light curve object.
|
|
525
573
|
"""
|
|
526
574
|
# Determine the sector of interest
|
|
575
|
+
requested_sectors = None
|
|
576
|
+
self._sectors_requested = None
|
|
527
577
|
if kwargs.get("sector") is None:
|
|
528
578
|
sector_orig = None
|
|
529
579
|
else:
|
|
530
580
|
sector_orig = kwargs.pop("sector")
|
|
581
|
+
# An explicit list of sectors is a partial "all": stitch only those.
|
|
582
|
+
if isinstance(sector_orig, (list, tuple, set)):
|
|
583
|
+
requested_sectors = sorted({int(s) for s in sector_orig})
|
|
584
|
+
sector_orig = "all"
|
|
531
585
|
# sector = None if sector_orig in ["all", -1] else int(sector_orig)
|
|
532
586
|
sector = (
|
|
533
587
|
None
|
|
@@ -538,8 +592,8 @@ class TessQuickLook:
|
|
|
538
592
|
|
|
539
593
|
if sector_orig == "all":
|
|
540
594
|
# assure data comes from single pipeline
|
|
541
|
-
if kwargs
|
|
542
|
-
raise InvalidInputError("Supply exptime when using sector='all'.")
|
|
595
|
+
if kwargs.get("exptime") is None:
|
|
596
|
+
raise InvalidInputError("Supply exptime when using sector='all' or a sector list.")
|
|
543
597
|
|
|
544
598
|
# Single MAST search, then filter locally
|
|
545
599
|
search_result_all_lcs = lk.search_lightcurve(self.query_name)
|
|
@@ -608,6 +662,22 @@ class TessQuickLook:
|
|
|
608
662
|
# TGLC ePSF fallback even when MAST had products.
|
|
609
663
|
if kwargs.get("exptime"):
|
|
610
664
|
mask &= np.array(tbl["t_exptime"]) == kwargs["exptime"]
|
|
665
|
+
if requested_sectors:
|
|
666
|
+
available = self.get_unique_sectors(search_result_all_lcs[mask])
|
|
667
|
+
missing = [s for s in requested_sectors if s not in available]
|
|
668
|
+
if missing:
|
|
669
|
+
raise NoDataError(
|
|
670
|
+
f"Sectors {missing} not available for {self.query_name} with "
|
|
671
|
+
f"author={kwargs.get('author')} exptime={kwargs.get('exptime')}; "
|
|
672
|
+
f"available at this cadence: {available}."
|
|
673
|
+
)
|
|
674
|
+
mask &= np.array(
|
|
675
|
+
[
|
|
676
|
+
len(m.split()) == 3 and int(m.split()[-1]) in requested_sectors
|
|
677
|
+
for m in tbl["mission"]
|
|
678
|
+
]
|
|
679
|
+
)
|
|
680
|
+
self._sectors_requested = requested_sectors
|
|
611
681
|
search_result = search_result_all_lcs[mask]
|
|
612
682
|
if len(search_result) == 0:
|
|
613
683
|
if kwargs.get("author", "").upper() == "TGLC":
|
|
@@ -632,7 +702,8 @@ class TessQuickLook:
|
|
|
632
702
|
lc = self._download_with_retry(
|
|
633
703
|
lambda: search_result.download_all(quality_bitmask=self.quality_bitmask).stitch()
|
|
634
704
|
)
|
|
635
|
-
|
|
705
|
+
# only the sectors actually stitched (same pipeline and exptime)
|
|
706
|
+
self.sector = filtered_sectors
|
|
636
707
|
|
|
637
708
|
if self.pipeline in ["spoc"]:
|
|
638
709
|
# exptime = int(lc.meta["EXPOSURE"] / 10) * 10
|
|
@@ -641,7 +712,7 @@ class TessQuickLook:
|
|
|
641
712
|
# estimate exp time
|
|
642
713
|
exptime = int(np.median(np.diff(lc.time.jd)) * 24 * 60 * 60)
|
|
643
714
|
msg = f"Downloaded all {kwargs.get('author')} (exp={exptime} s) lcs "
|
|
644
|
-
msg += f"in sectors {', '.join([str(s) for s in
|
|
715
|
+
msg += f"in sectors {', '.join([str(s) for s in filtered_sectors])}."
|
|
645
716
|
if self.verbose:
|
|
646
717
|
logger.info(msg)
|
|
647
718
|
else:
|
|
@@ -942,7 +1013,7 @@ class TessQuickLook:
|
|
|
942
1013
|
raise InvalidInputError("Provide sector for TESScut download.")
|
|
943
1014
|
|
|
944
1015
|
def _download():
|
|
945
|
-
return lk.search_tesscut(self.query_name, sector=self.
|
|
1016
|
+
return lk.search_tesscut(self.query_name, sector=self._tpf_sector).download(
|
|
946
1017
|
cutout_size=(15, 15), quality_bitmask=self.quality_bitmask
|
|
947
1018
|
)
|
|
948
1019
|
|
|
@@ -1604,7 +1675,7 @@ class TessQuickLook:
|
|
|
1604
1675
|
epoch, period = float(self.toi_epoch[0]), float(self.toi_period[0])
|
|
1605
1676
|
msg = (
|
|
1606
1677
|
f"No transit predicted by the {self.ephem_source} ephem falls "
|
|
1607
|
-
f"within sector {self.
|
|
1678
|
+
f"within sector {self._sector_display()} (BTJD {t_start:.2f}-{t_end:.2f}); "
|
|
1608
1679
|
"nothing to mask."
|
|
1609
1680
|
)
|
|
1610
1681
|
if period > 0:
|
|
@@ -2296,11 +2367,11 @@ class TessQuickLook:
|
|
|
2296
2367
|
logger.warning(
|
|
2297
2368
|
f"TESScut TPF search/download failed ({exc}); falling back to SPOC TPF search..."
|
|
2298
2369
|
)
|
|
2299
|
-
self.tpf = self.get_tpf(sector=self.
|
|
2370
|
+
self.tpf = self.get_tpf(sector=self._tpf_sector, author="SPOC")
|
|
2300
2371
|
self.sap_mask = "pipeline"
|
|
2301
2372
|
else:
|
|
2302
2373
|
self.tpf = self.get_tpf(
|
|
2303
|
-
sector=self.
|
|
2374
|
+
sector=self._tpf_sector,
|
|
2304
2375
|
author=self.pipeline,
|
|
2305
2376
|
)
|
|
2306
2377
|
self.sap_mask = "pipeline"
|
|
@@ -2399,7 +2470,7 @@ class TessQuickLook:
|
|
|
2399
2470
|
title = ""
|
|
2400
2471
|
if self.toiid is not None:
|
|
2401
2472
|
title = f"TOI {self.toiid} | "
|
|
2402
|
-
title += f"TIC {self.ticid} | sector {self.
|
|
2473
|
+
title += f"TIC {self.ticid} | sector {self._sector_display()} | "
|
|
2403
2474
|
lctype = (
|
|
2404
2475
|
f"{self.pipeline.upper()}/{self.flux_type}"
|
|
2405
2476
|
if self.pipeline == "spoc"
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
.gitignore
|
|
2
2
|
.pre-commit-config.yaml
|
|
3
3
|
.readthedocs.yaml
|
|
4
|
+
.release-please-manifest.json
|
|
5
|
+
CHANGELOG.md
|
|
4
6
|
CLAUDE.md
|
|
5
7
|
LICENSE
|
|
6
8
|
LIGHTKURVE_TGLC_BUG_REPORT.txt
|
|
@@ -13,9 +15,11 @@ mkdocs.yml
|
|
|
13
15
|
pyproject.toml
|
|
14
16
|
pytest.ini
|
|
15
17
|
ql.batch
|
|
18
|
+
release-please-config.json
|
|
16
19
|
tox.ini
|
|
17
20
|
uv.lock
|
|
18
21
|
.github/workflows/build-and-test.yml
|
|
22
|
+
.github/workflows/release-please.yml
|
|
19
23
|
.github/workflows/release.yml
|
|
20
24
|
docs/api.md
|
|
21
25
|
docs/batch.md
|
|
@@ -88,6 +92,9 @@ tests/test_notebooks.py
|
|
|
88
92
|
tests/test_phase_xlim.py
|
|
89
93
|
tests/test_rank_filters.py
|
|
90
94
|
tests/test_sanitize_target_name.py
|
|
95
|
+
tests/test_sector_all.py
|
|
96
|
+
tests/test_sectors_list.py
|
|
97
|
+
tests/test_simbad_failure.py
|
|
91
98
|
tests/test_tglc.py
|
|
92
99
|
tests/test_tql.py
|
|
93
100
|
tests/test_use_priors.py
|
{quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook_package.egg-info/scm_file_list.json
RENAMED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": [
|
|
3
3
|
".github/workflows/build-and-test.yml",
|
|
4
|
+
".github/workflows/release-please.yml",
|
|
4
5
|
".github/workflows/release.yml",
|
|
5
6
|
".gitignore",
|
|
6
7
|
".pre-commit-config.yaml",
|
|
7
8
|
".readthedocs.yaml",
|
|
9
|
+
".release-please-manifest.json",
|
|
10
|
+
"CHANGELOG.md",
|
|
8
11
|
"CLAUDE.md",
|
|
9
12
|
"LICENSE",
|
|
10
13
|
"LIGHTKURVE_TGLC_BUG_REPORT.txt",
|
|
@@ -65,6 +68,7 @@
|
|
|
65
68
|
"quicklook/tglc.py",
|
|
66
69
|
"quicklook/tql.py",
|
|
67
70
|
"quicklook/utils.py",
|
|
71
|
+
"release-please-config.json",
|
|
68
72
|
"scripts/screenshot_gui.py",
|
|
69
73
|
"tests/WASP-21_s83_pdcsap_sc.png",
|
|
70
74
|
"tests/conftest.py",
|
|
@@ -80,6 +84,9 @@
|
|
|
80
84
|
"tests/test_phase_xlim.py",
|
|
81
85
|
"tests/test_rank_filters.py",
|
|
82
86
|
"tests/test_sanitize_target_name.py",
|
|
87
|
+
"tests/test_sector_all.py",
|
|
88
|
+
"tests/test_sectors_list.py",
|
|
89
|
+
"tests/test_simbad_failure.py",
|
|
83
90
|
"tests/test_tglc.py",
|
|
84
91
|
"tests/test_tql.py",
|
|
85
92
|
"tests/test_use_priors.py",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
|
|
3
|
+
"bootstrap-sha": "45cf778188a0f0f28c726ed6b019373e19648acf",
|
|
4
|
+
"include-component-in-tag": false,
|
|
5
|
+
"include-v-in-tag": true,
|
|
6
|
+
"packages": {
|
|
7
|
+
".": {
|
|
8
|
+
"release-type": "simple",
|
|
9
|
+
"changelog-path": "CHANGELOG.md"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""`--sector all`: stitch every sector of one pipeline/cadence into one run."""
|
|
2
|
+
|
|
3
|
+
from unittest.mock import patch
|
|
4
|
+
|
|
5
|
+
import pytest
|
|
6
|
+
from typer.testing import CliRunner
|
|
7
|
+
|
|
8
|
+
from quicklook.cli.app import app
|
|
9
|
+
from quicklook.tql import TessQuickLook
|
|
10
|
+
|
|
11
|
+
runner = CliRunner()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _bare_ql(sector):
|
|
15
|
+
ql = object.__new__(TessQuickLook)
|
|
16
|
+
ql.sector = sector
|
|
17
|
+
return ql
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@pytest.mark.parametrize(
|
|
21
|
+
"sector, label",
|
|
22
|
+
[(5, "05"), (65, "65"), ([1, 13, 27], "all"), ((1, 2), "all")],
|
|
23
|
+
)
|
|
24
|
+
def test_sector_label_is_filename_safe(sector, label):
|
|
25
|
+
assert _bare_ql(sector)._sector_label() == label
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@pytest.mark.parametrize(
|
|
29
|
+
"sector, expected",
|
|
30
|
+
[(65, 65), ([1, 13, 27], 27), (None, None)],
|
|
31
|
+
)
|
|
32
|
+
def test_tpf_sector_uses_latest_sector_of_a_stitched_run(sector, expected):
|
|
33
|
+
assert _bare_ql(sector)._tpf_sector == expected
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_sector_display_summarizes_a_stitched_run():
|
|
37
|
+
assert _bare_ql(65)._sector_display() == "65"
|
|
38
|
+
assert _bare_ql([1, 13, 27])._sector_display() == "1-27 (3 sectors)"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def test_cli_sector_all_requires_exptime():
|
|
42
|
+
result = runner.invoke(app, ["run", "--name", "TOI-1234", "--sector", "all"])
|
|
43
|
+
assert result.exit_code == 2
|
|
44
|
+
assert "--exptime" in result.output
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@pytest.mark.parametrize("flag", ["--each-sector", "--each-pipeline"])
|
|
48
|
+
def test_cli_sector_all_conflicts_with_each_flags(flag):
|
|
49
|
+
result = runner.invoke(
|
|
50
|
+
app, ["run", "--name", "TOI-1234", "--sector", "all", "--exptime", "200", flag]
|
|
51
|
+
)
|
|
52
|
+
assert result.exit_code == 2
|
|
53
|
+
assert "--sector all" in result.output
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def test_cli_rejects_non_numeric_sector():
|
|
57
|
+
result = runner.invoke(app, ["run", "--name", "TOI-1234", "--sector", "abc"])
|
|
58
|
+
assert result.exit_code == 2
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
@pytest.mark.parametrize("arg, expected", [("all", "all"), ("ALL", "all"), ("27", 27)])
|
|
62
|
+
def test_cli_passes_parsed_sector_to_tessquicklook(arg, expected):
|
|
63
|
+
with patch("quicklook.tql.TessQuickLook") as tql:
|
|
64
|
+
runner.invoke(
|
|
65
|
+
app,
|
|
66
|
+
["run", "--name", "TOI-1234", "--sector", arg, "--exptime", "200", "--save"],
|
|
67
|
+
)
|
|
68
|
+
assert tql.call_args.kwargs["sector"] == expected
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"""`--sectors 66-68,93`: stitch an explicit set of sectors (e.g. consecutive ones)."""
|
|
2
|
+
|
|
3
|
+
from unittest.mock import patch
|
|
4
|
+
|
|
5
|
+
import numpy as np
|
|
6
|
+
import pytest
|
|
7
|
+
from astropy.table import Table
|
|
8
|
+
from typer.testing import CliRunner
|
|
9
|
+
|
|
10
|
+
from quicklook.cli.app import _parse_sectors, app
|
|
11
|
+
from quicklook.exceptions import NoDataError
|
|
12
|
+
from quicklook.tql import TessQuickLook, format_sector_ranges
|
|
13
|
+
|
|
14
|
+
runner = CliRunner()
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@pytest.mark.parametrize(
|
|
18
|
+
"sectors, text",
|
|
19
|
+
[
|
|
20
|
+
([66, 67, 68], "66-68"),
|
|
21
|
+
([66, 67, 68, 93, 95], "66-68+93+95"),
|
|
22
|
+
([95, 66, 67, 67], "66-67+95"),
|
|
23
|
+
([5], "5"),
|
|
24
|
+
],
|
|
25
|
+
)
|
|
26
|
+
def test_format_sector_ranges_compacts_consecutive_runs(sectors, text):
|
|
27
|
+
assert format_sector_ranges(sectors) == text
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@pytest.mark.parametrize(
|
|
31
|
+
"text, expected",
|
|
32
|
+
[("66-68,93", [66, 67, 68, 93]), ("66, 67", [66, 67]), ("93,66-67,67", [66, 67, 93])],
|
|
33
|
+
)
|
|
34
|
+
def test_parse_sectors(text, expected):
|
|
35
|
+
assert _parse_sectors(text) == expected
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@pytest.mark.parametrize("bad", ["", "a", "68-66", "66-", "0", "-5", "66,,67"])
|
|
39
|
+
def test_parse_sectors_rejects_bad_input(bad):
|
|
40
|
+
import typer
|
|
41
|
+
|
|
42
|
+
with pytest.raises(typer.BadParameter):
|
|
43
|
+
_parse_sectors(bad)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _bare_ql(sector, requested):
|
|
47
|
+
ql = object.__new__(TessQuickLook)
|
|
48
|
+
ql.sector = sector
|
|
49
|
+
ql._sectors_requested = requested
|
|
50
|
+
return ql
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def test_label_and_display_for_requested_subset():
|
|
54
|
+
ql = _bare_ql([66, 67, 68, 93], [66, 67, 68, 93])
|
|
55
|
+
assert ql._sector_label() == "66-68+93"
|
|
56
|
+
assert ql._sector_display() == "66-68, 93 (4 sectors)"
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def test_label_is_all_for_full_stitch():
|
|
60
|
+
assert _bare_ql([1, 13, 27], None)._sector_label() == "all"
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@pytest.mark.parametrize(
|
|
64
|
+
"extra",
|
|
65
|
+
[
|
|
66
|
+
["--sector", "27"],
|
|
67
|
+
["--sectors", "66-67", "--each-sector"],
|
|
68
|
+
["--each-pipeline"],
|
|
69
|
+
],
|
|
70
|
+
)
|
|
71
|
+
def test_cli_sectors_conflicts(extra):
|
|
72
|
+
args = ["run", "--name", "TOI-1234", "--sectors", "66-67", "--exptime", "200"] + extra
|
|
73
|
+
result = runner.invoke(app, args)
|
|
74
|
+
assert result.exit_code == 2
|
|
75
|
+
assert "--sectors" in result.output
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def test_cli_sectors_requires_exptime():
|
|
79
|
+
result = runner.invoke(app, ["run", "--name", "TOI-1234", "--sectors", "66-67"])
|
|
80
|
+
assert result.exit_code == 2
|
|
81
|
+
assert "--exptime" in result.output
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def test_cli_sectors_needs_at_least_two_sectors():
|
|
85
|
+
result = runner.invoke(
|
|
86
|
+
app, ["run", "--name", "TOI-1234", "--sectors", "66", "--exptime", "200"]
|
|
87
|
+
)
|
|
88
|
+
assert result.exit_code == 2
|
|
89
|
+
assert "at least two" in result.output.lower()
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def test_cli_passes_sector_list_to_tessquicklook():
|
|
93
|
+
with patch("quicklook.tql.TessQuickLook") as tql:
|
|
94
|
+
runner.invoke(
|
|
95
|
+
app,
|
|
96
|
+
["run", "--name", "TOI-1234", "--sectors", "66-68", "--exptime", "200", "--save"],
|
|
97
|
+
)
|
|
98
|
+
assert tql.call_args.kwargs["sector"] == [66, 67, 68]
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
class _FakeSearch:
|
|
102
|
+
"""Minimal stand-in for a lightkurve SearchResult."""
|
|
103
|
+
|
|
104
|
+
def __init__(self, table):
|
|
105
|
+
self.table = table
|
|
106
|
+
|
|
107
|
+
def __len__(self):
|
|
108
|
+
return len(self.table)
|
|
109
|
+
|
|
110
|
+
def __getitem__(self, mask):
|
|
111
|
+
return _FakeSearch(self.table[mask])
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def _search(rows):
|
|
115
|
+
return _FakeSearch(
|
|
116
|
+
Table(
|
|
117
|
+
{
|
|
118
|
+
"provenance_name": [r[0] for r in rows],
|
|
119
|
+
"mission": [f"TESS Sector {r[1]:02d}" for r in rows],
|
|
120
|
+
"t_exptime": [float(r[2]) for r in rows],
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def _get_lc_instance():
|
|
127
|
+
ql = object.__new__(TessQuickLook)
|
|
128
|
+
ql.query_name = "TOI-173"
|
|
129
|
+
ql.verbose = False
|
|
130
|
+
ql.quality_bitmask = "default"
|
|
131
|
+
return ql
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def test_get_lc_reports_requested_sectors_missing_at_that_cadence():
|
|
135
|
+
rows = [("QLP", 66, 200), ("QLP", 67, 200), ("QLP", 1, 1800)]
|
|
136
|
+
with patch("quicklook.tql.lk.search_lightcurve", return_value=_search(rows)):
|
|
137
|
+
with pytest.raises(NoDataError, match="68"):
|
|
138
|
+
_get_lc_instance().get_lc(author="QLP", sector=[66, 67, 68], exptime=200)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def test_get_lc_only_downloads_requested_sectors():
|
|
142
|
+
rows = [("QLP", s, 200) for s in (66, 67, 68, 93)] + [("QLP", 1, 1800)]
|
|
143
|
+
captured = {}
|
|
144
|
+
ql = _get_lc_instance()
|
|
145
|
+
|
|
146
|
+
def fake_download(callable_):
|
|
147
|
+
return callable_()
|
|
148
|
+
|
|
149
|
+
class _LC:
|
|
150
|
+
meta = {"AUTHOR": "QLP"}
|
|
151
|
+
time = type("T", (), {"jd": np.arange(0, 1, 200 / 86400)})()
|
|
152
|
+
|
|
153
|
+
def select_flux(self, *_):
|
|
154
|
+
return self
|
|
155
|
+
|
|
156
|
+
class _Stitchable:
|
|
157
|
+
def stitch(self):
|
|
158
|
+
return _LC()
|
|
159
|
+
|
|
160
|
+
class _Result(_FakeSearch):
|
|
161
|
+
def __getitem__(self, mask):
|
|
162
|
+
res = _Result(self.table[mask])
|
|
163
|
+
captured["sectors"] = sorted(int(m.split()[-1]) for m in res.table["mission"])
|
|
164
|
+
return res
|
|
165
|
+
|
|
166
|
+
def download_all(self, **_):
|
|
167
|
+
return _Stitchable()
|
|
168
|
+
|
|
169
|
+
fake = _Result(_search(rows).table)
|
|
170
|
+
ql.flux_type, ql.exptime, ql.flatten_method = "pdcsap", None, "biweight"
|
|
171
|
+
with (
|
|
172
|
+
patch("quicklook.tql.lk.search_lightcurve", return_value=fake),
|
|
173
|
+
patch.object(TessQuickLook, "_download_with_retry", side_effect=fake_download),
|
|
174
|
+
):
|
|
175
|
+
try:
|
|
176
|
+
ql.get_lc(author="QLP", sector=[66, 67, 68], exptime=200)
|
|
177
|
+
except Exception:
|
|
178
|
+
pass # only the sector selection is under test
|
|
179
|
+
assert captured["sectors"] == [66, 67, 68]
|
|
180
|
+
assert ql.sector == [66, 67, 68]
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"""SIMBAD is optional metadata: an unreachable service must not abort a run."""
|
|
2
|
+
|
|
3
|
+
from unittest.mock import patch
|
|
4
|
+
|
|
5
|
+
import pytest
|
|
6
|
+
|
|
7
|
+
from quicklook.tql import TessQuickLook
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _bare_ql():
|
|
11
|
+
ql = object.__new__(TessQuickLook)
|
|
12
|
+
ql.star_names = ["TOI-137", "TIC 1234"]
|
|
13
|
+
ql.target_name = "TOI-137"
|
|
14
|
+
ql.verbose = False
|
|
15
|
+
return ql
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@pytest.mark.parametrize("failing", ["add_votable_fields", "query_object"])
|
|
19
|
+
def test_query_simbad_returns_none_when_service_unavailable(failing):
|
|
20
|
+
# Arrange
|
|
21
|
+
ql = _bare_ql()
|
|
22
|
+
with patch("quicklook.tql.Simbad") as simbad:
|
|
23
|
+
getattr(simbad, failing).side_effect = RuntimeError("Connection failed")
|
|
24
|
+
|
|
25
|
+
# Act
|
|
26
|
+
result = ql.query_simbad()
|
|
27
|
+
|
|
28
|
+
# Assert
|
|
29
|
+
assert result is None
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def test_get_simbad_obj_type_is_none_when_service_unavailable():
|
|
33
|
+
# Arrange
|
|
34
|
+
ql = _bare_ql()
|
|
35
|
+
with patch("quicklook.tql.Simbad") as simbad:
|
|
36
|
+
simbad.add_votable_fields.side_effect = RuntimeError("Connection failed")
|
|
37
|
+
|
|
38
|
+
# Act
|
|
39
|
+
result = ql.get_simbad_obj_type()
|
|
40
|
+
|
|
41
|
+
# Assert
|
|
42
|
+
assert result is None
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def test_query_simbad_returns_first_resolved_result():
|
|
46
|
+
# Arrange
|
|
47
|
+
ql = _bare_ql()
|
|
48
|
+
with patch("quicklook.tql.Simbad") as simbad:
|
|
49
|
+
simbad.query_object.side_effect = [None, "table"]
|
|
50
|
+
|
|
51
|
+
# Act
|
|
52
|
+
result = ql.query_simbad()
|
|
53
|
+
|
|
54
|
+
# Assert
|
|
55
|
+
assert result == "table"
|
|
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
|
|
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
|
{quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/app/templates/partials/_components.html
RENAMED
|
File without changes
|
{quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook/app/templates/partials/topbar.html
RENAMED
|
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
|
{quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook_package.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{quicklook_package-1.6 → quicklook_package-1.7.0}/quicklook_package.egg-info/entry_points.txt
RENAMED
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|