Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
26dc177
Replace optics_manager.surfaces_table.throughput
teutoburg Jul 25, 2025
78ee686
Replace optics_manager.surfaces_table.throughput (#256)
teutoburg Jul 25, 2025
3ea67d6
Pin paramiko to avoid deprecation
teutoburg Aug 4, 2025
61f5412
Also pin paramiko in setup.py
teutoburg Aug 4, 2025
3e51be8
Pin paramiko to avoid deprecation (#257)
teutoburg Aug 4, 2025
5e9f611
Add code to convert METIS LMS traces
oczoske Aug 12, 2025
1e89a7d
Bump actions/checkout from 4 to 5
dependabot[bot] Aug 12, 2025
869435b
Bump actions/checkout from 4 to 5 (#259)
teutoburg Aug 16, 2025
363ebd0
Define lms grid mask
oczoske Aug 18, 2025
901d88a
Define lms grid mask (#260)
oczoske Aug 19, 2025
1f3ff93
Bump actions/setup-python from 5 to 6
dependabot[bot] Sep 4, 2025
a799f88
Bump actions/setup-python from 5 to 6 (#263)
teutoburg Sep 4, 2025
12bc5ee
Updated RO yaml to allow overriding of PSF file in user commands
janusbrink Sep 17, 2025
e4f83e3
Updates to PSF creation utility script to fix WCS and to automate fil…
janusbrink Sep 17, 2025
80d8a4e
Updates to the MICADO spec example based on the latest ScopeSim behav…
janusbrink Sep 17, 2025
4dcddbb
SPEC notebook: Fixed left-over hard-coded paths to local resources.
janusbrink Sep 17, 2025
d1464d5
Renamed PSF creation script and added cmdline arguments
janusbrink Sep 18, 2025
0bcd51a
Update MICADO_Standalone_RO.yaml
oczoske Sep 18, 2025
713ccdd
MICADO LSS - updates to example notebook and PSF generation script (#…
janusbrink Sep 19, 2025
6e903c9
Update README.md
teutoburg Sep 19, 2025
5312de5
Update README.md
teutoburg Sep 19, 2025
34611cb
Actually add the command-line parameters to PSF tool
janusbrink Sep 19, 2025
473193f
Actually add the command-line parameters to PSF tool (#266)
janusbrink Sep 19, 2025
ad40326
Added MICADO rectify traces example notebook
janusbrink Sep 19, 2025
4b738e1
Comment out link to to irb location
janusbrink Sep 20, 2025
7c5e359
Added MICADO rectify traces example notebook (#267)
janusbrink Sep 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/badge_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:
name: Generate Badges
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: 3.12

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/notebooktests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ jobs:
name: Run MICADO Notebooks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
# No matrix is used since this is a time-consuming task.
python-version: 3.11
Expand Down Expand Up @@ -89,9 +89,9 @@ jobs:
name: Run METIS Notebooks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
# No matrix is used since this is a time-consuming task.
python-version: 3.11
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ jobs:
python-version: ['3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

Expand Down
10 changes: 5 additions & 5 deletions HAWKI/test_hawki/test_full_package_hawki.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ def test_works_seamlessly_for_hawki_package(self, capsys):

# test that we have a system throughput
wave = np.linspace(0.7, 2.5, 181) * u.um
tc = opt.optics_manager.surfaces_table.throughput
ec = opt.optics_manager.surfaces_table.emission
tc = opt.optics_manager.system_transmission
# ec = opt.optics_manager.surfaces_table.emission
# ..todo:: something super wierd is going on here when running pytest in the top directory
# ..todo:: perhaps this is has to be relaxed due to different filter
# assert 0.5 < np.max(tc(wave)).value < 0.55
Expand All @@ -91,9 +91,9 @@ def test_works_seamlessly_for_hawki_package(self, capsys):
plt.plot(wave, tc(wave))
plt.show()

if PLOTS:
plt.plot(wave, ec(wave))
plt.show()
# if PLOTS:
# plt.plot(wave, ec(wave))
# plt.show()

# test that we have the correct number of FOVs for Ks band
# assert len(opt.fov_manager.fovs) == 18
Expand Down
2 changes: 1 addition & 1 deletion LFOA/tests/test_lfoa.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_something_comes_out(self):
if PLOTS:
plt.subplot(121)
wave = np.arange(3000, 11000)
plt.plot(wave, lfoa.optics_manager.surfaces_table.throughput(wave))
plt.plot(wave, lfoa.optics_manager.system_tranmission(wave))

plt.subplot(122)
im = hdus[0][1].data
Expand Down
9 changes: 9 additions & 0 deletions METIS/code/LMS_Traces/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
This directory contains a script `write_aperture_list.py`, which converts
Alistair Glasse's LMS distortion files into FITS format as required by
Scopesim. The required input files `lms_dist_poly.txt` and `lms_dist_wcal.txt`
for the nominal distortion solution are provided (gunzip before use).

The file `TRACE_LMS.fits` that is included in the METIS instrument package was
originally created using the script (2021-09-08). The second extension was
edited by hand on 2022-05-13 to reflect a change in the slice length (columns
`xi_min` and `xi_max`). The script includes that change.
Binary file added METIS/code/LMS_Traces/lms_dist_poly.txt.gz
Binary file not shown.
Binary file added METIS/code/LMS_Traces/lms_dist_wcal.txt.gz
Binary file not shown.
101 changes: 101 additions & 0 deletions METIS/code/LMS_Traces/write_aperture_list.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
"""
Script to convert Alistair Glasse's LMS distortion files to FITS

The file requires two input files defined as WCAL_FILE and POLY_FILE below.
The output is a FITS file named TRACE_LMS.fits.
"""
import numpy as np
from astropy.io import fits
from astropy.io import ascii as ioascii

NSLICE = 28
SLITLENGTH = 109.4 # originally 122
SLICEWIDTH = 0.0207
PIXSCALE = 0.0082

WCAL_FILE = "lms_dist_wcal.txt"
POLY_FILE = "lms_dist_poly.txt"

def aperture_list():
slice_id = np.arange(NSLICE) + 1
xi_max = np.array([SLITLENGTH * PIXSCALE / 2] * NSLICE)
xi_min = -xi_max
eta_min = (np.arange(NSLICE) - NSLICE / 2) * SLICEWIDTH
eta_max = eta_min + SLICEWIDTH
angle = np.array([0] * NSLICE)
conserve_image = [True] * NSLICE
shape = ["rect"] * NSLICE

hdu = fits.BinTableHDU.from_columns(
[fits.Column(name='id', format='I2', array=slice_id),
fits.Column(name='left', format='F.4', array=xi_min, unit="arcsec"),
fits.Column(name='right', format='F.4', array=xi_max, unit="arcsec"),
fits.Column(name='top', format='F.4', array=eta_max, unit="arcsec"),
fits.Column(name='bottom', format='F.4', array=eta_min, unit="arcsec"),
fits.Column(name='angle', format='F.1', array=angle, unit="deg"),
fits.Column(name='conserve_image', format='A4', array=conserve_image),
fits.Column(name='shape', format='A6', array=shape)
])
hdu.header['EXTNAME'] = "Aperture List"
hdu.header['DESCRIPT'] = "Aperture List for METIS LMS, nominal mode"
hdu.header['X_UNIT'] = "arcsec"
hdu.header['Y_UNIT'] = "arcsec"
hdu.header['ANGLE_UNIT'] = "deg"
return hdu

def wcal():
wcal = ioascii.read(WCAL_FILE, comment="^#", format="csv")
wcal['c0'].unit = "deg / um"
wcal['c1'].unit = "deg"
wcal['ic0'].unit = "um / deg"
wcal['ic1'].unit = "um"
hdu = fits.table_to_hdu(wcal)
hdu.header['EXTNAME'] = "WCAL"
return hdu


def poly():
poly = ioascii.read(POLY_FILE, comment="^#", format="csv")
hdu = fits.table_to_hdu(poly)
hdu.header['EXTNAME'] = "Polynomial coefficients"
return hdu

def catalogue():
desc = fits.Column(name="description", format="10A",
array=["APERTURE", "WCAL", "POLY"])
ext_id = fits.Column(name="extension_id", format="I",
array=[2, 3, 4])
aperture_id = fits.Column(name="aperture_id", format="I",
array=[0, 0, 0])
image_plane_id = fits.Column(name="image_plane_id", format="I",
array=[0, 0, 0])
hdu = fits.BinTableHDU.from_columns([desc, ext_id, aperture_id, image_plane_id])
hdu.header['EXTNAME'] = "Catalogue"
return hdu

if __name__ == "__main__":

pheader = fits.Header()
pheader['AUTHOR'] = "Oliver Czoske"
pheader['DATE'] = '2021-09-08'
pheader['ORIGDATE'] = '2021-09-08'
pheader['STATUS'] = 'Design'
pheader['SOURCE'] = "E-REP-ATC-MET-1003_2-0, E-REP-ATC-MET-1016_1-0"
pheader['DESCRIPT'] = "METIS LMS trace layout and slice definition"
pheader['DATE_CRE'] = "2021-09-08"
pheader['DATE_MOD'] = "2025-08-12"
pheader['FILETYPE'] = "Spectral Layout Definition"
pheader['ECAT'] = 1
pheader['EDATA'] = 2

primary_hdu = fits.PrimaryHDU(header=pheader)
catalogue_hdu = catalogue()
aperture_hdu = aperture_list()
wcal_hdu = wcal()
poly_hdu = poly()
hdul = fits.HDUList([primary_hdu,
catalogue_hdu,
aperture_hdu,
wcal_hdu,
poly_hdu])
hdul.writeto("TRACE_LMS.fits", overwrite=True)
38 changes: 38 additions & 0 deletions METIS/wcu/fp_mask_grid_lms.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# description : WCU focal plane mask, grid LMS
# name : WCU FP mask
# author : Oliver Czoske
# source : LMS_astrometric_calibration_mask.pdf, RvB
# date_created : 2025-08-02
# date_modified : 2025-08-02
# status : Design
# type : aperture:aperture_mask
# x_unit : arcsec
# y_unit : arcsec
# diam_unit : arcsec
# changes :
#
x y diam
-0.320850 0.320850 0.007539
-0.155250 0.320850 0.007539
0.010350 0.320850 0.007539
0.175950 0.320850 0.007539
0.341550 0.320850 0.007539
-0.320850 0.155250 0.007539
-0.155250 0.155250 0.007539
0.010350 0.155250 0.007539
0.175950 0.155250 0.007539
0.341550 0.155250 0.007539
-0.320850 -0.010350 0.007539
-0.155250 -0.010350 0.007539
0.010350 -0.010350 0.007539
0.175950 -0.010350 0.007539
0.341550 -0.010350 0.007539
-0.320850 -0.175950 0.007539
0.010350 -0.175950 0.007539
0.175950 -0.175950 0.007539
0.341550 -0.175950 0.007539
-0.320850 -0.341550 0.007539
-0.155250 -0.341550 0.007539
0.010350 -0.341550 0.007539
0.175950 -0.341550 0.007539
0.341550 -0.341550 0.007539
3 changes: 2 additions & 1 deletion MICADO/MICADO_Standalone_RO.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ description : Simple stand-alone relay optics module

properties :
temperature : "!ATMO.temperature"
psf_file: "PSF_SCAO_ConstPSF_0_5off.fits"

effects :
- name : relay_psf
description : SCAO PSF
class : FieldConstantPSF
kwargs:
filename : PSF_SCAO_ConstPSF_0_5off.fits
filename : "!RO.psf_file"
warning : "Default PSF is NOT field varying. See documentation."

- name: relay_surface_list
Expand Down
55 changes: 55 additions & 0 deletions MICADO/code/make_scao_psf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
from astropy.io import fits
import anisocado as aniso
import argparse


def make_standard_scao_constpsf(psf_size: int = 256, offset: float = 5.0):
waves = [1.2, 1.6, 2.15]
psfs = []
offset = 5

# override header to place PSF in the centre of the WCS
hdukeys = {
"CRPIX1" : int(psf_size/2) + 1,
"CRPIX2" : int(psf_size/2) + 1,
"CRVAL1" : 0,
"CRVAL2" : 0,
}

for wave in waves:
psf = aniso.AnalyticalScaoPsf(pixelSize=0.004, N=psf_size, wavelength=wave)
psf.shift_off_axis(0, offset)
hdr = psf.hdu.header
hdr.update(hdukeys)
psfs += [fits.ImageHDU(psf.hdu.data, header=hdr)]

keys = {"AUTHOR" : "Kieran Leschinski",
"DATE_CRE" : "2019-07-30",
"DATE_MOD" : "2019-07-30",
"SOURCE" : "AnisoCADO",
"STATUS" : "Best guess for a standard observations",
"ETYPE" : "CONSTPSF",
"ECAT" : (-1, "Field constant. No layer catalogue"),
"EDATA" : (1, "PSFs begin from EXT 1"),
"XOFFSET": (0, "[arcsec] offset from NGS"),
"YOFFSET": (offset, "[arcsec] offset from NGS"),
}

pri = fits.PrimaryHDU()
pri.header.update(keys)

hdus = fits.HDUList([pri] + psfs)
hdus.writeto(f"SCAO_ConstPSF_{offset}off_{psf_size}.fits", overwrite=True)
print(hdus.info())

if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--psfsize', help='size of the PSF image in pixels',
type=int, default=256)
parser.add_argument('--offset',
help='psf offset from optical axis in arcseconds',
type=float, default=5.0)
parser.print_usage()
args = parser.parse_args()

make_standard_scao_constpsf(args.psfsize, args.offset)
Loading