Eric Tittley's Matlab/Octave Astronomy Library
Welcome to my Matlab/Octave Astronomy Library.
The long term goal of this archive is to provide an archive of Matlab/Octave code supplied by the astronomical community at large. However, at the moment the bulk of the code has been contributed by me and Dave Holmgren.
Matlab is an interactive programme from The MathWorks for numerical computation and data visualization.
Octave is an OpenSource numerical package with a syntax similar (approaching identical as Octave approaches release 3.0) to Matlab. Currently I strive to write code that is compatible with both Matlab and Octave. I encourage others to do the same where possible.
Both Matlab and Octave are similar to IDL. IDL is already commonly used for data analysis in astronomy. There is an extensive library of IDL code for astronomy hosted by GSFC.
If you wish to contribute code, please contact
Eric Tittley at www.hmet.net.
Be sure to include sufficient documentation so that others may be able to use the code. All contributions are welcome!
Other resources
Matlab/Octave Astronomy Library
DSS
- dsspos
-
Convert DSS (Digital Sky Survey) pixel positions into RA and DEC.
Hydrodynamics
- drag_coef
-
The coefficient of drag, given the Reynold's number.
- drag_force
-
The force of drag on a sphere.
-
dynamic_viscosity
-
Dynamical viscosity.
-
impact_parameter
-
Impact parameter.
- Reynolds_number
-
Reynold's number of a sphere in a gas.
Math
- cbell
- Cosine bell.
- cerf: Complex error function.
-
Function to evaluate complex error function for any z = x + i*y. This uses
Hui's rational approximation. Real part is Voigt function, imaginary part is
dispersion (ie., complex index of refraction). Works for both scalars and
vectors. Have not yet made function applicable to whole z-plane.
- ssmat2
- Generate Simon and Sturm matrices.
- ssmatr2
- Generate Simon and Sturm matrices for fractional pixels.
- Gram-Schmidt Orthonormalization
-
Function to perform the orthonormalization on a set of vectors using the
Gram-Schmidt method. The input array, z, is expected to be row vectors,
usually with the lowest order vector in z(1,:).
Optimization
-
cbcg:
Complex bi-conjugate gradient method for solving linear systems.
-
Routine for complex bi-conjugate gradient method for
solving linear systems. Can be used for complex quantities,
but real variables are used here. Based on discussion by
Jacobs in "Sparse matrices and their uses", ed. I.S. Duff.
Designed for use with square (nl x nl) systems.
-
cgls:
Conjugate gradient least squares.
-
Applies conjugate gradient method to a linear least-squares problem. Based on
algorithm given in paper by Paige and Saunders. ref: ACM Trans. Math.
Software, v 8 , pp 43 - 71, 1982.
- gsvd
- Generalized Singular Value Decomposition
- Linear least squares solver
-
Routine LSQR from Paige and Saunders to solve linear least-squares problems.
Signal Processing
- cohrnce
- Coherence function.
- decpro: Fourier deconvolution.
-
Function to do Fourier deconvolution. Applied to stellar line profile given
an instrumental profile.
-
decnv:
Fourier deconvolution with filtering.
-
Fourier deconvolution with either Gaussian or Voigt noise filtering. Uses
cbell.
- dft: Discrete Fourier transform
- Basic unevenly spaced DFT routine.
-
fbt:
Hankel transform using backprojection method.
-
Function to compute Hankel transform using backprojection method. This
version for nth-order transforms.
-
gccf: Generalized correlation functions.
-
Routine for computing the generalized correlation functions: standard ccf,
SCOT, PHAT, and Roth functions.
-
haar: Haar wavelet transform
haar_inv: inverse Haar transform
-
These tools let one experiment with the simplest of wavelet transforms.
- hilbert
- Hilbert transform.
-
lucy:
Deconvolution using a damped Richardson-Lucy method with low-pass filtering.
-
Please see A damped, low-pass
filtered Richardson-Lucy algorithm for deconvolution as applied to
spectra.
-
opt_filt:
Low-pass filtering of evenly spaced data
-
This function cleans a regularly-spaced data series of high frequency noise
by low-pass filtering the Fourier transform of the data. The low pass filter
is an optimal filter in the sense of Brault and White (1971, Astronomy and
Astrophysics, Vol 13, p. 169).
- taper: Cosine bell tapering.
- To be used with cross-correlation routine.
Spectral Analysis
-
abscof: Line absorption coefficients.:
-
Interactive routine for computing line absorption coefficient for molecules
in the atmosphere. Operates in physical variables. Karp's method (JQSRT 20,
379, 1978) is used.
- bgen: Artificial binary spectra.
- Routine to generate artificial spectra of binary stars.
-
contfind:
Continuum-flatten a spectrum.
-
Returns the contiuum-flattend spectrum (set to 1) of a stellar spectrum.
-
dfft2:
Disentanglement of composite spectra.
-
Disentangling via FFT for a spectroscopic binary spectrum with observations
at a variety of phases.
- gauss: Gaussian Profile.
-
This function returns a Gaussian profile vector with the parameters given by
the input.
- gaussian: Gaussian Profile.
-
Another Guassian profile generator. This supplies a Gaussian which
integrates to unity.
- ip_fit
- Interactively fit instrumental profiles to arc data.
- lorentz: Lorentz Profile.
-
This function returns a Lorentzian profile vector with the parameters given
by the input.
-
linefind:
Find the approximate locations of lines in a spectrum.
-
Find spectral lines in a set of data. Actually, this function finds and
returns the positions of local minima. It is not a very complicated routine.
It is used in other routines as a first scan for lines.
-
louvl: Line absorption coefficients II.
-
It uses a matrix method based on a quantum-mechanical operator to compute an
absorption coefficient spectrum. This is a preliminary version that will
eventually take into account overlapping lines, a physical effect a bit more
subtle than simple line blending.
-
mask2:
Continuum searching and mask creation
-
This function creates a mask for a spectrum to isolate regions of continuum.
- rotpro
- Phase-dependent rotation profile.
- rv
- Compute RV's from spectra interactively.
-
ssnormal:
Construct normal equations for spectral disentangling problem.
-
Requires:
-
triatom:
Triatomic Euler and Green functions integration.
-
Routine for integrating Euler's rigid body equations and Green's function for
a triatomic molecule. For ab initio IR spectra.
Stellar parameters
- flux
- Flux from a limb darkened spherical star.
- flux2
- Flux from a limb darkened non-spherical star.
- flux3
- Flux from a non-spherical star.
- frot2: Radius of a rotating star.
-
Function to compute normalised radius of a rotating star. Equations from
Collins, 1963.
- grot
- Local surface gravity for a rotating star.
- tempr
- Local effective temperature for a rotating star.
Last Modified 060301