Skip to content

Commit b4bb517

Browse files
authored
Merge pull request #2058 from pypeit/deprecate_linetools
Deprecate linetools
2 parents f221c38 + d8890e1 commit b4bb517

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+3463
-1576
lines changed

.github/workflows/ci_cron.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
matrix:
1717
os: [ubuntu-latest]
1818
python: ['3.11', '3.12', '3.13']
19-
toxenv: [test, test-alldeps-cov, test-numpydev, test-linetoolsdev, test-gingadev, test-astropydev]
19+
toxenv: [test, test-alldeps-cov, test-numpydev, test-gingadev, test-astropydev]
2020
steps:
2121
- name: Check out repository
2222
uses: actions/checkout@v3

.github/workflows/ci_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
matrix:
1919
os: [ubuntu-latest]
2020
python: ['3.11', '3.12', '3.13']
21-
toxenv: [test, test-alldeps-cov, test-numpydev, test-linetoolsdev, test-gingadev, test-astropydev]
21+
toxenv: [test, test-alldeps-cov, test-numpydev, test-gingadev, test-astropydev]
2222
steps:
2323
- name: Check out repository
2424
uses: actions/checkout@v3

CLAUDE.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# PypeIt
2+
3+
PypeIt is a pure Python package for processing raw spectroscopic data from
4+
astronomical telescopes into calibrated spectra for scientific analysis.
5+
6+
## Development Setup
7+
8+
- Create and activate a fresh python environment
9+
10+
- Clone your fork of the main pypeit repo, hosted at
11+
[GitHub](https://github.com/pypeit/PypeIt), and add a remote git connection to
12+
the main repo called `upstream`.
13+
14+
- Install pypeit using the zshell (or bash equivalent) command `pip install -e ".[dev]"`.
15+
16+
- Create a new git branch, where simple bug fixes branch from `release` and all
17+
other development branches from `develop`.
18+
19+
- Frequently fetch changes to the upstream base branch (`release` or `develop`)
20+
and rebase, as necessary.
21+
22+
- Additional development guidelines is provided in `doc/dev/development.rst`.
23+
24+
## Key Architectural Components
25+
26+
- PypeIt implements three primary processing paths, depending on the format of
27+
the spectrograph used to collect the raw data:
28+
29+
- **MultiSlit**: Standard long-slit and multi-slit spectrographs
30+
- **Echelle**: Cross-dispersed echelle spectrographs
31+
- **SlicerIFU**: Slicer-based integral-field units
32+
33+
- Instrument specifications and data-processing considerations that are specific
34+
to each spectrograph (including the processing path that should be used) are
35+
isolated in their respective spectrograph classes, all of which inherit from
36+
`pypeit.spectrographs.spectrograph.Spectrograph`.
37+
38+
- Users primarily modify the code performance via user-level parameters held by
39+
the `pypeit.par.pypeitpar.PypeItPar` class, which packages the hierarchy of
40+
parameter sets used throughout the code.
41+
42+
- Core processing modules, particularly for calibrations, produce FITS files
43+
that are saved to disk and reused as necessary. These modules commonly use
44+
`pypeit.datamodel.DataContainer` as a base class to enforce strict adherence
45+
to a well-defined datamodel and to provide a common IO interface.
46+
47+
- Significant portions of the `pypeit/data` directory are not included in the
48+
package distribution of the code, but rely on a cache system that downloads
49+
files as needed for processing.
50+
51+
## Testing
52+
53+
- All tests are collected in the `pypeit/tests` directory.
54+
55+
- Tests in `pypeit/tests` should be limited to unit tests that do not require
56+
the use of large data files.
57+
58+
- Tests should be deterministic; i.e., all random-number generators should use a
59+
fixed seed.
60+
61+
- Test coverage is supplemented by the PypeIt development suite, hosted at
62+
https://github.com/pypeit/PypeIt-development-suite, which requires data files
63+
hosted on Google Drive; see README.rst for the link.
64+
65+
## Documentation
66+
67+
- All functions and classes, except for tests in `pypeit/tests` should include
68+
docstrings that explain their purpose, input arguments, and output objects.
69+
70+
- The docstring style is currently not consistent within the repository, but
71+
Numpy style docstrings are preferred; see
72+
https://www.sphinx-doc.org/en/master/usage/extensions/example_numpy.html
73+
74+
- Package documentation for users is held in the `doc` directory, which is built
75+
using Sphinx and hosted on ReadTheDocs at https://pypeit.readthedocs.io/.
76+
77+
- A complete rebuild of the documentation is performed by executing the bash
78+
command `cd doc; make clean ; make html`. This requires access to the
79+
internet and the `PYPEIT_DEV` environmental variable, which points to the
80+
directory containing containing the `RAW_DATA` directory copied from the
81+
PypeIt development suite Google Drive (see "Testing" above). If these
82+
requirements are not met, a limited rebuild of the documentation can be
83+
achieved by executing `cd doc ; make htmlonly`.
84+
85+
- Documentation should be updated with each GitHub pull request.
86+
87+
## Usage
88+
89+
- Users interact with the code base via execution of the command-line scripts
90+
found in `pypeit/scripts`.
91+
92+
- The primary data-processing script is `run_pypeit.py`, which primarily
93+
instantiates the `pypeit.pypeit.PypeIt` class and runs its methods.
94+
95+
## External Resources
96+
97+
- **Documentation**: https://pypeit.readthedocs.io/
98+
- **Development Suite**: https://github.com/pypeit/PypeIt-development-suite
99+

doc/api/pypeit.core.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Submodules
4242
pypeit.core.pydl
4343
pypeit.core.qa
4444
pypeit.core.scattlight
45+
pypeit.core.skyspec
4546
pypeit.core.skysub
4647
pypeit.core.slitdesign_matching
4748
pypeit.core.spectrum

doc/api/pypeit.core.skyspec.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
pypeit.core.skyspec module
2+
==========================
3+
4+
.. automodule:: pypeit.core.skyspec
5+
:members:
6+
:private-members:
7+
:show-inheritance:
8+
:undoc-members:

doc/claude/shane_kast_blue.md

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# PypeIt Reduction with Claude: Shane Kast Blue Example
2+
3+
This document describes a workflow using Claude to reduce spectroscopic data from the Shane Kast Blue spectrograph using PypeIt.
4+
5+
## Initial Prompt
6+
7+
Here was the prompt given to Claude:
8+
9+
> In `/home/xavier/Projects/PypeIt/PypeIt-development-suite/RAW_DATA/shane_kast_blue/600_4310_d55` is a set of raw FITS files for the shane_kast_blue spectrograph. Please use the PypeIt code base to generate a PypeIt file. Do your work in `/home/xavier/Projects/PypeIt/PypeIt_Redux/Claude/shane_kast_blue`. If you run python or any scripts, use the "pypeit" environment in conda.
10+
11+
---
12+
13+
## Step 1: PypeIt File Generation
14+
15+
### Summary
16+
17+
Claude successfully generated a PypeIt file for the shane_kast_blue spectrograph data.
18+
19+
### Location
20+
21+
The PypeIt file is located at: `shane_kast_blue_A.pypeit`
22+
23+
### Configuration Details
24+
25+
- **Setup:** A (600/4310 grating with d55 dichroic)
26+
- **Total files:** 25 raw FITS files
27+
28+
### File Classification
29+
30+
The setup identified:
31+
32+
| Frame Type | Files | Description |
33+
|------------|-------|-------------|
34+
| Arc | b1.fits.gz | For wavelength calibration |
35+
| Bias | b14-b23.fits.gz | 10 bias frames |
36+
| Flat | b3-b13.fits.gz | 10 frames (pixel flat, illumination flat, and trace) |
37+
| Science | b27-b28.fits.gz | 2 frames (target: J1217p3905, 1200s exposures) |
38+
| Standard | b24.fits.gz | Feige 66, 30s exposure |
39+
40+
---
41+
42+
## Step 2: Running the Reduction
43+
44+
### Prompt
45+
46+
> Please go ahead and execute the reduction
47+
48+
### Command
49+
50+
```bash
51+
conda run -n pypeit run_pypeit shane_kast_blue_A.pypeit
52+
```
53+
54+
### Result
55+
56+
**Reduction Complete!** The PypeIt reduction finished successfully in 1 minute 38 seconds.
57+
58+
---
59+
60+
## Reduction Output Summary
61+
62+
### Science Products (`Science/`)
63+
64+
#### 1D Extracted Spectra
65+
66+
- `spec1d_b24-Feige66_KASTb_20150520T041246.960.fits` - Standard star (Feige 66)
67+
- `spec1d_b27-J1217p3905_KASTb_20150520T045733.560.fits` - Science target (first exposure)
68+
- `spec1d_b28-J1217p3905_KASTb_20150520T051801.470.fits` - Science target (second exposure)
69+
70+
#### 2D Reduced Spectra
71+
72+
- `spec2d_b24-Feige66_KASTb_20150520T041246.960.fits` (27 MB)
73+
- `spec2d_b27-J1217p3905_KASTb_20150520T045733.560.fits` (27 MB)
74+
- `spec2d_b28-J1217p3905_KASTb_20150520T051801.470.fits` (27 MB)
75+
76+
### Calibration Files (`Calibrations/`)
77+
78+
| File | Description |
79+
|------|-------------|
80+
| `Arc_A_0_DET01.fits` | Arc line image for wavelength calibration |
81+
| `Bias_A_0_DET01.fits` | Master bias frame |
82+
| `Flat_A_0_DET01.fits` | Master flat field |
83+
| `Edges_A_0_DET01.fits.gz` | Slit edge traces |
84+
| `Slits_A_0_DET01.fits.gz` | Slit information |
85+
| `Tilts_A_0_DET01.fits` | Spectral tilt solution |
86+
| `WaveCalib_A_0_DET01.fits` | Wavelength calibration solution |
87+
88+
### Quality Assurance (`QA/`)
89+
90+
- HTML reports for each exposure (b24, b27, b28)
91+
- Master Frame QA report (`MF_A.html`)
92+
- PNG diagnostic plots in the `QA/PNGs/` directory
93+
94+
### Key Features
95+
96+
- Successfully extracted 1 object from each science frame
97+
- Applied heliocentric correction (-22.46 km/s)
98+
- Performed spectral flexure correction (-0.023 pixels)
99+
- All spectra are wavelength calibrated and sky subtracted
100+
101+
You can view the QA HTML files in a browser to inspect the quality of the reduction.
102+
103+
---
104+
105+
## Step 3: Analysis Notebook
106+
107+
### Prompt
108+
109+
> Now generate a Jupyter Notebook describing the outputs and comment on the quality of the reduction.
110+
111+
### Result
112+
113+
Claude created a comprehensive Jupyter notebook that analyzes the PypeIt reduction outputs.
114+
115+
### Notebook Location
116+
117+
`shane_kast_blue_analysis.ipynb`
118+
119+
### Contents
120+
121+
#### 1. Introduction
122+
- Overview of the observation details and configuration
123+
- Summary of calibration frames used
124+
125+
#### 2. Calibration Quality Assessment
126+
- Master bias frame analysis (statistics and visualization)
127+
- Normalized pixel flat examination
128+
- Slit edge detection results
129+
- Wavelength calibration coverage
130+
131+
#### 3. Two-Dimensional Spectra
132+
- Standard star (Feige 66) 2D spectrum display
133+
- Science target (J1217+3905) 2D spectra for both exposures
134+
- Sky model visualizations
135+
- Spatial and spectral profile plots
136+
137+
#### 4. One-Dimensional Extracted Spectra
138+
- Standard star 1D spectrum with S/N analysis
139+
- Science target spectra for both exposures
140+
- Comparison between exposures
141+
- Sky subtraction quality assessment
142+
143+
#### 5. Quality Assessment Summary
144+
- Automated quality metrics calculation
145+
- Detailed assessment of:
146+
- Calibration quality (bias, flat, wavelength)
147+
- Science data quality (S/N ratios)
148+
- Sky subtraction performance
149+
- Consistency between exposures
150+
- Overall reduction quality rating
151+
152+
#### 6. Conclusions and Next Steps
153+
- Summary of reduction quality
154+
- Recommended next steps (flux calibration, coaddition)
155+
- List of ready-to-use data products
156+
157+
### To Run the Notebook
158+
159+
```bash
160+
cd /home/xavier/Projects/PypeIt/PypeIt_Redux/Claude/shane_kast_blue
161+
conda run -n pypeit jupyter notebook shane_kast_blue_analysis.ipynb
162+
```
163+
164+
The notebook includes detailed visualizations and quantitative assessments that will help you understand the quality of the reduction and identify any potential issues. All analysis is ready to run and will provide comprehensive diagnostics of your Shane Kast Blue spectroscopic data reduction.

doc/claude/shane_kast_blue_analysis.ipynb

Lines changed: 1170 additions & 0 deletions
Large diffs are not rendered by default.

doc/coadd1d.rst

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,7 @@ that its file extensions are:
295295

296296
.. include:: include/datamodel_onespec.rst
297297

298-
You view the spectrum using the ``lt_xspec`` script
299-
(``pypeit_show_1dspec`` will not work), which loads the data
300-
and launches a GUI from the `linetools`_ package. e.g.:
301-
302-
.. code-block:: console
303-
304-
lt_xspec J1217p3905_coadd.fits
298+
To view the coadded spectrum, using :ref:`pypeit_show_1dspec`.
305299

306300
UVES_popler coaddition
307301
======================

doc/dev/development.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,8 +502,8 @@ can do:
502502
cd $PYPEIT_DIR
503503
tox -e py312-test-astropydev
504504
505-
Similar ``dev`` dependencies are configured for ``numpy``, ``ginga``, and
506-
``linetools``, as well.
505+
Similar ``dev`` dependencies are configured for ``numpy`` and ``ginga``, as
506+
well.
507507

508508
Unit tests included in the main PypeIt repo should *not* require large data
509509
files. Some files are kept in the repo for this purpose (see the

doc/figures/deimos_spec1d.png

177 KB
Loading

0 commit comments

Comments
 (0)