Generation Scripts¶
PSFCraft ships a set of ready-to-run generation scripts in the scripts/
directory. Each script wraps the PSFCraft Python API and provides a
--help interface so you can tune it without editing source code.
Environment Variable¶
All scripts write their HDF5 databases to a single root directory controlled
by the PSFCRAFT_DATA_DIR environment variable.
| Variable | Default | Example |
|---|---|---|
PSFCRAFT_DATA_DIR |
~/psfcraft_data |
/data/psfcraft_runs |
Set it before running any script:
export PSFCRAFT_DATA_DIR=/data/psfcraft_runs
Output files land at:
$PSFCRAFT_DATA_DIR/PSFCraft/<optics_name>/v<version>/<filename>.hdf5
Script Overview¶
| Script | Mode | Description |
|---|---|---|
gen_quicktest.py |
polychromatic | Sanity-check run — small database, single temperature |
gen_newtonian_monochromatic.py |
monochromatic | Wavelength sweep × aperture versions for a Newtonian telescope |
gen_newtonian_ir.py |
monochromatic | NIR wavelength sweep with Euclid-like geometry |
gen_euclid_finefocus.py |
polychromatic | All stellar temperatures, fine-focus WFE budget |
gen_euclid_finefocus_singletemp.py |
polychromatic | Single stellar temperature (for cluster parallelisation) |
gen_euclid_rawfocus.py |
polychromatic | All stellar temperatures, raw-focus WFE budget |
gen_Comm_woTipTilt.py |
polychromatic | Commissioning PSFs with tip-tilt zeroed out |
generation_Euclid_Zemax.py |
monochromatic | Zemax wavelength grid (27 wavelengths, 0.97–1.99 µm) |
Script Reference¶
gen_quicktest.py¶
Quick sanity check to verify the installation and environment. Generates a small polychromatic database for a single stellar temperature.
python scripts/gen_quicktest.py --help
python scripts/gen_quicktest.py --n-psfs 50 --temperature 6000
| Argument | Default | Description |
|---|---|---|
--n-psfs |
100 |
Number of PSFs |
--temperature |
6000 |
Stellar blackbody temperature (K) |
--filter |
Y |
Filter band (Y, J, H) |
--size-psf |
16 |
PSF stamp size in pixels |
--oversampling |
6 |
Detector oversampling factor |
--optics-version |
2 |
Aperture version string |
--spectrum-sampling |
5 |
Wavelength samples across the filter |
gen_newtonian_monochromatic.py¶
Sweeps a wavelength grid across one or more aperture versions for a Newtonian telescope.
python scripts/gen_newtonian_monochromatic.py --help
python scripts/gen_newtonian_monochromatic.py --versions 1 2 --wl-start 500 --wl-stop 900 --wl-step 50
| Argument | Default | Description |
|---|---|---|
--versions |
1 2 |
Aperture version(s) to generate |
--primary-radius |
from constants | Primary mirror radius (m) |
--secondary-radius |
from constants | Secondary mirror radius (m) |
--size-psf |
32 |
PSF stamp size in pixels |
--n-psfs |
1000 |
Number of PSFs per wavelength |
--wl-start |
400 |
Start wavelength (nm) |
--wl-stop |
1000 |
Stop wavelength (nm) |
--wl-step |
100 |
Wavelength step (nm) |
--wfe-budget |
0 100 100 50 50 50 |
WFE per Zernike order (nm rms) |
gen_newtonian_ir.py¶
NIR wavelength sweep with Euclid-like geometry (D = 1.2 m primary).
python scripts/gen_newtonian_ir.py --help
python scripts/gen_newtonian_ir.py --wl-start 900 --wl-stop 2000 --wl-step 100
| Argument | Default | Description |
|---|---|---|
--primary-diameter |
1.2 |
Primary mirror diameter (m) |
--secondary-diameter |
0.36 |
Secondary mirror diameter (m) |
--wl-start |
900 |
Start wavelength (nm) |
--wl-stop |
2000 |
Stop wavelength (nm) |
--wl-step |
100 |
Wavelength step (nm) |
--pixel-scale |
0.298 |
Detector pixel scale (arcsec/px) |
--n-psfs |
1000 |
Number of PSFs per wavelength |
gen_euclid_finefocus.py¶
Generates one HDF5 database per stellar temperature in
STELLAR_TEMPERATURES_MEAN. Uses a tight WFE budget
([0, 1000, 1000, 100, 36, 36, 20, 20, 20, 20] nm rms per Zernike order)
matching the Euclid fine-focus regime.
python scripts/gen_euclid_finefocus.py
python scripts/gen_euclid_finefocus.py --filter J --n-psfs 5000
python scripts/gen_euclid_finefocus.py --reverse # coldest → hottest
| Argument | Default | Description |
|---|---|---|
--optics-version |
2 |
Aperture version |
--size-psf |
16 |
PSF stamp size in pixels |
--n-psfs |
10000 |
Number of PSFs per temperature |
--filter |
Y |
Filter band (Y, J, H) |
--spectrum-sampling |
11 |
Wavelength samples across the filter |
--oversampling |
6 |
Detector oversampling factor |
--reverse |
off | Hottest → coldest order (default) |
gen_euclid_finefocus_singletemp.py¶
Same as gen_euclid_finefocus.py but processes a single temperature index.
Designed for submitting one job per temperature on a batch cluster.
python scripts/gen_euclid_finefocus_singletemp.py --temp-index 3
| Argument | Default | Description |
|---|---|---|
--temp-index |
required | Index into STELLAR_TEMPERATURES_MEAN |
--filter |
Y |
Filter band (Y, J, H) |
| (other arguments) | same as above | — |
Cluster usage
Submit one job per temperature index:
bash
for i in $(seq 0 13); do
sbatch --wrap="python scripts/gen_euclid_finefocus_singletemp.py --temp-index $i"
done
gen_euclid_rawfocus.py¶
Same structure as gen_euclid_finefocus.py but with a wider WFE budget
([0, 1000, 1000, 500, 100, 100, 50, 50, 50, 50] nm rms) representing
the raw-focus (pre-correction) regime.
python scripts/gen_euclid_rawfocus.py
python scripts/gen_euclid_rawfocus.py --filter H --n-psfs 5000
| Argument | Default | Description |
|---|---|---|
--spectrum-sampling |
10 |
Wavelength samples (vs 11 for fine-focus) |
| (other arguments) | same as finefocus | — |
gen_Comm_woTipTilt.py¶
Generates polychromatic PSFs with tip-tilt (Zernike orders 1 and 2) removed from the WFE budget. Useful for commissioning analyses where pointing jitter is handled separately.
python scripts/gen_Comm_woTipTilt.py
python scripts/gen_Comm_woTipTilt.py --temperature 5000 --n-psfs 500
| Argument | Default | Description |
|---|---|---|
--temperature |
10000 |
Stellar blackbody temperature (K) |
--filter |
Y |
Filter band (Y, J, H) |
--n-psfs |
100 |
Number of PSFs |
--spectrum-sampling |
5 |
Wavelength samples |
--oversampling |
6 |
Detector oversampling factor |
generation_Euclid_Zemax.py¶
Generates monochromatic PSF databases at 27 wavelengths derived from Zemax simulations of the Euclid NISP instrument (0.965–1.988 µm).
python scripts/generation_Euclid_Zemax.py
python scripts/generation_Euclid_Zemax.py --n-psfs 500 --oversampling 4
| Argument | Default | Description |
|---|---|---|
--size-psf |
32 |
PSF stamp size in pixels |
--n-psfs |
10000 |
Number of PSFs per wavelength |
--oversampling |
2 |
Detector oversampling factor |
--pixel-scale |
0.298 |
Detector pixel scale (arcsec/px) |
--optics-version |
2 |
Aperture version |