Read routines for CASA simulations
Routines to read in results from a CASA simulation.
Usage example
Source documentation
- class prodimopy.read_casasim.CasaSim(fn_prefix, directory='.', systemic_velocity=0.0, distance=None, coordinates=None, fn_cube='.cube.fits', fn_cube_diff='.cube.diff.fits', fn_integrated='.cube.integrated.fits', fn_integrated_diff='.cube.integrated.diff.fits', fn_radprof='.cube.integrated.radial', fn_specprof='.cube.specprof', fn_mom1='.cube.mom1.fits', fn_mom1_diff='.cube.mom1.diff.fits', fn_pv='.cube.pv.fits', fn_pv_diff='.cube.pv.diff.fits', fn_cont='.cont.fits', fn_cont_diff='.cont.diff.fits', fn_cont_radprof='.cont.radial')[source]
Data container for a CASA line simulation (observations).
The class can be used to quickly read in a CASA simulation for a single spectral line. The main purpose is to read in the various different kind of observables which have been produced by CASA.
- Can deal with the following files wiht a given PREFIX
PREFIX.cube.fits the spectral line cube
PREFIX.cube.integrated.fits the integrated line emission (zeroth moment)
PREFIX.cube.integrated.radial the azimuthally averaged radial profile (text file produce by casairing task)
PREFIX.cube.specprof the spectral line profile (text file produced by CASA)
PREFIX.cube.mom1.fits the first moment of the line emission
PREFIX.cube.pv.fits the position velocity diagram
PREFIX.cont.fits the corrresponding continuum
PREFIX.cont.radial the azimuthally average radial continuum profile
During the init of this Class it is tried to read all this files. However, all of them are optional and the according attribute is set to None in case the file could not be read.
- Parameters:
fn_prefix (str) – the prefix used for all files the routine try to read
directory – the directory with the files (optional)
systemic_velocity (float) – the systemic_velocity of the target (optional)
distance (float) – the distance of the target (optional). Try to read it from the fits file in case of synthetic ProDiMo observations
coordinates (
astropy.coordinates.sky_coordinate.SkyCoordinate
) – the coordinates of the target/object including the distance FIXME: Note used yet!fn* (string) – The fn* parameters can be use to change the filenames for the different files.
- Attributes:
systemic_velocity (float) – the systemic velocity of the target, will be passed to the other objects
distance (float) – the distance of the target, will be passed to the other objects
cube :class:`.LineCube` – the line cube.
integrated (
LineIntegrated
) – the zeroth moment of the cube (integrated emission)specprof (
LineSpectralProfile
) – the spectral profileradprof (
RadialProfile
) – the spectra profilemom1 (
LineMom1
) – the first moment of the cubepv (
LinePV
) – the position-velocity diagramcont (
Continuum
) – the associated continuumcont_rad (
RadialProfile
) – the radial profile of the continuum
- property species
Returns the molecular species from the fits file
- property restfrq
Restfrequency of the line in GHz
- property restwl
Restwavelength of the line in micrometer
- class prodimopy.read_casasim.CasaSimContinuum(fn_prefix, directory='.', distance=None, coordinates=None, fn_cube='.cube.fits', fn_radprof='.cube.radial')[source]
Data container for a CASA continuum simulation (observations).
The class can be used to quickly read in a CASA simulation for a single spectral line. The main purpose is to read in the various different kind of observables which have been produced by CASA.
- Can deal with the following files wiht a given PREFIX
PREFIX.contcube.fits the spectral line cube
PREFIX.cont.radial the azimuthally average radial continuum profile
During the init of this Class it is tried to read all this files. However, all of them are optional and the according attribute is set to None in case the file could not be read.
- Parameters:
fn_prefix (str) – the prefix used for all files the routine try to read
directory – the directory with the files (optional)
distance (float) – the distance of the target (optional). Try to fread it from the fits file in case of synthetic ProDiMo observations
coordinates (
astropy.coordinates.sky_coordinate.SkyCoordinate
) – the coordinates of the target/object including the distance FIXME: Note used yet!fn* (string) – The fn* parameters can be use to change the filenames for the different files.
- Attributes:
distance (float) – the distance of the target, will be passed to the other objects
cube :class:`.ContinuumCube` – the continuum cube.
radprof (
RadialProfile
) – the spectra profile
- property restfrq
Restfrequency of the line in GHz
- property restwl
Restwavelength of the line in micrometer
- property species
Returns the molecular species from the fits file
- class prodimopy.read_casasim.CASAImage(filename=None)[source]
Super class for an observable (CASA Simulation or real Observation) for image data including cubes.
Should not be instantiated directly. Opens the fits file and initializes some helper attributes.
Needs to be called from a subclass.
- Parameters:
filename (str) – The file name of the fits file.
centercoords (
astropy.coordinates.sky_coordinate.SkyCoordinate
) – the desired center coordinates
- Attributes:
header – the header of the fits file. It is just a reference to the fits header.
data (array_like(float)) – the fits data. Assumes that is always the image data.
btable (array_like) – an additioanl extension (table). Assumes that it is a table with beam date for e.g. a lie cube
bmaj (float) – the major axis of the beam (same units as in the fits file)
bmin (float) – the minor axis of the beam (same units as in the fits file)
bPA (float) – the beam position angle
centerpix (array_like(float,ndim=1)) – the pixel coordinates of the center (x and y coordinate)
wcsabs (
astropy.wcs.WCS
) – an absulte astropy world coordinate system (for the spatial coordinates). Can be used for plotting transformation.wcsrel (
astropy.wcs.WCS
) – astropy world coordinate system (for the spatial coordinates) relative the the center of the image (centerpix) Can be used for plotting transformation. (see_linear_offset_coords()
)
- cut(x=None, y=None, width=1, normalized=False)[source]
Make a cut along the given x or y coordinate in the image.
- xfloat
make a cut perpenticular to the x-axis a the given position x in arcsec (relative to the center).
- yfloat
make a cut perpenticular to the y-axis a the given position x. in arcsec (relative to the center).
- width :
widht of the cut in pixels. The values are averaged. Must be an odd number
- normalizedboolean
If True the cut is normalized the the peak.
- class prodimopy.read_casasim.LineCube(filename, systemic_velocity=0.0)[source]
The full line cube.
Needs to be called from a subclass.
- Parameters:
filename (str) – The file name of the fits file.
centercoords (
astropy.coordinates.sky_coordinate.SkyCoordinate
) – the desired center coordinates
- Attributes:
header – the header of the fits file. It is just a reference to the fits header.
data (array_like(float)) – the fits data. Assumes that is always the image data.
btable (array_like) – an additioanl extension (table). Assumes that it is a table with beam date for e.g. a lie cube
bmaj (float) – the major axis of the beam (same units as in the fits file)
bmin (float) – the minor axis of the beam (same units as in the fits file)
bPA (float) – the beam position angle
centerpix (array_like(float,ndim=1)) – the pixel coordinates of the center (x and y coordinate)
wcsabs (
astropy.wcs.WCS
) – an absulte astropy world coordinate system (for the spatial coordinates). Can be used for plotting transformation.wcsrel (
astropy.wcs.WCS
) – astropy world coordinate system (for the spatial coordinates) relative the the center of the image (centerpix) Can be used for plotting transformation. (see_linear_offset_coords()
)
- arcsectopix(xarcsec=None)
- cut(x=None, y=None, width=1, normalized=False)
Make a cut along the given x or y coordinate in the image.
- xfloat
make a cut perpenticular to the x-axis a the given position x in arcsec (relative to the center).
- yfloat
make a cut perpenticular to the y-axis a the given position x. in arcsec (relative to the center).
- width :
widht of the cut in pixels. The values are averaged. Must be an odd number
- normalizedboolean
If True the cut is normalized the the peak.
- class prodimopy.read_casasim.LineIntegrated(filename, centercoords=None)[source]
Zeroth moment image (Integrated emission)
Needs to be called from a subclass.
- Parameters:
filename (str) – The file name of the fits file.
centercoords (
astropy.coordinates.sky_coordinate.SkyCoordinate
) – the desired center coordinates
- Attributes:
header – the header of the fits file. It is just a reference to the fits header.
data (array_like(float)) – the fits data. Assumes that is always the image data.
btable (array_like) – an additioanl extension (table). Assumes that it is a table with beam date for e.g. a lie cube
bmaj (float) – the major axis of the beam (same units as in the fits file)
bmin (float) – the minor axis of the beam (same units as in the fits file)
bPA (float) – the beam position angle
centerpix (array_like(float,ndim=1)) – the pixel coordinates of the center (x and y coordinate)
wcsabs (
astropy.wcs.WCS
) – an absulte astropy world coordinate system (for the spatial coordinates). Can be used for plotting transformation.wcsrel (
astropy.wcs.WCS
) – astropy world coordinate system (for the spatial coordinates) relative the the center of the image (centerpix) Can be used for plotting transformation. (see_linear_offset_coords()
)
- arcsectopix(xarcsec=None)
- cut(x=None, y=None, width=1, normalized=False)
Make a cut along the given x or y coordinate in the image.
- xfloat
make a cut perpenticular to the x-axis a the given position x in arcsec (relative to the center).
- yfloat
make a cut perpenticular to the y-axis a the given position x. in arcsec (relative to the center).
- width :
widht of the cut in pixels. The values are averaged. Must be an odd number
- normalizedboolean
If True the cut is normalized the the peak.
- class prodimopy.read_casasim.LineMom1(filename, systemic_velocity=0.0)[source]
First Moment image.
Needs to be called from a subclass.
- Parameters:
filename (str) – The file name of the fits file.
centercoords (
astropy.coordinates.sky_coordinate.SkyCoordinate
) – the desired center coordinates
- Attributes:
header – the header of the fits file. It is just a reference to the fits header.
data (array_like(float)) – the fits data. Assumes that is always the image data.
btable (array_like) – an additioanl extension (table). Assumes that it is a table with beam date for e.g. a lie cube
bmaj (float) – the major axis of the beam (same units as in the fits file)
bmin (float) – the minor axis of the beam (same units as in the fits file)
bPA (float) – the beam position angle
centerpix (array_like(float,ndim=1)) – the pixel coordinates of the center (x and y coordinate)
wcsabs (
astropy.wcs.WCS
) – an absulte astropy world coordinate system (for the spatial coordinates). Can be used for plotting transformation.wcsrel (
astropy.wcs.WCS
) – astropy world coordinate system (for the spatial coordinates) relative the the center of the image (centerpix) Can be used for plotting transformation. (see_linear_offset_coords()
)
- arcsectopix(xarcsec=None)
- cut(x=None, y=None, width=1, normalized=False)
Make a cut along the given x or y coordinate in the image.
- xfloat
make a cut perpenticular to the x-axis a the given position x in arcsec (relative to the center).
- yfloat
make a cut perpenticular to the y-axis a the given position x. in arcsec (relative to the center).
- width :
widht of the cut in pixels. The values are averaged. Must be an odd number
- normalizedboolean
If True the cut is normalized the the peak.
- class prodimopy.read_casasim.LinePV(filename, systemic_velocity=0.0)[source]
Position-Velocity diagramm.
Needs to be called from a subclass.
- Parameters:
filename (str) – The file name of the fits file.
centercoords (
astropy.coordinates.sky_coordinate.SkyCoordinate
) – the desired center coordinates
- Attributes:
header – the header of the fits file. It is just a reference to the fits header.
data (array_like(float)) – the fits data. Assumes that is always the image data.
btable (array_like) – an additioanl extension (table). Assumes that it is a table with beam date for e.g. a lie cube
bmaj (float) – the major axis of the beam (same units as in the fits file)
bmin (float) – the minor axis of the beam (same units as in the fits file)
bPA (float) – the beam position angle
centerpix (array_like(float,ndim=1)) – the pixel coordinates of the center (x and y coordinate)
wcsabs (
astropy.wcs.WCS
) – an absulte astropy world coordinate system (for the spatial coordinates). Can be used for plotting transformation.wcsrel (
astropy.wcs.WCS
) – astropy world coordinate system (for the spatial coordinates) relative the the center of the image (centerpix) Can be used for plotting transformation. (see_linear_offset_coords()
)
- arcsectopix(xarcsec=None)
- cut(x=None, y=None, width=1, normalized=False)
Make a cut along the given x or y coordinate in the image.
- xfloat
make a cut perpenticular to the x-axis a the given position x in arcsec (relative to the center).
- yfloat
make a cut perpenticular to the y-axis a the given position x. in arcsec (relative to the center).
- width :
widht of the cut in pixels. The values are averaged. Must be an odd number
- normalizedboolean
If True the cut is normalized the the peak.
- class prodimopy.read_casasim.LineSpectralProfile(filename, systemic_velocity=0.0)[source]
The spectral line profile.
Reads a spectral profile produced with CASA.
- class prodimopy.read_casasim.RadialProfile(filename, bwidth=None)[source]
Azimuthally averaged radial intensity profile.
Reads a file produced by the casa taks casairing. see https://www.oso.nordic-alma.se/software-tools.php
- class prodimopy.read_casasim.Continuum(filename)[source]
A continuum image.
Needs to be called from a subclass.
- Parameters:
filename (str) – The file name of the fits file.
centercoords (
astropy.coordinates.sky_coordinate.SkyCoordinate
) – the desired center coordinates
- Attributes:
header – the header of the fits file. It is just a reference to the fits header.
data (array_like(float)) – the fits data. Assumes that is always the image data.
btable (array_like) – an additioanl extension (table). Assumes that it is a table with beam date for e.g. a lie cube
bmaj (float) – the major axis of the beam (same units as in the fits file)
bmin (float) – the minor axis of the beam (same units as in the fits file)
bPA (float) – the beam position angle
centerpix (array_like(float,ndim=1)) – the pixel coordinates of the center (x and y coordinate)
wcsabs (
astropy.wcs.WCS
) – an absulte astropy world coordinate system (for the spatial coordinates). Can be used for plotting transformation.wcsrel (
astropy.wcs.WCS
) – astropy world coordinate system (for the spatial coordinates) relative the the center of the image (centerpix) Can be used for plotting transformation. (see_linear_offset_coords()
)
- arcsectopix(xarcsec=None)
- cut(x=None, y=None, width=1, normalized=False)
Make a cut along the given x or y coordinate in the image.
- xfloat
make a cut perpenticular to the x-axis a the given position x in arcsec (relative to the center).
- yfloat
make a cut perpenticular to the y-axis a the given position x. in arcsec (relative to the center).
- width :
widht of the cut in pixels. The values are averaged. Must be an odd number
- normalizedboolean
If True the cut is normalized the the peak.
- class prodimopy.read_casasim.ContinuumCube(filename)[source]
A series of continuum images
Uses the output images from the ProDiMo continuum radiative transfer. Need to check if this also works with the CASA simulator.
Needs to be called from a subclass.
- Parameters:
filename (str) – The file name of the fits file.
centercoords (
astropy.coordinates.sky_coordinate.SkyCoordinate
) – the desired center coordinates
- Attributes:
header – the header of the fits file. It is just a reference to the fits header.
data (array_like(float)) – the fits data. Assumes that is always the image data.
btable (array_like) – an additioanl extension (table). Assumes that it is a table with beam date for e.g. a lie cube
bmaj (float) – the major axis of the beam (same units as in the fits file)
bmin (float) – the minor axis of the beam (same units as in the fits file)
bPA (float) – the beam position angle
centerpix (array_like(float,ndim=1)) – the pixel coordinates of the center (x and y coordinate)
wcsabs (
astropy.wcs.WCS
) – an absulte astropy world coordinate system (for the spatial coordinates). Can be used for plotting transformation.wcsrel (
astropy.wcs.WCS
) – astropy world coordinate system (for the spatial coordinates) relative the the center of the image (centerpix) Can be used for plotting transformation. (see_linear_offset_coords()
)
- arcsectopix(xarcsec=None)
- cut(x=None, y=None, width=1, normalized=False)
Make a cut along the given x or y coordinate in the image.
- xfloat
make a cut perpenticular to the x-axis a the given position x in arcsec (relative to the center).
- yfloat
make a cut perpenticular to the y-axis a the given position x. in arcsec (relative to the center).
- width :
widht of the cut in pixels. The values are averaged. Must be an odd number
- normalizedboolean
If True the cut is normalized the the peak.