fitscube 2.8.0__tar.gz → 2.10.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.
- {fitscube-2.8.0 → fitscube-2.10.0}/PKG-INFO +101 -14
- {fitscube-2.8.0 → fitscube-2.10.0}/README.md +100 -13
- {fitscube-2.8.0 → fitscube-2.10.0}/fitscube/_version.py +2 -2
- {fitscube-2.8.0 → fitscube-2.10.0}/fitscube/bounding_box.py +2 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/fitscube/cli.py +20 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/fitscube/combine_fits.py +161 -81
- fitscube-2.10.0/fitscube/compress.py +634 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/fitscube/extract.py +99 -25
- {fitscube-2.8.0 → fitscube-2.10.0}/tests/test_combine_guards.py +170 -0
- fitscube-2.10.0/tests/test_compress.py +234 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/tests/test_extract.py +170 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/tests/test_frequencies.py +26 -1
- {fitscube-2.8.0 → fitscube-2.10.0}/tests/test_times.py +39 -1
- fitscube-2.8.0/tests/test_compress.py +0 -39
- {fitscube-2.8.0 → fitscube-2.10.0}/.github/CONTRIBUTING.md +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/.github/dependabot.yml +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/.github/release.yml +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/.github/workflows/cd.yml +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/.github/workflows/ci.yml +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/.gitignore +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/.pre-commit-config.yaml +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/CHANGELOG.md +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/LICENSE +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/fitscube/__init__.py +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/fitscube/asyncio.py +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/fitscube/exceptions.py +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/fitscube/logging.py +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/fitscube/version.pyi +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/noxfile.py +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/pyproject.toml +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/tests/__init__.py +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/tests/conftest.py +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/tests/data/cube.zip +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/tests/data/images.zip +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/tests/data/time_images.zip +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/tests/data/timecube.zip +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/tests/test_bb.py +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/tests/test_combine.py +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/tests/test_combine_layouts.py +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/tests/test_package.py +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/tests/test_zero_beams.py +0 -0
- {fitscube-2.8.0 → fitscube-2.10.0}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: fitscube
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.10.0
|
|
4
4
|
Summary: A package to produce produce FITS cubes.
|
|
5
5
|
Project-URL: Homepage, https://github.com/AlecThomson/fitscube
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/AlecThomson/fitscube/issues
|
|
@@ -151,17 +151,19 @@ Command line:
|
|
|
151
151
|
|
|
152
152
|
```
|
|
153
153
|
❯ fitscube -h
|
|
154
|
-
usage: fitscube [-h] {combine,extract} ...
|
|
154
|
+
usage: fitscube [-h] {combine,extract,compress,decompress} ...
|
|
155
155
|
|
|
156
156
|
Tooling to create fitscubes
|
|
157
157
|
|
|
158
158
|
positional arguments:
|
|
159
|
-
{combine,extract}
|
|
160
|
-
combine
|
|
161
|
-
extract
|
|
159
|
+
{combine,extract,compress,decompress}
|
|
160
|
+
combine Combine FITS images together into a cube
|
|
161
|
+
extract Extract a plane from an existing cube
|
|
162
|
+
compress Compress a cube to .fits.gz or .fits.fz
|
|
163
|
+
decompress Turn a .fits.gz or .fits.fz cube back into plain FITS
|
|
162
164
|
|
|
163
165
|
options:
|
|
164
|
-
-h, --help
|
|
166
|
+
-h, --help show this help message and exit
|
|
165
167
|
```
|
|
166
168
|
|
|
167
169
|
```
|
|
@@ -169,8 +171,9 @@ options:
|
|
|
169
171
|
usage: fitscube combine [-h] [-o] [--create-blanks] [--time-domain]
|
|
170
172
|
[--spec-file SPEC_FILE | --specs SPECS [SPECS ...] | --ignore-spec] [-v]
|
|
171
173
|
[--max-workers MAX_WORKERS] [--bounding-box] [--invalidate-zeros]
|
|
172
|
-
[--no-blank-zero-beams] [--floating {
|
|
173
|
-
[--compress-method {gzip,pgzip}]
|
|
174
|
+
[--no-blank-zero-beams] [--floating {32,64}] [--compress]
|
|
175
|
+
[--compress-method {gzip,pgzip,tile-gzip,tile-rice}]
|
|
176
|
+
[--quantize-level QUANTIZE_LEVEL]
|
|
174
177
|
file_list [file_list ...] out_cube
|
|
175
178
|
|
|
176
179
|
positional arguments:
|
|
@@ -199,14 +202,19 @@ options:
|
|
|
199
202
|
Keep images whose restoring beam is exactly zero. By default such images
|
|
200
203
|
are blanked with NaNs, as a zero beam means no PSF was fitted for that
|
|
201
204
|
plane (e.g. a wsclean model image planted by -fit-spectral-pol)
|
|
202
|
-
--floating {
|
|
205
|
+
--floating {32,64}
|
|
203
206
|
The number of floating point bits to use in the out cube. If None the
|
|
204
207
|
input data precision is used.
|
|
205
|
-
--compress
|
|
206
|
-
--compress-method {gzip,pgzip}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
'pgzip' extra
|
|
208
|
+
--compress Compress the output cube once written
|
|
209
|
+
--compress-method {gzip,pgzip,tile-gzip,tile-rice}
|
|
210
|
+
How --compress compresses. 'gzip' and 'pgzip' gzip the whole file to
|
|
211
|
+
.fits.gz; 'pgzip' parallelizes across --max-workers threads but requires
|
|
212
|
+
the 'pgzip' extra. 'tile-gzip' (lossless) and 'tile-rice' (lossy, see
|
|
213
|
+
--quantize-level) tile-compress to .fits.fz, as fpack does, so single
|
|
214
|
+
planes can be read without decompressing the whole cube
|
|
215
|
+
--quantize-level QUANTIZE_LEVEL
|
|
216
|
+
Quantization steps per noise sigma for 'tile-rice'. Higher keeps more
|
|
217
|
+
precision and compresses less
|
|
210
218
|
```
|
|
211
219
|
|
|
212
220
|
```
|
|
@@ -228,6 +236,45 @@ options:
|
|
|
228
236
|
The name of the new output file. If not specified it is generated from the fits cube name
|
|
229
237
|
```
|
|
230
238
|
|
|
239
|
+
```
|
|
240
|
+
❯ fitscube compress -h
|
|
241
|
+
usage: fitscube compress [-h] [--method {gzip,pgzip,tile-gzip,tile-rice}]
|
|
242
|
+
[--quantize-level QUANTIZE_LEVEL] [--max-workers MAX_WORKERS]
|
|
243
|
+
[--allow-requantize] [--remove] [-v]
|
|
244
|
+
cube
|
|
245
|
+
|
|
246
|
+
positional arguments:
|
|
247
|
+
cube An uncompressed FITS cube
|
|
248
|
+
|
|
249
|
+
options:
|
|
250
|
+
-h, --help show this help message and exit
|
|
251
|
+
--method {gzip,pgzip,tile-gzip,tile-rice}
|
|
252
|
+
'gzip'/'pgzip' gzip the whole file to .fits.gz. 'tile-gzip' (lossless) and
|
|
253
|
+
'tile-rice' (lossy) tile-compress to .fits.fz, as fpack does
|
|
254
|
+
--quantize-level QUANTIZE_LEVEL
|
|
255
|
+
Quantization steps per noise sigma for 'tile-rice'
|
|
256
|
+
--max-workers MAX_WORKERS
|
|
257
|
+
Compression threads
|
|
258
|
+
--allow-requantize Let 'tile-rice' quantize a cube that was already quantized once
|
|
259
|
+
--remove Delete the input once done
|
|
260
|
+
-v, --verbosity Increase output verbosity
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
```
|
|
264
|
+
❯ fitscube decompress -h
|
|
265
|
+
usage: fitscube decompress [-h] [-o OUTPUT] [--overwrite] [--remove] [-v] cube
|
|
266
|
+
|
|
267
|
+
positional arguments:
|
|
268
|
+
cube A .fits.gz or tile-compressed .fits.fz cube
|
|
269
|
+
|
|
270
|
+
options:
|
|
271
|
+
-h, --help show this help message and exit
|
|
272
|
+
-o, --output OUTPUT Output path. Defaults to the input without .gz/.fz
|
|
273
|
+
--overwrite Replace the output if it exists
|
|
274
|
+
--remove Delete the compressed input once done
|
|
275
|
+
-v, --verbosity Increase output verbosity
|
|
276
|
+
```
|
|
277
|
+
|
|
231
278
|
Python:
|
|
232
279
|
|
|
233
280
|
```python
|
|
@@ -242,6 +289,46 @@ frequencies = combine_fits(
|
|
|
242
289
|
)
|
|
243
290
|
```
|
|
244
291
|
|
|
292
|
+
## Compressed cubes
|
|
293
|
+
|
|
294
|
+
`fitscube compress`, or `combine --compress`, writes the cube in one of three ways:
|
|
295
|
+
|
|
296
|
+
| Method | Output | |
|
|
297
|
+
|---|---|---|
|
|
298
|
+
| `gzip`, `pgzip` | `.fits.gz` | The whole file gzipped. Lossless. |
|
|
299
|
+
| `tile-gzip` | `.fits.fz` | [Tile compressed](https://heasarc.gsfc.nasa.gov/fitsio/fpack/) with GZIP_2. Lossless. |
|
|
300
|
+
| `tile-rice` | `.fits.fz` | Tile compressed with RICE_1, after quantising to `--quantize-level` steps per noise sigma. Lossy. |
|
|
301
|
+
|
|
302
|
+
`.fits.fz` files are what `fpack` writes, so DS9, CARTA, `funpack` and astropy can all
|
|
303
|
+
read them. The image is in HDU 1, and `.section` only decompresses the tiles it needs:
|
|
304
|
+
|
|
305
|
+
```python
|
|
306
|
+
from astropy.io import fits
|
|
307
|
+
|
|
308
|
+
with fits.open("cube.fits.fz") as hdul:
|
|
309
|
+
plane = hdul[1].section[10]
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
`.data` and `fits.getdata` decompress the whole cube into memory, for both `.fits.gz`
|
|
313
|
+
and `.fits.fz`. A `.fits.gz` cube has no cheap way to read part of it. CARTA (6.0) also
|
|
314
|
+
reads the whole cube into memory when it opens either kind, so decompress large cubes
|
|
315
|
+
before viewing them there.
|
|
316
|
+
|
|
317
|
+
To compress an existing cube, and to get plain FITS back:
|
|
318
|
+
|
|
319
|
+
```
|
|
320
|
+
fitscube compress cube.fits --method tile-rice
|
|
321
|
+
fitscube decompress cube.fits.fz
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
`funpack` works too, though `funpack` from CFITSIO 4.3.1 mis-decodes RICE files whose
|
|
325
|
+
tiles are narrower than a row. fitscube always writes full-width tiles.
|
|
326
|
+
|
|
327
|
+
Quantise once. Every decompress and recompress with `tile-rice` adds a new error, so
|
|
328
|
+
`fitscube decompress` marks lossy cubes with `FCLOSSY`, and `tile-rice` refuses them
|
|
329
|
+
unless given `allow_requantize=True`. Smooth images such as weights do not shrink under
|
|
330
|
+
RICE; use `tile-gzip` for them.
|
|
331
|
+
|
|
245
332
|
## Zero-sized beams
|
|
246
333
|
|
|
247
334
|
wsclean writes `BMAJ = BMIN = 0` into an image when no PSF was fitted for that
|
|
@@ -78,17 +78,19 @@ Command line:
|
|
|
78
78
|
|
|
79
79
|
```
|
|
80
80
|
❯ fitscube -h
|
|
81
|
-
usage: fitscube [-h] {combine,extract} ...
|
|
81
|
+
usage: fitscube [-h] {combine,extract,compress,decompress} ...
|
|
82
82
|
|
|
83
83
|
Tooling to create fitscubes
|
|
84
84
|
|
|
85
85
|
positional arguments:
|
|
86
|
-
{combine,extract}
|
|
87
|
-
combine
|
|
88
|
-
extract
|
|
86
|
+
{combine,extract,compress,decompress}
|
|
87
|
+
combine Combine FITS images together into a cube
|
|
88
|
+
extract Extract a plane from an existing cube
|
|
89
|
+
compress Compress a cube to .fits.gz or .fits.fz
|
|
90
|
+
decompress Turn a .fits.gz or .fits.fz cube back into plain FITS
|
|
89
91
|
|
|
90
92
|
options:
|
|
91
|
-
-h, --help
|
|
93
|
+
-h, --help show this help message and exit
|
|
92
94
|
```
|
|
93
95
|
|
|
94
96
|
```
|
|
@@ -96,8 +98,9 @@ options:
|
|
|
96
98
|
usage: fitscube combine [-h] [-o] [--create-blanks] [--time-domain]
|
|
97
99
|
[--spec-file SPEC_FILE | --specs SPECS [SPECS ...] | --ignore-spec] [-v]
|
|
98
100
|
[--max-workers MAX_WORKERS] [--bounding-box] [--invalidate-zeros]
|
|
99
|
-
[--no-blank-zero-beams] [--floating {
|
|
100
|
-
[--compress-method {gzip,pgzip}]
|
|
101
|
+
[--no-blank-zero-beams] [--floating {32,64}] [--compress]
|
|
102
|
+
[--compress-method {gzip,pgzip,tile-gzip,tile-rice}]
|
|
103
|
+
[--quantize-level QUANTIZE_LEVEL]
|
|
101
104
|
file_list [file_list ...] out_cube
|
|
102
105
|
|
|
103
106
|
positional arguments:
|
|
@@ -126,14 +129,19 @@ options:
|
|
|
126
129
|
Keep images whose restoring beam is exactly zero. By default such images
|
|
127
130
|
are blanked with NaNs, as a zero beam means no PSF was fitted for that
|
|
128
131
|
plane (e.g. a wsclean model image planted by -fit-spectral-pol)
|
|
129
|
-
--floating {
|
|
132
|
+
--floating {32,64}
|
|
130
133
|
The number of floating point bits to use in the out cube. If None the
|
|
131
134
|
input data precision is used.
|
|
132
|
-
--compress
|
|
133
|
-
--compress-method {gzip,pgzip}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
'pgzip' extra
|
|
135
|
+
--compress Compress the output cube once written
|
|
136
|
+
--compress-method {gzip,pgzip,tile-gzip,tile-rice}
|
|
137
|
+
How --compress compresses. 'gzip' and 'pgzip' gzip the whole file to
|
|
138
|
+
.fits.gz; 'pgzip' parallelizes across --max-workers threads but requires
|
|
139
|
+
the 'pgzip' extra. 'tile-gzip' (lossless) and 'tile-rice' (lossy, see
|
|
140
|
+
--quantize-level) tile-compress to .fits.fz, as fpack does, so single
|
|
141
|
+
planes can be read without decompressing the whole cube
|
|
142
|
+
--quantize-level QUANTIZE_LEVEL
|
|
143
|
+
Quantization steps per noise sigma for 'tile-rice'. Higher keeps more
|
|
144
|
+
precision and compresses less
|
|
137
145
|
```
|
|
138
146
|
|
|
139
147
|
```
|
|
@@ -155,6 +163,45 @@ options:
|
|
|
155
163
|
The name of the new output file. If not specified it is generated from the fits cube name
|
|
156
164
|
```
|
|
157
165
|
|
|
166
|
+
```
|
|
167
|
+
❯ fitscube compress -h
|
|
168
|
+
usage: fitscube compress [-h] [--method {gzip,pgzip,tile-gzip,tile-rice}]
|
|
169
|
+
[--quantize-level QUANTIZE_LEVEL] [--max-workers MAX_WORKERS]
|
|
170
|
+
[--allow-requantize] [--remove] [-v]
|
|
171
|
+
cube
|
|
172
|
+
|
|
173
|
+
positional arguments:
|
|
174
|
+
cube An uncompressed FITS cube
|
|
175
|
+
|
|
176
|
+
options:
|
|
177
|
+
-h, --help show this help message and exit
|
|
178
|
+
--method {gzip,pgzip,tile-gzip,tile-rice}
|
|
179
|
+
'gzip'/'pgzip' gzip the whole file to .fits.gz. 'tile-gzip' (lossless) and
|
|
180
|
+
'tile-rice' (lossy) tile-compress to .fits.fz, as fpack does
|
|
181
|
+
--quantize-level QUANTIZE_LEVEL
|
|
182
|
+
Quantization steps per noise sigma for 'tile-rice'
|
|
183
|
+
--max-workers MAX_WORKERS
|
|
184
|
+
Compression threads
|
|
185
|
+
--allow-requantize Let 'tile-rice' quantize a cube that was already quantized once
|
|
186
|
+
--remove Delete the input once done
|
|
187
|
+
-v, --verbosity Increase output verbosity
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
❯ fitscube decompress -h
|
|
192
|
+
usage: fitscube decompress [-h] [-o OUTPUT] [--overwrite] [--remove] [-v] cube
|
|
193
|
+
|
|
194
|
+
positional arguments:
|
|
195
|
+
cube A .fits.gz or tile-compressed .fits.fz cube
|
|
196
|
+
|
|
197
|
+
options:
|
|
198
|
+
-h, --help show this help message and exit
|
|
199
|
+
-o, --output OUTPUT Output path. Defaults to the input without .gz/.fz
|
|
200
|
+
--overwrite Replace the output if it exists
|
|
201
|
+
--remove Delete the compressed input once done
|
|
202
|
+
-v, --verbosity Increase output verbosity
|
|
203
|
+
```
|
|
204
|
+
|
|
158
205
|
Python:
|
|
159
206
|
|
|
160
207
|
```python
|
|
@@ -169,6 +216,46 @@ frequencies = combine_fits(
|
|
|
169
216
|
)
|
|
170
217
|
```
|
|
171
218
|
|
|
219
|
+
## Compressed cubes
|
|
220
|
+
|
|
221
|
+
`fitscube compress`, or `combine --compress`, writes the cube in one of three ways:
|
|
222
|
+
|
|
223
|
+
| Method | Output | |
|
|
224
|
+
|---|---|---|
|
|
225
|
+
| `gzip`, `pgzip` | `.fits.gz` | The whole file gzipped. Lossless. |
|
|
226
|
+
| `tile-gzip` | `.fits.fz` | [Tile compressed](https://heasarc.gsfc.nasa.gov/fitsio/fpack/) with GZIP_2. Lossless. |
|
|
227
|
+
| `tile-rice` | `.fits.fz` | Tile compressed with RICE_1, after quantising to `--quantize-level` steps per noise sigma. Lossy. |
|
|
228
|
+
|
|
229
|
+
`.fits.fz` files are what `fpack` writes, so DS9, CARTA, `funpack` and astropy can all
|
|
230
|
+
read them. The image is in HDU 1, and `.section` only decompresses the tiles it needs:
|
|
231
|
+
|
|
232
|
+
```python
|
|
233
|
+
from astropy.io import fits
|
|
234
|
+
|
|
235
|
+
with fits.open("cube.fits.fz") as hdul:
|
|
236
|
+
plane = hdul[1].section[10]
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
`.data` and `fits.getdata` decompress the whole cube into memory, for both `.fits.gz`
|
|
240
|
+
and `.fits.fz`. A `.fits.gz` cube has no cheap way to read part of it. CARTA (6.0) also
|
|
241
|
+
reads the whole cube into memory when it opens either kind, so decompress large cubes
|
|
242
|
+
before viewing them there.
|
|
243
|
+
|
|
244
|
+
To compress an existing cube, and to get plain FITS back:
|
|
245
|
+
|
|
246
|
+
```
|
|
247
|
+
fitscube compress cube.fits --method tile-rice
|
|
248
|
+
fitscube decompress cube.fits.fz
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
`funpack` works too, though `funpack` from CFITSIO 4.3.1 mis-decodes RICE files whose
|
|
252
|
+
tiles are narrower than a row. fitscube always writes full-width tiles.
|
|
253
|
+
|
|
254
|
+
Quantise once. Every decompress and recompress with `tile-rice` adds a new error, so
|
|
255
|
+
`fitscube decompress` marks lossy cubes with `FCLOSSY`, and `tile-rice` refuses them
|
|
256
|
+
unless given `allow_requantize=True`. Smooth images such as weights do not shrink under
|
|
257
|
+
RICE; use `tile-gzip` for them.
|
|
258
|
+
|
|
172
259
|
## Zero-sized beams
|
|
173
260
|
|
|
174
261
|
wsclean writes `BMAJ = BMIN = 0` into an image when no PSF was fitted for that
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '2.
|
|
22
|
-
__version_tuple__ = version_tuple = (2,
|
|
21
|
+
__version__ = version = '2.10.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (2, 10, 0)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -163,6 +163,8 @@ async def get_bounding_box_for_fits_coro(
|
|
|
163
163
|
data = np.squeeze(data)
|
|
164
164
|
|
|
165
165
|
if invalidate_zeros:
|
|
166
|
+
# Integer data cannot hold NaN
|
|
167
|
+
data = data.astype(np.result_type(data.dtype, np.float32))
|
|
166
168
|
data[data == 0.0] = np.nan
|
|
167
169
|
|
|
168
170
|
return await asyncio.to_thread(create_bound_box_plane, image_data=data)
|
|
@@ -6,6 +6,12 @@ from argparse import ArgumentParser
|
|
|
6
6
|
|
|
7
7
|
from fitscube.combine_fits import cli as combine_cli
|
|
8
8
|
from fitscube.combine_fits import get_parser as combine_get_parser
|
|
9
|
+
from fitscube.compress import (
|
|
10
|
+
compress_cli,
|
|
11
|
+
decompress_cli,
|
|
12
|
+
get_compress_parser,
|
|
13
|
+
get_decompress_parser,
|
|
14
|
+
)
|
|
9
15
|
from fitscube.extract import cli as extract_cli
|
|
10
16
|
from fitscube.extract import get_parser as extract_get_parser
|
|
11
17
|
from fitscube.logging import logger
|
|
@@ -26,6 +32,16 @@ def get_parser() -> ArgumentParser:
|
|
|
26
32
|
)
|
|
27
33
|
extract_parser = extract_get_parser(parser=extract_parser)
|
|
28
34
|
|
|
35
|
+
compress_parser = subparser.add_parser(
|
|
36
|
+
"compress", help="Compress a cube to .fits.gz or .fits.fz"
|
|
37
|
+
)
|
|
38
|
+
compress_parser = get_compress_parser(parser=compress_parser)
|
|
39
|
+
|
|
40
|
+
decompress_parser = subparser.add_parser(
|
|
41
|
+
"decompress", help="Turn a .fits.gz or .fits.fz cube back into plain FITS"
|
|
42
|
+
)
|
|
43
|
+
decompress_parser = get_decompress_parser(parser=decompress_parser)
|
|
44
|
+
|
|
29
45
|
return parser
|
|
30
46
|
|
|
31
47
|
|
|
@@ -38,6 +54,10 @@ def cli() -> None:
|
|
|
38
54
|
combine_cli(args=args)
|
|
39
55
|
elif args.mode == "extract":
|
|
40
56
|
extract_cli(args=args)
|
|
57
|
+
elif args.mode == "compress":
|
|
58
|
+
compress_cli(args=args)
|
|
59
|
+
elif args.mode == "decompress":
|
|
60
|
+
decompress_cli(args=args)
|
|
41
61
|
else:
|
|
42
62
|
logger.critical(f"Unknown mode {args.mode=}")
|
|
43
63
|
|