ecallistolib 0.2.1__py3-none-any.whl → 0.2.2__py3-none-any.whl
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.
- {ecallistolib-0.2.1.dist-info → ecallistolib-0.2.2.dist-info}/METADATA +53 -39
- {ecallistolib-0.2.1.dist-info → ecallistolib-0.2.2.dist-info}/RECORD +5 -5
- {ecallistolib-0.2.1.dist-info → ecallistolib-0.2.2.dist-info}/WHEEL +0 -0
- {ecallistolib-0.2.1.dist-info → ecallistolib-0.2.2.dist-info}/licenses/LICENSE +0 -0
- {ecallistolib-0.2.1.dist-info → ecallistolib-0.2.2.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ecallistolib
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Tools to download, read, process, and plot e-CALLISTO FITS dynamic spectra.
|
|
5
5
|
Author: Sahan S. Liyanage
|
|
6
6
|
License: MIT
|
|
@@ -70,6 +70,20 @@ A Python library to **download**, **read**, **process**, and **plot** e-CALLISTO
|
|
|
70
70
|
|
|
71
71
|
## Installation
|
|
72
72
|
|
|
73
|
+
|
|
74
|
+
### From PyPI (Stable)
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install ecallistolib
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Optional Dependencies
|
|
81
|
+
|
|
82
|
+
Install optional features as needed:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pip install ecallistolib"[download,plot]"
|
|
86
|
+
```
|
|
73
87
|
### From Source (Development)
|
|
74
88
|
|
|
75
89
|
```bash
|
|
@@ -240,7 +254,7 @@ spectrum = ecl.read_fits("my_spectrum.fit.gz")
|
|
|
240
254
|
cropped = ecl.crop_frequency(spectrum, freq_min=100, freq_max=300)
|
|
241
255
|
|
|
242
256
|
# Crop to specific time range (in seconds)
|
|
243
|
-
cropped =
|
|
257
|
+
cropped = ecl.crop_time(spectrum, time_min=10, time_max=60)
|
|
244
258
|
|
|
245
259
|
# Crop both axes at once
|
|
246
260
|
cropped = ecl.crop(spectrum, freq_range=(100, 300), time_range=(10, 60))
|
|
@@ -325,15 +339,15 @@ Create dynamic spectrum visualizations with full customization:
|
|
|
325
339
|
import ecallistolib as ecl
|
|
326
340
|
import matplotlib.pyplot as plt
|
|
327
341
|
|
|
328
|
-
spectrum =
|
|
329
|
-
cleaned =
|
|
342
|
+
spectrum = ecl.read_fits("my_spectrum.fit.gz")
|
|
343
|
+
cleaned = ecl.noise_reduce_mean_clip(spectrum)
|
|
330
344
|
|
|
331
345
|
# Basic plot
|
|
332
|
-
fig, ax, im =
|
|
346
|
+
fig, ax, im = ecl.plot_dynamic_spectrum(cleaned, title="Solar Radio Observation")
|
|
333
347
|
plt.show()
|
|
334
348
|
|
|
335
349
|
# Customized plot with clipping values, colormap, and figure size
|
|
336
|
-
fig, ax, im =
|
|
350
|
+
fig, ax, im = ecl.plot_dynamic_spectrum(
|
|
337
351
|
cleaned,
|
|
338
352
|
title="Type III Solar Burst",
|
|
339
353
|
cmap="magma", # Matplotlib colormap
|
|
@@ -348,12 +362,12 @@ plt.savefig("spectrum.png", dpi=150, bbox_inches="tight")
|
|
|
348
362
|
#### Plotting Raw Data
|
|
349
363
|
|
|
350
364
|
```python
|
|
351
|
-
import ecallistolib as
|
|
365
|
+
import ecallistolib as ecl
|
|
352
366
|
|
|
353
|
-
spectrum =
|
|
367
|
+
spectrum = ecl.read_fits("my_spectrum.fit.gz")
|
|
354
368
|
|
|
355
369
|
# Plot raw spectrum without any processing
|
|
356
|
-
fig, ax, im =
|
|
370
|
+
fig, ax, im = ecl.plot_raw_spectrum(
|
|
357
371
|
spectrum,
|
|
358
372
|
title="Raw Spectrum",
|
|
359
373
|
cmap="viridis",
|
|
@@ -364,12 +378,12 @@ fig, ax, im = ecf.plot_raw_spectrum(
|
|
|
364
378
|
#### Plotting Background Subtracted (Before Clipping)
|
|
365
379
|
|
|
366
380
|
```python
|
|
367
|
-
import ecallistolib as
|
|
381
|
+
import ecallistolib as ecl
|
|
368
382
|
|
|
369
|
-
spectrum =
|
|
383
|
+
spectrum = ecl.read_fits("my_spectrum.fit.gz")
|
|
370
384
|
|
|
371
385
|
# Plot after background subtraction but before clipping
|
|
372
|
-
fig, ax, im =
|
|
386
|
+
fig, ax, im = ecl.plot_background_subtracted(
|
|
373
387
|
spectrum,
|
|
374
388
|
vmin=-10,
|
|
375
389
|
vmax=30,
|
|
@@ -382,15 +396,15 @@ fig, ax, im = ecf.plot_background_subtracted(
|
|
|
382
396
|
Display time in seconds or Universal Time (UT):
|
|
383
397
|
|
|
384
398
|
```python
|
|
385
|
-
import ecallistolib as
|
|
399
|
+
import ecallistolib as ecl
|
|
386
400
|
|
|
387
|
-
spectrum =
|
|
401
|
+
spectrum = ecl.read_fits("my_spectrum.fit.gz")
|
|
388
402
|
|
|
389
403
|
# Default: time in seconds
|
|
390
|
-
|
|
404
|
+
ecl.plot_dynamic_spectrum(spectrum, time_format="seconds")
|
|
391
405
|
|
|
392
406
|
# Time in UT format (HH:MM:SS)
|
|
393
|
-
|
|
407
|
+
ecl.plot_dynamic_spectrum(spectrum, time_format="ut")
|
|
394
408
|
```
|
|
395
409
|
|
|
396
410
|
#### Time Axis Converter
|
|
@@ -398,12 +412,12 @@ ecf.plot_dynamic_spectrum(spectrum, time_format="ut")
|
|
|
398
412
|
Convert between elapsed seconds and UT time programmatically:
|
|
399
413
|
|
|
400
414
|
```python
|
|
401
|
-
import ecallistolib as
|
|
415
|
+
import ecallistolib as ecl
|
|
402
416
|
|
|
403
|
-
spectrum =
|
|
417
|
+
spectrum = ecl.read_fits("my_spectrum.fit.gz")
|
|
404
418
|
|
|
405
419
|
# Create converter from spectrum metadata
|
|
406
|
-
converter =
|
|
420
|
+
converter = ecl.TimeAxisConverter.from_dynamic_spectrum(spectrum)
|
|
407
421
|
|
|
408
422
|
# Convert seconds to UT
|
|
409
423
|
print(converter.seconds_to_ut(100)) # "12:01:40"
|
|
@@ -418,16 +432,16 @@ print(converter.ut_to_seconds("13:00:00")) # 3600.0
|
|
|
418
432
|
|
|
419
433
|
```python
|
|
420
434
|
import matplotlib.pyplot as plt
|
|
421
|
-
import ecallistolib as
|
|
435
|
+
import ecallistolib as ecl
|
|
422
436
|
|
|
423
437
|
fig, axes = plt.subplots(1, 2, figsize=(14, 5))
|
|
424
438
|
|
|
425
|
-
spectrum1 =
|
|
426
|
-
spectrum2 =
|
|
439
|
+
spectrum1 = ecl.read_fits("file1.fit.gz")
|
|
440
|
+
spectrum2 = ecl.read_fits("file2.fit.gz")
|
|
427
441
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
442
|
+
ecl.plot_raw_spectrum(spectrum1, ax=axes[0], title="Raw")
|
|
443
|
+
ecl.plot_dynamic_spectrum(
|
|
444
|
+
ecl.noise_reduce_mean_clip(spectrum2),
|
|
431
445
|
ax=axes[1],
|
|
432
446
|
title="Noise Reduced",
|
|
433
447
|
vmin=-5, vmax=20
|
|
@@ -705,18 +719,18 @@ The library provides a hierarchy of custom exceptions for robust error handling:
|
|
|
705
719
|
#### Error Handling Example
|
|
706
720
|
|
|
707
721
|
```python
|
|
708
|
-
import ecallistolib as
|
|
722
|
+
import ecallistolib as ecl
|
|
709
723
|
from ecallistolib import InvalidFITSError, CropError
|
|
710
724
|
|
|
711
725
|
try:
|
|
712
|
-
spectrum =
|
|
726
|
+
spectrum = ecl.read_fits("corrupted_file.fit")
|
|
713
727
|
except FileNotFoundError:
|
|
714
728
|
print("File not found")
|
|
715
729
|
except InvalidFITSError as e:
|
|
716
730
|
print(f"Invalid FITS file: {e}")
|
|
717
731
|
|
|
718
732
|
try:
|
|
719
|
-
cropped =
|
|
733
|
+
cropped = ecl.crop(spectrum, freq_range=(1000, 2000)) # Out of range
|
|
720
734
|
except CropError as e:
|
|
721
735
|
print(f"Cropping failed: {e}")
|
|
722
736
|
```
|
|
@@ -729,24 +743,24 @@ except CropError as e:
|
|
|
729
743
|
|
|
730
744
|
```python
|
|
731
745
|
from datetime import date
|
|
732
|
-
import ecallistolib as
|
|
746
|
+
import ecallistolib as ecl
|
|
733
747
|
import matplotlib.pyplot as plt
|
|
734
748
|
|
|
735
749
|
# 1. Download data
|
|
736
|
-
remote =
|
|
737
|
-
paths =
|
|
750
|
+
remote = ecl.list_remote_fits(date(2023, 6, 15), hour=12, station_substring="alaska")
|
|
751
|
+
paths = ecl.download_files(remote[:2], out_dir="./data")
|
|
738
752
|
|
|
739
753
|
# 2. Read and combine
|
|
740
|
-
if
|
|
741
|
-
spectrum =
|
|
754
|
+
if ecl.can_combine_time(paths):
|
|
755
|
+
spectrum = ecl.combine_time(paths)
|
|
742
756
|
else:
|
|
743
|
-
spectrum =
|
|
757
|
+
spectrum = ecl.read_fits(paths[0])
|
|
744
758
|
|
|
745
759
|
# 3. Process
|
|
746
|
-
cleaned =
|
|
760
|
+
cleaned = ecl.noise_reduce_mean_clip(spectrum)
|
|
747
761
|
|
|
748
762
|
# 4. Plot
|
|
749
|
-
fig, ax, im =
|
|
763
|
+
fig, ax, im = ecl.plot_dynamic_spectrum(
|
|
750
764
|
cleaned,
|
|
751
765
|
title=f"e-CALLISTO Observation - {spectrum.meta.get('station', 'Unknown')}",
|
|
752
766
|
cmap="plasma"
|
|
@@ -758,9 +772,9 @@ plt.show()
|
|
|
758
772
|
### Working with Metadata
|
|
759
773
|
|
|
760
774
|
```python
|
|
761
|
-
import ecallistolib as
|
|
775
|
+
import ecallistolib as ecl
|
|
762
776
|
|
|
763
|
-
spectrum =
|
|
777
|
+
spectrum = ecl.read_fits("my_file.fit.gz")
|
|
764
778
|
|
|
765
779
|
# Access metadata
|
|
766
780
|
print(f"Station: {spectrum.meta.get('station')}")
|
|
@@ -768,7 +782,7 @@ print(f"Date: {spectrum.meta.get('date')}")
|
|
|
768
782
|
print(f"UT Start: {spectrum.meta.get('ut_start_sec')} seconds")
|
|
769
783
|
|
|
770
784
|
# After processing, metadata is preserved and extended
|
|
771
|
-
processed =
|
|
785
|
+
processed = ecl.noise_reduce_mean_clip(spectrum)
|
|
772
786
|
print(f"Processing applied: {processed.meta.get('noise_reduction')}")
|
|
773
787
|
```
|
|
774
788
|
|
|
@@ -7,8 +7,8 @@ ecallistolib/io.py,sha256=e-BMtWvILsqs2ua89Ysa2vwZ9s4mDukDGVPYDA3ed-E,3686
|
|
|
7
7
|
ecallistolib/models.py,sha256=v8bl1fN3jKHVbQmpfVSv3ZusFrkWZJ1ciZkuufygmjE,1299
|
|
8
8
|
ecallistolib/plotting.py,sha256=RhTJK5qGwCcBRRJP-mDNyGoWzd5diHCbx1IyXK8PraU,12296
|
|
9
9
|
ecallistolib/processing.py,sha256=eBH3uGt3RmGM1NRdH_wJ7AAcVeadk9te-pHc9pWy2Lo,1976
|
|
10
|
-
ecallistolib-0.2.
|
|
11
|
-
ecallistolib-0.2.
|
|
12
|
-
ecallistolib-0.2.
|
|
13
|
-
ecallistolib-0.2.
|
|
14
|
-
ecallistolib-0.2.
|
|
10
|
+
ecallistolib-0.2.2.dist-info/licenses/LICENSE,sha256=WunjkzsBGyy9vIQxfNe_GDV1yKBQJ-0WbFt4AXZ5Rvc,1073
|
|
11
|
+
ecallistolib-0.2.2.dist-info/METADATA,sha256=rYRt_P0-XByK08F3UfgEaFlZSDyyALh7Ot4EFPkr4Rc,22765
|
|
12
|
+
ecallistolib-0.2.2.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
|
|
13
|
+
ecallistolib-0.2.2.dist-info/top_level.txt,sha256=DmLjR5jlE2i2mQXou5gyCpaHOOlNs4DIQyCPoGXhsbc,13
|
|
14
|
+
ecallistolib-0.2.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|