Package ivs :: Package sed :: Module extinctionmodels
[hide private]
[frames] | no frames]

Module extinctionmodels

source code

Extinction models of Arenou, Drimmel and Marschall

Uniformly rewritten by K. Smolders

Functions [hide private]
    Top level wrapper
float
findext(lng, lat, model='drimmel', distance=None, **kwargs)
Get the "model" extinction at a certain longitude and latitude.
source code
    Arenou 3D extinction model
float
findext_arenou(ll, bb, distance=None, redlaw='cardelli1989', Rv=3.1, norm='Av')
Find the predicted V-band extinction (Av) according to the 3D model for galactic extinction of Arenou et al, "Modelling the Galactic interstellar extinction distribution in three dimensions", Arenou et al, "A tridimensional model of the galactic interstellar extinction" published in Astronomy and Astrophysics (ISSN 0004-6361), vol.
source code
 
_getarenouparams(ll, bb)
Input: galactic coordinates Output: Arenou 1992 alpha, beta, gamma, rr0, saa
source code
    Marshall 3D extinction model
 
get_marshall_data()
Read in the Marshall data
source code
float
findext_marshall(ll, bb, distance=None, redlaw='cardelli1989', Rv=3.1, norm='Av', **kwargs)
Find the V-band extinction according to the reddening model of Marshall et al.
source code
    Drimmel 3D extinction model presented in Drimmel et al. in
float
findext_drimmel(lng, lat, distance=None, rescaling=True, redlaw='cardelli1989', Rv=3.1, norm='Av', **kwargs)
Procedure to retrieve the absorption in V from three-dimensional grids, based on the Galactic dust distribution of Drimmel & Spergel.
source code
 
_pix2xy(pixel, resolution, sixpack=0)
_pix2xy creates a raster image (sky cube or face) given a pixelindex and a resolution The data array can be either a vector or two-dimensional array.
source code
 
_rastr(pixel, resolution)
SMOLDERS SEAL OF APPROVAL
source code
 
_pix2fij(pixel, resolution)
This function takes an n-element pixel array and generates an n by 3 element array containing the corresponding face, column, and row number (the latter two within the face).
source code
 
_incube(alpha, beta) source code
ndarray
_ll2uv(lng, lat)
Convert longitude, latitude to unit vectors SMOLDERS SEAL OF APPROVAL
source code
 
_galvec2eclvec(in_uvec)
Unitvector for galactic coordinates to unitvector for ecliptic coordinates SMOLDERS SEAL OF APPROVAL
source code
 
_axisxy(vector)
converts unitvector into nface number (0-5) and X,Y in range 0-1 SMOLDERS SEAL OF APPROVAL
source code
 
_fij2pix(fij, res)
This function takes an n by 3 element vector containing the face, column, and row number (the latter two within the face) of a pixel and converts it into an n-element pixel array for a given resolution.
source code
 
_uv2pix(vector, resolution)
Routine returns pixel number given unit vector pointing to center of pixel resolution of the cube.
source code
ndarray

(Note: The default coordinate system for pixels is ecliptic.)

_ll2pix(lng, lat, res=9)
_ll2pix is a python function to convert galactic coordinates to DIRBE pixels (coorconv([lng,lat], infmt='L', outfmt='P', inco='G', outco='R9'))
source code
 
_trint(mm, x, y, z, missing=None)
Pixel-based trilinear interpolation, where mm is a 3d data cube.
source code
    Schlegel 3D extinction model presented in Schlegel et al.
 
get_schlegel_data_south() source code
 
get_schlegel_data_north() source code
ndarray
_lb2xy_schlegel(ll, bb)
Converts coordinates in lattitude and longitude to coordinates in x and y pixel coordinates.
source code
 
findext_schlegel(ll, bb, distance=None, redlaw='cardelli1989', Rv=3.1, norm='Av', **kwargs)
Get the "Schlegel" extinction at certain longitude and latitude
source code
Variables [hide private]
  logger = logging.getLogger("SED.EXT")
    Drimmel 3D extinction model presented in Drimmel et al. in
  avdisk = pf.getdata(config.get_datafile('drimmel', "avdisk.fit...
  avloc = pf.getdata(config.get_datafile('drimmel', "avloc.fits"))
  avspir = pf.getdata(config.get_datafile('drimmel', "avspir.fit...
  avdloc = pf.getdata(config.get_datafile('drimmel', "avdloc.fit...
  avori = pf.getdata(config.get_datafile('drimmel', "avori.fits"))
  coordinates = pf.getdata(config.get_datafile('drimmel', "coord...
  avgrid = pf.getdata(config.get_datafile('drimmel', "avgrid.fit...
  avori2 = pf.getdata(config.get_datafile('drimmel', "avori2.fit...
  rf_allsky = pf.getdata(config.get_datafile('drimmel', "rf_alls...
  glat = rf_allsky.glat
  glng = rf_allsky.glng
  ncomp = rf_allsky.ncomp
  pnum = rf_allsky.pnum
  rfac = rf_allsky.rfac
  g2e = array([[-0.054882486,-0.993821033,-0.096476249], [0.4941...
Function Details [hide private]

findext(lng, lat, model='drimmel', distance=None, **kwargs)

source code 

Get the "model" extinction at a certain longitude and latitude.

Find the predicted V-band extinction (Av) based on three dimensional models of the galactic interstellar extinction. The user can choose between different models by setting the model keyword:

1) "arenou": model from Arenou et al. (1992). 2) "schlegel": model from Schlegel et al. (1998) 3) "drimmel": model from Drimmel et al. (2003) 4) "marshall": model from Marshall et al. (2006)

example useage:

  1. Find the total galactic extinction for a star at galactic lattitude 10.2 and longitude 59.0 along the line of sight, as given by the model of Arenou et al. (1992)
    >>> lng = 10.2
    >>> lat = 59.0
    >>> av = findext(lng, lat, model='arenou')
    >>> print("Av at lng = %.2f, lat = %.2f is %.2f magnitude" %(lng, lat, av))
    Av at lng = 10.20, lat = 59.00 is 0.05 magnitude
  2. Find the extinction for a star at galactic lattitude 107.05 and longitude -34.93 and a distance of 144.65 parsecs, as given by the model of Arenou et al. (1992)
    >>> lng = 107.05
    >>> lat = -34.93
    >>> dd  = 144.65
    >>> av = findext(lng, lat, distance = dd, model='arenou')
    >>> print("Av at lng = %.2f, lat = %.2f and distance = %.2f parsecs is %.2f magnitude" %(lng, lat, dd, av))
    Av at lng = 107.05, lat = -34.93 and distance = 144.65 parsecs is 0.15 magnitude
  3. Find the Marschall extinction for a star at galactic longitude 10.2 and latitude 9.0. If the distance is not given, we return the complete extinction along the line of sight (i.e. put the star somewhere out of the galaxy).
    >>> lng = 10.2
    >>> lat = 9.0
    >>> av = findext(lng, lat, model='marshall')
    >>> print("Av at lng = %.2f, lat = %.2f is %.2f magnitude" %(lng, lat, av))
    Av at lng = 10.20, lat = 9.00 is 10.67 magnitude
  4. Find the Marshall extinction for a star at galactic lattitude 271.05 and longitude -4.93 and a distance of 144.65 parsecs, but convert to Av using Rv = 2.5 instead of Rv = 3.1
    >>> lng = 271.05
    >>> lat = -4.93
    >>> dd  = 144.65
    >>> av = findext(lng, lat, distance = dd, model='marshall', Rv=2.5)
    >>> print("Av at lng = %.2f, lat = %.2f and distance = %.2f parsecs is %.2f magnitude" %(lng, lat, dd, av))
    Av at lng = 271.05, lat = -4.93 and distance = 144.65 parsecs is 13.95 magnitude
  5. Find the extinction for a star at galactic longitude 10.2 and latitude 9.0, using the schlegel model, using Rv=2.9 instead of Rv=3.1
    >>> lng = 58.2
    >>> lat = 24.0
    >>> distance = 848.
    >>> av = findext(lng, lat, distance=distance)
    >>> print("Av at lng = %.2f, lat = %.2f is %.2f magnitude" %(lng, lat, av))
    Av at lng = 58.20, lat = 24.00 is 0.12 magnitude

REMARKS: a) Schlegel actually returns E(B-V), this value is then converted to Av (the desired value for Rv can be set as a keyword; standard sets Rv=3.1) b) Schlegel is very dubious for latitudes between -5 and 5 degrees c) Marschall actually returns Ak, this value is then converted to Av (the reddening law and Rv can be set as keyword; standard sets Rv=3.1, redlaw='cardelli1989') d) Marschall is only available for certain longitudes and latitudes: 0 < lng < 100 or 260 < lng < 360 and -10 < lat < 10

Parameters:
  • lng (float) - Galactic Longitude (in degrees)
  • lat (float) - Galactic Lattitude (in degrees)
  • model (str) - the name of the extinction model: ("arenou", "schlegel", "drimmel" or "marshall"; if none given, the program uses "drimmel")
  • distance (float) - Distance to the source (in parsecs), if the distance is not given, the total galactic extinction along the line of sight is calculated
Returns: float
The extinction in Johnson V-band

findext_arenou(ll, bb, distance=None, redlaw='cardelli1989', Rv=3.1, norm='Av')

source code 

Find the predicted V-band extinction (Av) according to the 3D model for galactic extinction of Arenou et al, "Modelling the Galactic interstellar extinction distribution in three dimensions", Arenou et al, "A tridimensional model of the galactic interstellar extinction" published in Astronomy and Astrophysics (ISSN 0004-6361), vol. 258, no. 1, p. 104-111, 1992

Example usage:

  1. Find the extinction for a star at galactic lattitude 10.2 and longitude 59.0. If the distance is not given, we use the maximal distance r0 for that line of sight, as given in the Appendix of Arenou et al. (1992)
    >>> lng = 10.2
    >>> lat = 59.0
    >>> av = findext_arenou(lng, lat)
    >>> print("Av at lng = %.2f, lat = %.2f is %.2f magnitude" %(lng, lat, av))
    Av at lng = 10.20, lat = 59.00 is 0.05 magnitude
  2. Find the extinction for a star at galactic lattitude 107.05 and longitude -34.93 and a distance of 144.65 parsecs
    >>> lng = 107.05
    >>> lat = -34.93
    >>> dd  = 144.65
    >>> av = findext_arenou(lng, lat, distance = dd)
    >>> print("Av at lng = %.2f, lat = %.2f and distance = %.2f parsecs is %.2f magnitude" %(lng, lat, dd, av))
    Av at lng = 107.05, lat = -34.93 and distance = 144.65 parsecs is 0.15 magnitude
Parameters:
  • ll (float) - Galactic Longitude (in degrees)
  • bb (float) - Galactic Lattitude (in degrees)
  • distance (float) - Distance to the source (in parsecs)
Returns: float
The extinction in Johnson V-band

_getarenouparams(ll, bb)

source code 

Input: galactic coordinates Output: Arenou 1992 alpha, beta, gamma, rr0, saa

Parameters:
  • ll (float) - Galactic Longitude (in degrees)
  • bb (float) - Galactic Lattitude (in degrees)

get_marshall_data()

source code 

Read in the Marshall data

Decorators:
  • @memoized

findext_marshall(ll, bb, distance=None, redlaw='cardelli1989', Rv=3.1, norm='Av', **kwargs)

source code 

Find the V-band extinction according to the reddening model of Marshall et al. (2006) published in Astronomy and Astrophysics, Volume 453, Issue 2, July II 2006, pp.635-651

The band in which the extinction is calculated is actually optional, and given with the keyword norm. If you set norm='Av', you get visual extinction (in JOHNSON.V) band, if you set norm='Ak', you get infrared extinction (in JOHNSON.K). If you want the extinction in different passbands, you can set them via norm='GENEVA.V'. So, norm='Av' is equivalent to setting norm='JOHNSON.V'.

Example usage:

  1. Find the extinction for a star at galactic longitude 10.2 and latitude 9.0. If the distance is not given, we return the complete extinction along the line of sight (i.e. put the star somewhere out of the galaxy).
    >>> lng = 10.2
    >>> lat = 9.0
    >>> ak = findext_marshall(lng, lat, norm='Ak')
    >>> print("Ak at lng = %.2f, lat = %.2f is %.2f magnitude" %(lng, lat, ak))
    Ak at lng = 10.20, lat = 9.00 is 0.15 magnitude
  2. Find the extinction for a star at galactic lattitude 271.05 and longitude -4.93 and a distance of 144.65 parsecs
    >>> lng = 271.05
    >>> lat = -4.93
    >>> dd  = 144.65
    >>> ak = findext_marshall(lng, lat, distance = dd, norm='Ak')
    >>> print("Ak at lng = %.2f, lat = %.2f and distance = %.2f parsecs is %.2f magnitude" %(lng, lat, dd, ak))
    Ak at lng = 271.05, lat = -4.93 and distance = 144.65 parsecs is 0.02 magnitude
  3. The extinction for galactic longitude 10.2 and latitude 59.0 can not be calculated using the Marshall models, because they are only valid at certain lng and lat (0 < lng < 100 or 260 < lng < 360, -10 < lat < 10)
>>> lng = 10.2
>>> lat = 59.0
>>> ak = findext_marshall(lng, lat, norm='Ak')
>>> print(ak)
None
Parameters:
  • ll (float) - Galactic Longitude (in degrees) should be between 0 and 100 or 260 and 360 degrees
  • bb (float) - Galactic Lattitude (in degrees) should be between -10 and 10 degrees
  • distance (float) - Distance to the source (in parsecs)
  • redlaw (str) - the used reddening law (standard: 'cardelli1989')
  • Rv (float) - Av/E(B-V) (standard: 3.1)
Returns: float
The extinction in K-band

findext_drimmel(lng, lat, distance=None, rescaling=True, redlaw='cardelli1989', Rv=3.1, norm='Av', **kwargs)

source code 

Procedure to retrieve the absorption in V from three-dimensional grids, based on the Galactic dust distribution of Drimmel & Spergel.

Example usage:

  1. Find the extinction for a star at galactic longitude 10.2 and latitude 9.0. If the distance is not given, we return the complete extinction along the line of sight (i.e. put the star somewhere out of the galaxy).
    >>> lng = 10.2
    >>> lat = 9.0
    >>> av = findext_drimmel(lng, lat)
    >>> print("Av at lng = %.2f, lat = %.2f is %.2f magnitude" %(lng, lat, av))
    Av at lng = 10.20, lat = 9.00 is 1.24 magnitude
  2. Find the extinction for a star at galactic lattitude 107.05 and longitude -34.93 and a distance of 144.65 parsecs
    >>> lng = 271.05
    >>> lat = -4.93
    >>> dd  = 144.65
    >>> ak = findext_marshall(lng, lat, distance = dd)
    >>> print("Ak at lng = %.2f, lat = %.2f and distance = %.2f parsecs is %.2f magnitude" %(lng, lat, dd, ak))
    Ak at lng = 271.05, lat = -4.93 and distance = 144.65 parsecs is 0.02 magnitude
Parameters:
  • lng (float) - Galactic Longitude (in degrees)
  • lat (float) - Galactic Lattitude (in degrees)
  • distance (float) - Distance to the source (in parsecs)
  • rescaling (boolean) - Rescaling needed or not?
Returns: float
extinction in V band with/without rescaling

_pix2xy(pixel, resolution, sixpack=0)

source code 

_pix2xy creates a raster image (sky cube or face) given a pixelindex and a resolution The data array can be either a vector or two-dimensional array. In the latter case, the data for each raster image can be stored in either the columns or rows. The procedure also returns the x and y raster coordinates of each pixel. Only right oriented, ecliptic coordinate images are built. SMOLDERS SEAL OF APPROVAL

_pix2fij(pixel, resolution)

source code 

This function takes an n-element pixel array and generates an n by 3 element array containing the corresponding face, column, and row number (the latter two within the face). SMOLDERS SEAL OF APPROVAL

_ll2uv(lng, lat)

source code 

Convert longitude, latitude to unit vectors SMOLDERS SEAL OF APPROVAL

Parameters:
  • lng (float) - galactic longitude
  • lat (float) - galactic lattitude
Returns: ndarray
unitvector

_uv2pix(vector, resolution)

source code 

Routine returns pixel number given unit vector pointing to center of pixel resolution of the cube. SMOLDERS SEAL OF APPROVAL

_ll2pix(lng, lat, res=9)

source code 

_ll2pix is a python function to convert galactic coordinates to DIRBE pixels (coorconv([lng,lat], infmt='L', outfmt='P', inco='G', outco='R9'))

Input

Parameters:
  • lng (float) - galactic longitude
  • lat (float) - galactic lattitude
Returns: ndarray

(Note: The default coordinate system for pixels is ecliptic.)

output coordinate array

get_schlegel_data_south()

source code 
Decorators:
  • @memoized

_lb2xy_schlegel(ll, bb)

source code 

Converts coordinates in lattitude and longitude to coordinates in x and y pixel coordinates.

The x and y coordinates you find with these formulas are not the coordinates you can read in ds9, but 1 smaller. Hence (x+1, y+1) are the coordinates you find in DS9.

Input

Parameters:
  • ll (float) - galactic longitude
  • bb (float) - galactic lattitude
Returns: ndarray
output coordinate array

findext_schlegel(ll, bb, distance=None, redlaw='cardelli1989', Rv=3.1, norm='Av', **kwargs)

source code 

Get the "Schlegel" extinction at certain longitude and latitude

This function returns the E(B-V) maps of Schlegel et al. (1998), depending on wether the distance is given or not, the E(B-V) value is corrected. If distance is set we use the distance-corrected values:

E(B-V) = E(B-V)_maps * (1 - exp(-10 * r * sin(|b|))) where E(B-V) is the value to be used and E(B-V)_maps the value as found with the Schlegel dust maps

Then we convert the E(B-V) to Av. Standard we use Av = E(B-V)*Rv with Rv=3.1, but the value of Rv can be given as a keyword.

! WARNING: the schlegel maps are not usefull when |b| < 5 degrees !


Variables Details [hide private]

avdisk

Value:
pf.getdata(config.get_datafile('drimmel', "avdisk.fits"))

avspir

Value:
pf.getdata(config.get_datafile('drimmel', "avspir.fits"))

avdloc

Value:
pf.getdata(config.get_datafile('drimmel', "avdloc.fits"))

coordinates

Value:
pf.getdata(config.get_datafile('drimmel', "coordinates.fits"))

avgrid

Value:
pf.getdata(config.get_datafile('drimmel', "avgrid.fits"))

avori2

Value:
pf.getdata(config.get_datafile('drimmel', "avori2.fits"))

rf_allsky

Value:
pf.getdata(config.get_datafile('drimmel', "rf_allsky.fits"))

g2e

Value:
array([[-0.054882486,-0.993821033,-0.096476249], [0.494116468,-0.11099\
3846, 0.862281440], [-0.867661702,-0.000346354, 0.497154957]])