solarc-eclipse 0.5.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.
- solarc_eclipse-0.5.0/LICENSE +1 -0
- solarc_eclipse-0.5.0/MANIFEST.in +14 -0
- solarc_eclipse-0.5.0/PKG-INFO +354 -0
- solarc_eclipse-0.5.0/README.md +311 -0
- solarc_eclipse-0.5.0/euvst_response/__init__.py +52 -0
- solarc_eclipse-0.5.0/euvst_response/analysis.py +680 -0
- solarc_eclipse-0.5.0/euvst_response/cli.py +113 -0
- solarc_eclipse-0.5.0/euvst_response/config.py +396 -0
- solarc_eclipse-0.5.0/euvst_response/data/throughput/grating_reflection_efficiency.dat +25 -0
- solarc_eclipse-0.5.0/euvst_response/data/throughput/primary_mirror_coating_reflectance.dat +25 -0
- solarc_eclipse-0.5.0/euvst_response/data/throughput/source.txt +3 -0
- solarc_eclipse-0.5.0/euvst_response/data/throughput/throughput_aluminium_1000_angstrom.dat +503 -0
- solarc_eclipse-0.5.0/euvst_response/data/throughput/throughput_aluminium_oxide_1000_angstrom.dat +503 -0
- solarc_eclipse-0.5.0/euvst_response/data/throughput/throughput_carbon_1000_angstrom.dat +503 -0
- solarc_eclipse-0.5.0/euvst_response/data_processing.py +269 -0
- solarc_eclipse-0.5.0/euvst_response/fitting.py +144 -0
- solarc_eclipse-0.5.0/euvst_response/main.py +424 -0
- solarc_eclipse-0.5.0/euvst_response/monte_carlo.py +159 -0
- solarc_eclipse-0.5.0/euvst_response/pinhole_diffraction.py +260 -0
- solarc_eclipse-0.5.0/euvst_response/psf.py +46 -0
- solarc_eclipse-0.5.0/euvst_response/radiometric.py +512 -0
- solarc_eclipse-0.5.0/euvst_response/synthesis.py +911 -0
- solarc_eclipse-0.5.0/euvst_response/synthesis_cli.py +12 -0
- solarc_eclipse-0.5.0/euvst_response/utils.py +176 -0
- solarc_eclipse-0.5.0/pyproject.toml +65 -0
- solarc_eclipse-0.5.0/setup.cfg +4 -0
- solarc_eclipse-0.5.0/setup.py +81 -0
- solarc_eclipse-0.5.0/solarc_eclipse.egg-info/PKG-INFO +354 -0
- solarc_eclipse-0.5.0/solarc_eclipse.egg-info/SOURCES.txt +32 -0
- solarc_eclipse-0.5.0/solarc_eclipse.egg-info/dependency_links.txt +1 -0
- solarc_eclipse-0.5.0/solarc_eclipse.egg-info/entry_points.txt +5 -0
- solarc_eclipse-0.5.0/solarc_eclipse.egg-info/not-zip-safe +1 -0
- solarc_eclipse-0.5.0/solarc_eclipse.egg-info/requires.txt +18 -0
- solarc_eclipse-0.5.0/solarc_eclipse.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Do not use or edit this code without permission from the author.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
include README.md
|
|
2
|
+
include LICENSE
|
|
3
|
+
include pyproject.toml
|
|
4
|
+
recursive-include euvst_response *.py
|
|
5
|
+
recursive-include data *
|
|
6
|
+
recursive-exclude data/atmosphere *
|
|
7
|
+
exclude data/gofnt.sav
|
|
8
|
+
recursive-exclude * __pycache__
|
|
9
|
+
recursive-exclude * *.py[co]
|
|
10
|
+
recursive-exclude scratch *
|
|
11
|
+
exclude *.pkl
|
|
12
|
+
exclude *.png
|
|
13
|
+
exclude *.out
|
|
14
|
+
exclude job.*
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: solarc-eclipse
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: ECLIPSE: Emission Calculation and Line Intensity Prediction for SOLAR-C EUVST
|
|
5
|
+
Home-page: https://github.com/jamesmckevitt/eclipse
|
|
6
|
+
Author: James McKevitt
|
|
7
|
+
Author-email: James McKevitt <jm2@mssl.ucl.ac.uk>
|
|
8
|
+
License: Contact for permission
|
|
9
|
+
Project-URL: Homepage, https://github.com/jamesmckevitt/eclipse
|
|
10
|
+
Project-URL: Repository, https://github.com/jamesmckevitt/eclipse
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering :: Astronomy
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Requires-Python: >=3.8
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: numpy
|
|
23
|
+
Requires-Dist: astropy
|
|
24
|
+
Requires-Dist: ndcube
|
|
25
|
+
Requires-Dist: specutils
|
|
26
|
+
Requires-Dist: scipy
|
|
27
|
+
Requires-Dist: matplotlib
|
|
28
|
+
Requires-Dist: joblib
|
|
29
|
+
Requires-Dist: tqdm
|
|
30
|
+
Requires-Dist: dill
|
|
31
|
+
Requires-Dist: pyyaml
|
|
32
|
+
Requires-Dist: reproject
|
|
33
|
+
Requires-Dist: sunpy[all]
|
|
34
|
+
Provides-Extra: dev
|
|
35
|
+
Requires-Dist: pytest; extra == "dev"
|
|
36
|
+
Requires-Dist: black; extra == "dev"
|
|
37
|
+
Requires-Dist: flake8; extra == "dev"
|
|
38
|
+
Requires-Dist: mypy; extra == "dev"
|
|
39
|
+
Dynamic: author
|
|
40
|
+
Dynamic: home-page
|
|
41
|
+
Dynamic: license-file
|
|
42
|
+
Dynamic: requires-python
|
|
43
|
+
|
|
44
|
+
# ECLIPSE: Emission Calculation and Line Intensity Prediction for SOLAR-C EUVST
|
|
45
|
+
|
|
46
|
+
The ECLIPSE code (Emission Calculation and Line Intensity Prediction for SOLAR-C EUVST) is used to forward model the performance of the EUV spectrograph EUVST, on SOLAR-C.
|
|
47
|
+
|
|
48
|
+
Contact: James McKevitt (jm2@mssl.ucl.ac.uk). License: Contact for permission to use.
|
|
49
|
+
|
|
50
|
+
The instrument response generated by this code will be updated during instrument development, testing, and commissioning.
|
|
51
|
+
|
|
52
|
+
## Installation
|
|
53
|
+
|
|
54
|
+
### From PyPI (recommended)
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install solarc-eclipse
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### From source
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
git clone https://github.com/jamesmckevitt/eclipse.git
|
|
64
|
+
pip install eclipse
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Quick Start
|
|
68
|
+
|
|
69
|
+
### Command Line Interface
|
|
70
|
+
|
|
71
|
+
After installation, you can run ECLIPSE from the command line:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Run synthesis script (convert 3D MHD data to synthetic spectra)
|
|
75
|
+
synthesise-spectra --data-dir ./data/atmosphere --goft-file ./data/gofnt.sav --output-dir ./run/input
|
|
76
|
+
|
|
77
|
+
# Run instrument response simulation
|
|
78
|
+
eclipse --config ./run/input/config.yaml
|
|
79
|
+
|
|
80
|
+
# Help can be accessed with
|
|
81
|
+
synthesise-spectra --help
|
|
82
|
+
eclipse --help
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Python API
|
|
86
|
+
|
|
87
|
+
You can also use ECLIPSE as a Python library:
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
import euvst_response
|
|
91
|
+
from euvst_response import AluminiumFilter, Detector_SWC, Telescope_EUVST
|
|
92
|
+
|
|
93
|
+
telescope = Telescope_EUVST()
|
|
94
|
+
detector = Detector_SWC()
|
|
95
|
+
|
|
96
|
+
print(f"Telescope collecting area: {telescope.collecting_area:.4f}")
|
|
97
|
+
print(f"Detector QE (EUV): {detector.qe_euv:.2f}")
|
|
98
|
+
|
|
99
|
+
# Calculate effective area at Fe XII 195.119 Å
|
|
100
|
+
fe12_wl = 195.119 * u.AA
|
|
101
|
+
effective_area = telescope.collecting_area * telescope.throughput(fe12_wl) * detector.qe_euv
|
|
102
|
+
|
|
103
|
+
# Get breakdown of throughput by component
|
|
104
|
+
pm_eff = telescope.primary_mirror_efficiency(fe12_wl)
|
|
105
|
+
grating_eff = telescope.grating_efficiency(fe12_wl)
|
|
106
|
+
micro_eff = telescope.microroughness_efficiency(fe12_wl)
|
|
107
|
+
filter_eff = telescope.filter.total_throughput(fe12_wl)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Analysis Tutorial
|
|
111
|
+
|
|
112
|
+
For analyzing simulation results, see the included Jupyter notebook `analysis_tutorial.ipynb` which demonstrates how to:
|
|
113
|
+
|
|
114
|
+
- Load simulation results
|
|
115
|
+
- Explore parameter combinations
|
|
116
|
+
- Analyze fit statistics and compute velocity/line width errors
|
|
117
|
+
- Create SunPy maps for visualization
|
|
118
|
+
|
|
119
|
+
The analysis functions are now available directly from the package:
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
from euvst_response import (
|
|
123
|
+
load_instrument_response_results,
|
|
124
|
+
get_results_for_combination,
|
|
125
|
+
analyse_fit_statistics,
|
|
126
|
+
create_sunpy_maps_from_combo,
|
|
127
|
+
summary_table
|
|
128
|
+
)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Detailed instructions
|
|
132
|
+
|
|
133
|
+
### 1. Generate contribution functions for the desired emission lines
|
|
134
|
+
|
|
135
|
+
Edit `make_gofnt.pro` to specify the desired emission lines and the location of the CHIANTI files. You can use CHIANTI to identify the required lines.
|
|
136
|
+
|
|
137
|
+
Run the following command:
|
|
138
|
+
```bash
|
|
139
|
+
idl -e "make_goft"
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### 2. Run the line synthesis
|
|
143
|
+
|
|
144
|
+
The synthesis script converts 3D MHD simulation data into synthetic solar spectra. It can be run directly from the command line with extensive configuration options.
|
|
145
|
+
|
|
146
|
+
#### Basic Usage
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Example using all available command line options
|
|
150
|
+
synthesise-spectra \
|
|
151
|
+
--data-dir ./data/atmosphere \
|
|
152
|
+
--goft-file ./data/gofnt.sav \
|
|
153
|
+
--output-dir ./run/input \
|
|
154
|
+
--output-name synthesised_spectra.pkl \
|
|
155
|
+
--temp-file temp/eosT.0270000 \
|
|
156
|
+
--rho-file rho/result_prim_0.0270000 \
|
|
157
|
+
--vx-file vx/result_prim_1.0270000 \
|
|
158
|
+
--vy-file vy/result_prim_3.0270000 \
|
|
159
|
+
--vz-file vz/result_prim_2.0270000 \
|
|
160
|
+
--cube-shape 512 768 256 \
|
|
161
|
+
--voxel-dx 0.192 \
|
|
162
|
+
--voxel-dy 0.192 \
|
|
163
|
+
--voxel-dz 0.064 \
|
|
164
|
+
--vel-res 5.0 \
|
|
165
|
+
--vel-lim 300.0 \
|
|
166
|
+
--integration-axis z \
|
|
167
|
+
--crop-x -50 50 \
|
|
168
|
+
--crop-y -50 50 \
|
|
169
|
+
--crop-z 0 20 \
|
|
170
|
+
--downsample 1 \
|
|
171
|
+
--precision float64 \
|
|
172
|
+
--mean-mol-wt 1.29 \
|
|
173
|
+
--limit-lines Fe12_195.1190
|
|
174
|
+
|
|
175
|
+
# Show all available options
|
|
176
|
+
synthesise-spectra --help
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
#### Command Line Options
|
|
180
|
+
|
|
181
|
+
**Input/Output Paths:**
|
|
182
|
+
- `--data-dir`: Directory containing simulation data (default: `data/atmosphere`)
|
|
183
|
+
- `--goft-file`: Path to CHIANTI G(T,N) save file (default: `./data/gofnt.sav`)
|
|
184
|
+
- `--output-dir`: Output directory for results (default: `./run/input`)
|
|
185
|
+
- `--output-name`: Output filename (default: `synthesised_spectra.pkl`)
|
|
186
|
+
|
|
187
|
+
**Simulation Files:**
|
|
188
|
+
- `--temp-file`: Temperature file relative to data-dir (default: `temp/eosT.0270000`)
|
|
189
|
+
- `--rho-file`: Density file relative to data-dir (default: `rho/result_prim_0.0270000`)
|
|
190
|
+
- `--vx-file`: X-velocity file (required if `--integration-axis x`)
|
|
191
|
+
- `--vy-file`: Y-velocity file (required if `--integration-axis y`)
|
|
192
|
+
- `--vz-file`: Z-velocity file (required if `--integration-axis z`)
|
|
193
|
+
|
|
194
|
+
**Grid Parameters:**
|
|
195
|
+
- `--cube-shape`: Cube dimensions as three integers (default: `512 768 256`)
|
|
196
|
+
- `--voxel-dx`, `--voxel-dy`, `--voxel-dz`: Voxel sizes in Mm (default: `0.192 0.192 0.064`)
|
|
197
|
+
|
|
198
|
+
**Velocity Grid:**
|
|
199
|
+
- `--vel-res`: Velocity resolution in km/s (default: `5.0`)
|
|
200
|
+
- `--vel-lim`: Velocity limit ±km/s (default: `300.0`)
|
|
201
|
+
|
|
202
|
+
**Integration and Viewing:**
|
|
203
|
+
- `--integration-axis`: Integration axis: `x`, `y`, or `z` (default: `z`)
|
|
204
|
+
- `z`: Standard top-down view (integrates through height)
|
|
205
|
+
- `x`: Side view from the left (integrates left-to-right)
|
|
206
|
+
- `y`: Side view from the front (integrates front-to-back)
|
|
207
|
+
|
|
208
|
+
**Spatial Cropping (Heliocentric coordinates in Mm):**
|
|
209
|
+
- `--crop-x`: X-range to crop, e.g., `--crop-x -50 50` (optional)
|
|
210
|
+
- `--crop-y`: Y-range to crop, e.g., `--crop-y -50 50` (optional)
|
|
211
|
+
- `--crop-z`: Z-range to crop, e.g., `--crop-z 0 20` (optional)
|
|
212
|
+
- Omit any crop option to use the full range in that dimension
|
|
213
|
+
|
|
214
|
+
**Processing Options:**
|
|
215
|
+
- `--downsample`: Downsampling factor (default: `1` = no downsampling)
|
|
216
|
+
- `--precision`: Numerical precision `float32` or `float64` (default: `float64`)
|
|
217
|
+
- `--mean-mol-wt`: Mean molecular weight (default: `1.29`)
|
|
218
|
+
|
|
219
|
+
**Line Selection:**
|
|
220
|
+
- `--limit-lines`: Limit to specific lines, e.g., `--limit-lines Fe12_195.1190 Fe12_195.1790`
|
|
221
|
+
|
|
222
|
+
#### Output
|
|
223
|
+
|
|
224
|
+
The synthesis produces a pickle file containing:
|
|
225
|
+
- `line_cubes`: Individual NDCube objects for each spectral line with proper WCS
|
|
226
|
+
- `config`: Runtime configuration for reproducibility
|
|
227
|
+
- Additional technical data for internal use
|
|
228
|
+
|
|
229
|
+
#### Performance Tips
|
|
230
|
+
|
|
231
|
+
- Use `--downsample 2` or `--downsample 4` for initial testing
|
|
232
|
+
- Use `--precision float32` to reduce memory usage (may affect accuracy)
|
|
233
|
+
- Use `--limit-lines` to synthesize only specific lines for development
|
|
234
|
+
- Use spatial cropping to focus on regions of interest and reduce computation time
|
|
235
|
+
- Monitor memory usage - full resolution synthesis can require 50+ GB RAM
|
|
236
|
+
- Side views (`--integration-axis x` or `y`) may require different velocity files
|
|
237
|
+
|
|
238
|
+
#### Working with Synthesis Results
|
|
239
|
+
|
|
240
|
+
The synthesis results can be loaded and analyzed using the package API:
|
|
241
|
+
|
|
242
|
+
```python
|
|
243
|
+
import euvst_response
|
|
244
|
+
|
|
245
|
+
# Load synthesis results - this sums all line cubes into a single cube
|
|
246
|
+
# By default uses Fe XII 195.119 Å as reference for wavelength grid
|
|
247
|
+
cube = euvst_response.load_atmosphere("./run/input/synthesised_spectra.pkl")
|
|
248
|
+
print(f"Combined cube shape: {cube.data.shape}")
|
|
249
|
+
|
|
250
|
+
# Access individual line cubes if needed
|
|
251
|
+
import pickle
|
|
252
|
+
with open("./run/input/synthesised_spectra.pkl", "rb") as f:
|
|
253
|
+
data = pickle.load(f)
|
|
254
|
+
|
|
255
|
+
# Access individual line cubes
|
|
256
|
+
fe12_195 = data["line_cubes"]["Fe12_195.1190"]
|
|
257
|
+
print(f"Fe XII 195.119 cube shape: {fe12_195.data.shape}")
|
|
258
|
+
print(f"Rest wavelength: {fe12_195.meta['rest_wav']}")
|
|
259
|
+
|
|
260
|
+
# List all available lines
|
|
261
|
+
print(f"Available spectral lines: {list(data['line_cubes'].keys())}")
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
#### Pre-computed Atmospheres
|
|
265
|
+
|
|
266
|
+
This step can require a lot of memory at full resolution. A fully synthesised atmosphere using the Cheung et al. (2018) atmosphere (doi:10.1038/s41550-018-0629-3) for the Fe XII 195.119 and 195.179 lines, including 5 background lines from each side, can be downloaded here: https://liveuclac-my.sharepoint.com/:f:/g/personal/ucasjem_ucl_ac_uk/Es-ts6rwXIlInAweGI7hmdMB5BoGqv9uSpIXOvMkzhS3cw?e=54si7R
|
|
267
|
+
|
|
268
|
+
**Important:** You can place the synthesised atmosphere file anywhere and specify its location using the `synthesis_file` parameter in your YAML configuration file. The default location is `./run/input/synthesised_spectra.pkl`.
|
|
269
|
+
|
|
270
|
+
### 3. Simulate the instrument response
|
|
271
|
+
|
|
272
|
+
#### Configuration File
|
|
273
|
+
|
|
274
|
+
ECLIPSE uses YAML configuration files to specify simulation parameters. You can specify single values or lists of values for parameter sweeps.
|
|
275
|
+
|
|
276
|
+
**Key configuration options:**
|
|
277
|
+
- `instrument`: Choose between SWC (EUVST-SW) or EIS (Hinode)
|
|
278
|
+
- `synthesis_file`: Path to the synthesised spectra pickle file (default: `./run/input/synthesised_spectra.pkl`)
|
|
279
|
+
- `reference_line`: Spectral line to use as reference for wavelength grid when combining all lines (default: `Fe12_195.1190`)
|
|
280
|
+
- `expos`: Exposure time(s) for simulations
|
|
281
|
+
- `n_iter`: Number of Monte Carlo iterations
|
|
282
|
+
- Parameter sweeps for filters, detector settings, etc.
|
|
283
|
+
|
|
284
|
+
Here's a complete example configuration file:
|
|
285
|
+
|
|
286
|
+
```yaml
|
|
287
|
+
# Instrument selection
|
|
288
|
+
instrument: SWC # Options: SWC (EUVST Short Wavelength) or EIS (Hinode/EIS)
|
|
289
|
+
|
|
290
|
+
# Synthesis file path - location of the synthesised spectra pickle file
|
|
291
|
+
synthesis_file: ./run/input/synthesised_spectra.pkl # Default location
|
|
292
|
+
|
|
293
|
+
# Reference line for wavelength grid and metadata when combining all spectral lines
|
|
294
|
+
reference_line: Fe12_195.1190 # Default reference line (Fe XII 195.119 Å)
|
|
295
|
+
|
|
296
|
+
# Point Spread Function
|
|
297
|
+
psf: False # Enable PSF convolution
|
|
298
|
+
# Or test with and without PSF:
|
|
299
|
+
# psf: [True, False] # Run simulations both with and without PSF
|
|
300
|
+
|
|
301
|
+
# Exposure times - can be single value or list
|
|
302
|
+
expos: [0.5 s, 1 s, 2 s, 5 s, 10 s, 20 s, 40 s, 80 s]
|
|
303
|
+
|
|
304
|
+
# Monte Carlo simulation parameters
|
|
305
|
+
n_iter: 1000 # Number of Monte Carlo iterations
|
|
306
|
+
ncpu: -1 # Number of CPU cores (-1 = use all available)
|
|
307
|
+
|
|
308
|
+
# Parameter sweeps - you can specify single values or lists for any parameter
|
|
309
|
+
# The simulation will run all combinations of parameters
|
|
310
|
+
|
|
311
|
+
# Slit width
|
|
312
|
+
slit_width: 0.2 arcsec # Narrowest slit on EUVST
|
|
313
|
+
|
|
314
|
+
# Filter parameters (SWC only)
|
|
315
|
+
# Thickness of aluminum oxide layer on entrance filter
|
|
316
|
+
oxide_thickness: 95 angstrom # Default (expected value)
|
|
317
|
+
|
|
318
|
+
# Carbon contamination thickness on filter
|
|
319
|
+
c_thickness: 0 angstrom # Default (ideal case, no contamination)
|
|
320
|
+
|
|
321
|
+
# Aluminum filter thickness
|
|
322
|
+
aluminium_thickness: 1485 angstrom # Default (expected value)
|
|
323
|
+
|
|
324
|
+
# CCD temperature for dark current calculation
|
|
325
|
+
ccd_temperature: -60 Celsius # Default (expected operating temperature)
|
|
326
|
+
|
|
327
|
+
# Visible stray light level
|
|
328
|
+
vis_sl: 0 photon / (s * pixel) # Default, (ideal case, no stray light)
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
For guidence on recommended values, see McKevitt et al. (2025) (in prep.).
|
|
332
|
+
|
|
333
|
+
#### Running Simulations
|
|
334
|
+
|
|
335
|
+
Run the instrument response function using:
|
|
336
|
+
```bash
|
|
337
|
+
eclipse --config ./run/input/config.yaml
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
**Command-line options:**
|
|
341
|
+
- `--config`: Path to YAML configuration file (required)
|
|
342
|
+
- `--debug`: Enable debug mode with IPython breakpoints on errors (optional)
|
|
343
|
+
|
|
344
|
+
#### Output
|
|
345
|
+
|
|
346
|
+
Results are saved as pickle files in the `run/result/` directory with the same base name as the configuration file. The output includes:
|
|
347
|
+
- Simulated detector signals (DN and photon counts)
|
|
348
|
+
- Fitted spectral line parameters (intensity, velocity, width)
|
|
349
|
+
- Statistical analysis of velocity precision vs. exposure time
|
|
350
|
+
- Ground truth comparisons
|
|
351
|
+
|
|
352
|
+
## Acknowledgements
|
|
353
|
+
|
|
354
|
+
The SOLAR-C/EUVST-SW instrument is an ESA-funded contribution to the JAXA-led SOLAR-C mission. The EUVST-LW (long wavelength) instrument is contributed by NASA. The ECLIPSE code is developed and maintained at Mullard Space Science Laboratory (UCL), and was made using Austrian Super Computing (ASC) infrastructure in collaboration with the University of Vienna.
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
# ECLIPSE: Emission Calculation and Line Intensity Prediction for SOLAR-C EUVST
|
|
2
|
+
|
|
3
|
+
The ECLIPSE code (Emission Calculation and Line Intensity Prediction for SOLAR-C EUVST) is used to forward model the performance of the EUV spectrograph EUVST, on SOLAR-C.
|
|
4
|
+
|
|
5
|
+
Contact: James McKevitt (jm2@mssl.ucl.ac.uk). License: Contact for permission to use.
|
|
6
|
+
|
|
7
|
+
The instrument response generated by this code will be updated during instrument development, testing, and commissioning.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
### From PyPI (recommended)
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install solarc-eclipse
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### From source
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
git clone https://github.com/jamesmckevitt/eclipse.git
|
|
21
|
+
pip install eclipse
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
### Command Line Interface
|
|
27
|
+
|
|
28
|
+
After installation, you can run ECLIPSE from the command line:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Run synthesis script (convert 3D MHD data to synthetic spectra)
|
|
32
|
+
synthesise-spectra --data-dir ./data/atmosphere --goft-file ./data/gofnt.sav --output-dir ./run/input
|
|
33
|
+
|
|
34
|
+
# Run instrument response simulation
|
|
35
|
+
eclipse --config ./run/input/config.yaml
|
|
36
|
+
|
|
37
|
+
# Help can be accessed with
|
|
38
|
+
synthesise-spectra --help
|
|
39
|
+
eclipse --help
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Python API
|
|
43
|
+
|
|
44
|
+
You can also use ECLIPSE as a Python library:
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
import euvst_response
|
|
48
|
+
from euvst_response import AluminiumFilter, Detector_SWC, Telescope_EUVST
|
|
49
|
+
|
|
50
|
+
telescope = Telescope_EUVST()
|
|
51
|
+
detector = Detector_SWC()
|
|
52
|
+
|
|
53
|
+
print(f"Telescope collecting area: {telescope.collecting_area:.4f}")
|
|
54
|
+
print(f"Detector QE (EUV): {detector.qe_euv:.2f}")
|
|
55
|
+
|
|
56
|
+
# Calculate effective area at Fe XII 195.119 Å
|
|
57
|
+
fe12_wl = 195.119 * u.AA
|
|
58
|
+
effective_area = telescope.collecting_area * telescope.throughput(fe12_wl) * detector.qe_euv
|
|
59
|
+
|
|
60
|
+
# Get breakdown of throughput by component
|
|
61
|
+
pm_eff = telescope.primary_mirror_efficiency(fe12_wl)
|
|
62
|
+
grating_eff = telescope.grating_efficiency(fe12_wl)
|
|
63
|
+
micro_eff = telescope.microroughness_efficiency(fe12_wl)
|
|
64
|
+
filter_eff = telescope.filter.total_throughput(fe12_wl)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Analysis Tutorial
|
|
68
|
+
|
|
69
|
+
For analyzing simulation results, see the included Jupyter notebook `analysis_tutorial.ipynb` which demonstrates how to:
|
|
70
|
+
|
|
71
|
+
- Load simulation results
|
|
72
|
+
- Explore parameter combinations
|
|
73
|
+
- Analyze fit statistics and compute velocity/line width errors
|
|
74
|
+
- Create SunPy maps for visualization
|
|
75
|
+
|
|
76
|
+
The analysis functions are now available directly from the package:
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
from euvst_response import (
|
|
80
|
+
load_instrument_response_results,
|
|
81
|
+
get_results_for_combination,
|
|
82
|
+
analyse_fit_statistics,
|
|
83
|
+
create_sunpy_maps_from_combo,
|
|
84
|
+
summary_table
|
|
85
|
+
)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Detailed instructions
|
|
89
|
+
|
|
90
|
+
### 1. Generate contribution functions for the desired emission lines
|
|
91
|
+
|
|
92
|
+
Edit `make_gofnt.pro` to specify the desired emission lines and the location of the CHIANTI files. You can use CHIANTI to identify the required lines.
|
|
93
|
+
|
|
94
|
+
Run the following command:
|
|
95
|
+
```bash
|
|
96
|
+
idl -e "make_goft"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 2. Run the line synthesis
|
|
100
|
+
|
|
101
|
+
The synthesis script converts 3D MHD simulation data into synthetic solar spectra. It can be run directly from the command line with extensive configuration options.
|
|
102
|
+
|
|
103
|
+
#### Basic Usage
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# Example using all available command line options
|
|
107
|
+
synthesise-spectra \
|
|
108
|
+
--data-dir ./data/atmosphere \
|
|
109
|
+
--goft-file ./data/gofnt.sav \
|
|
110
|
+
--output-dir ./run/input \
|
|
111
|
+
--output-name synthesised_spectra.pkl \
|
|
112
|
+
--temp-file temp/eosT.0270000 \
|
|
113
|
+
--rho-file rho/result_prim_0.0270000 \
|
|
114
|
+
--vx-file vx/result_prim_1.0270000 \
|
|
115
|
+
--vy-file vy/result_prim_3.0270000 \
|
|
116
|
+
--vz-file vz/result_prim_2.0270000 \
|
|
117
|
+
--cube-shape 512 768 256 \
|
|
118
|
+
--voxel-dx 0.192 \
|
|
119
|
+
--voxel-dy 0.192 \
|
|
120
|
+
--voxel-dz 0.064 \
|
|
121
|
+
--vel-res 5.0 \
|
|
122
|
+
--vel-lim 300.0 \
|
|
123
|
+
--integration-axis z \
|
|
124
|
+
--crop-x -50 50 \
|
|
125
|
+
--crop-y -50 50 \
|
|
126
|
+
--crop-z 0 20 \
|
|
127
|
+
--downsample 1 \
|
|
128
|
+
--precision float64 \
|
|
129
|
+
--mean-mol-wt 1.29 \
|
|
130
|
+
--limit-lines Fe12_195.1190
|
|
131
|
+
|
|
132
|
+
# Show all available options
|
|
133
|
+
synthesise-spectra --help
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
#### Command Line Options
|
|
137
|
+
|
|
138
|
+
**Input/Output Paths:**
|
|
139
|
+
- `--data-dir`: Directory containing simulation data (default: `data/atmosphere`)
|
|
140
|
+
- `--goft-file`: Path to CHIANTI G(T,N) save file (default: `./data/gofnt.sav`)
|
|
141
|
+
- `--output-dir`: Output directory for results (default: `./run/input`)
|
|
142
|
+
- `--output-name`: Output filename (default: `synthesised_spectra.pkl`)
|
|
143
|
+
|
|
144
|
+
**Simulation Files:**
|
|
145
|
+
- `--temp-file`: Temperature file relative to data-dir (default: `temp/eosT.0270000`)
|
|
146
|
+
- `--rho-file`: Density file relative to data-dir (default: `rho/result_prim_0.0270000`)
|
|
147
|
+
- `--vx-file`: X-velocity file (required if `--integration-axis x`)
|
|
148
|
+
- `--vy-file`: Y-velocity file (required if `--integration-axis y`)
|
|
149
|
+
- `--vz-file`: Z-velocity file (required if `--integration-axis z`)
|
|
150
|
+
|
|
151
|
+
**Grid Parameters:**
|
|
152
|
+
- `--cube-shape`: Cube dimensions as three integers (default: `512 768 256`)
|
|
153
|
+
- `--voxel-dx`, `--voxel-dy`, `--voxel-dz`: Voxel sizes in Mm (default: `0.192 0.192 0.064`)
|
|
154
|
+
|
|
155
|
+
**Velocity Grid:**
|
|
156
|
+
- `--vel-res`: Velocity resolution in km/s (default: `5.0`)
|
|
157
|
+
- `--vel-lim`: Velocity limit ±km/s (default: `300.0`)
|
|
158
|
+
|
|
159
|
+
**Integration and Viewing:**
|
|
160
|
+
- `--integration-axis`: Integration axis: `x`, `y`, or `z` (default: `z`)
|
|
161
|
+
- `z`: Standard top-down view (integrates through height)
|
|
162
|
+
- `x`: Side view from the left (integrates left-to-right)
|
|
163
|
+
- `y`: Side view from the front (integrates front-to-back)
|
|
164
|
+
|
|
165
|
+
**Spatial Cropping (Heliocentric coordinates in Mm):**
|
|
166
|
+
- `--crop-x`: X-range to crop, e.g., `--crop-x -50 50` (optional)
|
|
167
|
+
- `--crop-y`: Y-range to crop, e.g., `--crop-y -50 50` (optional)
|
|
168
|
+
- `--crop-z`: Z-range to crop, e.g., `--crop-z 0 20` (optional)
|
|
169
|
+
- Omit any crop option to use the full range in that dimension
|
|
170
|
+
|
|
171
|
+
**Processing Options:**
|
|
172
|
+
- `--downsample`: Downsampling factor (default: `1` = no downsampling)
|
|
173
|
+
- `--precision`: Numerical precision `float32` or `float64` (default: `float64`)
|
|
174
|
+
- `--mean-mol-wt`: Mean molecular weight (default: `1.29`)
|
|
175
|
+
|
|
176
|
+
**Line Selection:**
|
|
177
|
+
- `--limit-lines`: Limit to specific lines, e.g., `--limit-lines Fe12_195.1190 Fe12_195.1790`
|
|
178
|
+
|
|
179
|
+
#### Output
|
|
180
|
+
|
|
181
|
+
The synthesis produces a pickle file containing:
|
|
182
|
+
- `line_cubes`: Individual NDCube objects for each spectral line with proper WCS
|
|
183
|
+
- `config`: Runtime configuration for reproducibility
|
|
184
|
+
- Additional technical data for internal use
|
|
185
|
+
|
|
186
|
+
#### Performance Tips
|
|
187
|
+
|
|
188
|
+
- Use `--downsample 2` or `--downsample 4` for initial testing
|
|
189
|
+
- Use `--precision float32` to reduce memory usage (may affect accuracy)
|
|
190
|
+
- Use `--limit-lines` to synthesize only specific lines for development
|
|
191
|
+
- Use spatial cropping to focus on regions of interest and reduce computation time
|
|
192
|
+
- Monitor memory usage - full resolution synthesis can require 50+ GB RAM
|
|
193
|
+
- Side views (`--integration-axis x` or `y`) may require different velocity files
|
|
194
|
+
|
|
195
|
+
#### Working with Synthesis Results
|
|
196
|
+
|
|
197
|
+
The synthesis results can be loaded and analyzed using the package API:
|
|
198
|
+
|
|
199
|
+
```python
|
|
200
|
+
import euvst_response
|
|
201
|
+
|
|
202
|
+
# Load synthesis results - this sums all line cubes into a single cube
|
|
203
|
+
# By default uses Fe XII 195.119 Å as reference for wavelength grid
|
|
204
|
+
cube = euvst_response.load_atmosphere("./run/input/synthesised_spectra.pkl")
|
|
205
|
+
print(f"Combined cube shape: {cube.data.shape}")
|
|
206
|
+
|
|
207
|
+
# Access individual line cubes if needed
|
|
208
|
+
import pickle
|
|
209
|
+
with open("./run/input/synthesised_spectra.pkl", "rb") as f:
|
|
210
|
+
data = pickle.load(f)
|
|
211
|
+
|
|
212
|
+
# Access individual line cubes
|
|
213
|
+
fe12_195 = data["line_cubes"]["Fe12_195.1190"]
|
|
214
|
+
print(f"Fe XII 195.119 cube shape: {fe12_195.data.shape}")
|
|
215
|
+
print(f"Rest wavelength: {fe12_195.meta['rest_wav']}")
|
|
216
|
+
|
|
217
|
+
# List all available lines
|
|
218
|
+
print(f"Available spectral lines: {list(data['line_cubes'].keys())}")
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
#### Pre-computed Atmospheres
|
|
222
|
+
|
|
223
|
+
This step can require a lot of memory at full resolution. A fully synthesised atmosphere using the Cheung et al. (2018) atmosphere (doi:10.1038/s41550-018-0629-3) for the Fe XII 195.119 and 195.179 lines, including 5 background lines from each side, can be downloaded here: https://liveuclac-my.sharepoint.com/:f:/g/personal/ucasjem_ucl_ac_uk/Es-ts6rwXIlInAweGI7hmdMB5BoGqv9uSpIXOvMkzhS3cw?e=54si7R
|
|
224
|
+
|
|
225
|
+
**Important:** You can place the synthesised atmosphere file anywhere and specify its location using the `synthesis_file` parameter in your YAML configuration file. The default location is `./run/input/synthesised_spectra.pkl`.
|
|
226
|
+
|
|
227
|
+
### 3. Simulate the instrument response
|
|
228
|
+
|
|
229
|
+
#### Configuration File
|
|
230
|
+
|
|
231
|
+
ECLIPSE uses YAML configuration files to specify simulation parameters. You can specify single values or lists of values for parameter sweeps.
|
|
232
|
+
|
|
233
|
+
**Key configuration options:**
|
|
234
|
+
- `instrument`: Choose between SWC (EUVST-SW) or EIS (Hinode)
|
|
235
|
+
- `synthesis_file`: Path to the synthesised spectra pickle file (default: `./run/input/synthesised_spectra.pkl`)
|
|
236
|
+
- `reference_line`: Spectral line to use as reference for wavelength grid when combining all lines (default: `Fe12_195.1190`)
|
|
237
|
+
- `expos`: Exposure time(s) for simulations
|
|
238
|
+
- `n_iter`: Number of Monte Carlo iterations
|
|
239
|
+
- Parameter sweeps for filters, detector settings, etc.
|
|
240
|
+
|
|
241
|
+
Here's a complete example configuration file:
|
|
242
|
+
|
|
243
|
+
```yaml
|
|
244
|
+
# Instrument selection
|
|
245
|
+
instrument: SWC # Options: SWC (EUVST Short Wavelength) or EIS (Hinode/EIS)
|
|
246
|
+
|
|
247
|
+
# Synthesis file path - location of the synthesised spectra pickle file
|
|
248
|
+
synthesis_file: ./run/input/synthesised_spectra.pkl # Default location
|
|
249
|
+
|
|
250
|
+
# Reference line for wavelength grid and metadata when combining all spectral lines
|
|
251
|
+
reference_line: Fe12_195.1190 # Default reference line (Fe XII 195.119 Å)
|
|
252
|
+
|
|
253
|
+
# Point Spread Function
|
|
254
|
+
psf: False # Enable PSF convolution
|
|
255
|
+
# Or test with and without PSF:
|
|
256
|
+
# psf: [True, False] # Run simulations both with and without PSF
|
|
257
|
+
|
|
258
|
+
# Exposure times - can be single value or list
|
|
259
|
+
expos: [0.5 s, 1 s, 2 s, 5 s, 10 s, 20 s, 40 s, 80 s]
|
|
260
|
+
|
|
261
|
+
# Monte Carlo simulation parameters
|
|
262
|
+
n_iter: 1000 # Number of Monte Carlo iterations
|
|
263
|
+
ncpu: -1 # Number of CPU cores (-1 = use all available)
|
|
264
|
+
|
|
265
|
+
# Parameter sweeps - you can specify single values or lists for any parameter
|
|
266
|
+
# The simulation will run all combinations of parameters
|
|
267
|
+
|
|
268
|
+
# Slit width
|
|
269
|
+
slit_width: 0.2 arcsec # Narrowest slit on EUVST
|
|
270
|
+
|
|
271
|
+
# Filter parameters (SWC only)
|
|
272
|
+
# Thickness of aluminum oxide layer on entrance filter
|
|
273
|
+
oxide_thickness: 95 angstrom # Default (expected value)
|
|
274
|
+
|
|
275
|
+
# Carbon contamination thickness on filter
|
|
276
|
+
c_thickness: 0 angstrom # Default (ideal case, no contamination)
|
|
277
|
+
|
|
278
|
+
# Aluminum filter thickness
|
|
279
|
+
aluminium_thickness: 1485 angstrom # Default (expected value)
|
|
280
|
+
|
|
281
|
+
# CCD temperature for dark current calculation
|
|
282
|
+
ccd_temperature: -60 Celsius # Default (expected operating temperature)
|
|
283
|
+
|
|
284
|
+
# Visible stray light level
|
|
285
|
+
vis_sl: 0 photon / (s * pixel) # Default, (ideal case, no stray light)
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
For guidence on recommended values, see McKevitt et al. (2025) (in prep.).
|
|
289
|
+
|
|
290
|
+
#### Running Simulations
|
|
291
|
+
|
|
292
|
+
Run the instrument response function using:
|
|
293
|
+
```bash
|
|
294
|
+
eclipse --config ./run/input/config.yaml
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
**Command-line options:**
|
|
298
|
+
- `--config`: Path to YAML configuration file (required)
|
|
299
|
+
- `--debug`: Enable debug mode with IPython breakpoints on errors (optional)
|
|
300
|
+
|
|
301
|
+
#### Output
|
|
302
|
+
|
|
303
|
+
Results are saved as pickle files in the `run/result/` directory with the same base name as the configuration file. The output includes:
|
|
304
|
+
- Simulated detector signals (DN and photon counts)
|
|
305
|
+
- Fitted spectral line parameters (intensity, velocity, width)
|
|
306
|
+
- Statistical analysis of velocity precision vs. exposure time
|
|
307
|
+
- Ground truth comparisons
|
|
308
|
+
|
|
309
|
+
## Acknowledgements
|
|
310
|
+
|
|
311
|
+
The SOLAR-C/EUVST-SW instrument is an ESA-funded contribution to the JAXA-led SOLAR-C mission. The EUVST-LW (long wavelength) instrument is contributed by NASA. The ECLIPSE code is developed and maintained at Mullard Space Science Laboratory (UCL), and was made using Austrian Super Computing (ASC) infrastructure in collaboration with the University of Vienna.
|