Porting legacy IDL code to Python
code
astronomy
Translate an IDL routine with a coding agent and prove the Python version gives the same numbers.
AUTHOR = 'Francesco De Gasperin'
MODEL = 'to be tested'
TOOL = 'Coding agent (e.g. Claude Code, Codex)'
TESTED = 'not yet'
QFLAG = 'L0'
TIMESAVE= 'to be measured'
PHASE = 'Data and code'
END
What is this header?
NoteDraft
Outline only. Steps, prompts and checks will be filled in after testing on a real routine.
Goal
Move a working IDL routine to Python with Astropy and NumPy, keeping the numerical results identical within a stated tolerance.
Outline
- Run the original IDL code on two or three real inputs and save the outputs as reference files.
- Ask the agent to write the Python version and a test that compares it with the reference outputs.
- Iterate until the test passes. Review every place where the agent changed the algorithm.
- Check array ordering, indexing from 0 versus 1, and integer division: the classic sources of silent errors.
How to check the result
The test against the IDL reference outputs is the check. A port without it is not finished.
Where it fails
To be documented after testing.
How to cite
BibTeX:
@online{de_gasperin2026,
author = {De Gasperin, Francesco},
title = {Porting Legacy {IDL} Code to {Python}},
date = {2026-10-31},
url = {https://astronomicalintelligence.org/workflows/legacy-idl-to-python.html},
langid = {en}
}
Cite this page as:
De Gasperin, Francesco. 2026. “Porting Legacy IDL Code to
Python.” Astronomical Intelligence, October 31. https://astronomicalintelligence.org/workflows/legacy-idl-to-python.html.