The repository contains a Python module with a set of functions for spectroastrometric data processing, as well as a usage example. The method is described in the paper Whelan & Garcia 2008.
Place the Spectroastrometry.py file in your Python project directory and import it as a standard library: Spectroastrometry.
Below is a list of the module's functions, their descriptions, and parameters.
Approximation with a "positive" Gaussian function for the intensity profile.
Arguments:
| Parameter | Description |
|---|---|
coord |
array of coordinates (pixels) |
I |
array of intensities (ADU) |
Returns:
P— array of model parameters:
P[0]— integrated intensity,
P[1]— standard deviation,
P[2]— center position,
P[3]— background.
Note:
G_fit uses the error function erf to model a discrete Gaussian profile.
Approximation with a "negative" Gaussian function (for absorption lines).
Arguments:
| Parameter | Description |
|---|---|
coord |
array of coordinates (pixels) |
I |
array of intensities (ADU) |
Returns:
P— array of model parameters (similar toG_fit, but for absorption).
Calculation of the observed shift and FWHM along the spectral slice for all spectral points along the dispersion direction.
Arguments:
| Parameter | Description |
|---|---|
CRVAL1 |
starting wavelength value of the spectrum (λ) |
CDELT1 |
dispersion (Δλ/pixel) |
x_start |
starting X pixel |
x_end |
ending X pixel |
area |
half-width of the selected analysis region along Y |
Y_est |
estimated spectrum center along Y |
image |
2D image array |
Returns:
LAMBDA— array of wavelengthsSPEC— spectrumCENTER— center coordinates along Y for each XFWHM— full width at half maximum for each XERRORBAR— uncertainty in the center determination
Note:
The uncertainty is calculated according to Condon, 1977 using the formula:
where
Estimate of the true shift based on a spectral line (automatic line center search). This is done by computing the brightness profiles of the spectrum in the region of the selected line's maximum, as well as with some offset from it (where only the continuum is present). Subtracting the continuum yields the pure line profile, whose center corresponds to the true position of the source emitting in this line.
Arguments:
| Parameter | Description |
|---|---|
CRVAL1 |
starting λ value |
CDELT1 |
dispersion (Δλ/pixel) |
image |
2D image |
LAMBDA |
array of wavelengths (from Center_search) |
SPEC |
spectrum (from Center_search) |
x_start |
line start (pixel) |
x_end |
line end (pixel) |
x_cont |
X-coordinate of the point selected for continuum determination |
Y_est |
estimated center along Y |
area |
half-width of the region along Y |
Line_type |
line type: 'emission' or 'absorption' |
Returns:
P4— parameters of the line model after continuum subtraction- Position of the line center in pixels
Estimate of the true shift based on a line with a manually specified center.
Arguments:
| Parameter | Description |
|---|---|
image |
2D image |
x_line |
pixel of the line center |
x_cont |
pixel for continuum |
Y_est |
estimated center along Y |
area |
half-width of the region along Y |
Returns:
P4— parameters of the line modelP3— parameters of the background (continuum)
Median processing of a set of images.
Arguments:
| Parameter | Description |
|---|---|
images |
list of 2D arrays of the same size |
Returns:
median_image— median image
Averaging of a set of images.
Arguments:
| Parameter | Description |
|---|---|
images |
list of 2D arrays of the same size |
Returns:
average_image— averaged image
Trend removal using a rolling mean method.
Arguments:
| Parameter | Description |
|---|---|
window |
rolling mean window width |
CENTER |
array of center values |
Returns:
CENTER_rolling— centers after trend removalrolling_mean— rolling mean
Removal of an n-th degree polynomial trend.
Arguments:
| Parameter | Description |
|---|---|
data |
2D data array (e.g., CENTER) |
n |
polynomial degree |
Returns:
detrended_data— detrended data
Plots a 3D graph of a selected region of the image.
Arguments:
| Parameter | Description |
|---|---|
image |
2D image |
x_start |
start X |
x_end |
end X |
y_start |
start Y |
y_end |
end Y |
numpymatplotlib.pyplotscipy.optimize.least_squaresscipy.special.erf
Contact me: lashinda@my.msu.ru