Skip to content

Latest commit

 

History

History
112 lines (66 loc) · 6.04 KB

README.md

File metadata and controls

112 lines (66 loc) · 6.04 KB

AGN (in development)

Codes to calculate Temperature [K] and Density [particle/cm^3] from the lines ratio of certain ions in the narrow line region of a given AGN.

The python script takes the values for Einstein Coefficients, collision strength, and statistical weights from Osterbrock, 2006. The script is based on the one written by de Robertis, Dufour, & Hunt (fivel.f). The paper explaining the fivel program can be found at Journal of the Royal Astronomical Society of Canada. The script can also be taken from this repository.

Needed packages:

  • lmfit, Non-Linear Least-Squares Minimization and Curve-Fitting for Python
  • astropy, To read FITS files
  • scipy and numpy, Scientific computing packages
  • matplotlib, The Python plotting library
  • agn, For graphics and show graphics (must be ran within the same path - in Development)

Lines_ratio

1. Usage and calling sequence:

If the program is called as a python module, the calling proccedure is like:

import agn 
name = 'data/spec-1070-52591-0072.fits' #Example of .fits data
z = 0.00420765  #Redshift related to name fits

T, Ne = agn.calculation(name,z=z)

#or

T, Ne = calculation(name,z=z,ion1='OIII',ion2='SII')

#or if the user do not want the iteration proccess

T, Ne = calculation(name,z=z,ion1='OIII',ion2='SII',iteration=False)
print("  Temperature  {}\n  Density      {}".format(T,Ne))

Here the user will be ased for the ions to make the calculations if they are not specified. Svailable ions are (O[III] or N[II]) and (S[II] or O[II]) (see Ions example below). It returns T and Ne, the temperature and particle density in [K] and [particle/cm^3] respectively, of the narrow line region from an AGN.

Note: As the lines_ratio uses gaussian.py and fivel.py programs (both on this tree), for the moment the three programs must to be on the same folder.

2. Parameters:

  • name:
    Name of the .fits file. The file should be obtained from the Sloan Digital Sky Survey (SDSS) Catalogue. In the catalogue, the user will provide either the Plate, MJD and FiberID, or the coordinates of the AGN.

  • z Redshift. Necessary to center each emission line on the plots

  • ion1 ion2 (default=None)
    Ions in which the calculations will be performed. If not set, then the user will be asked for the available ions to begin with. Svailable ions are: O[III] or N[II] for 2p2-like ions and S[II] or O[II] for 2p3-like ions. More ions will be added.

  • statistics (default=False)
    If set to True, then it will display on the screen some information of the region of calculation, like the maximum and minimum values of wavelenght and fluxes, the Equivalent Width (as of URL) and area under the flux given by the Trapezoid and Simpson methods.

  • header (default=False)
    If True, the program will look for a Header-like structure to find per se the wavelenghts (in Development).

  • plot (defalut=True)
    Shows the gaussian fit and gaussian function in which the integral will be made, as well as the area result.

  • savefig (default=False)
    If True, it will save all the gaussian fits done on the program.

  • show_model (default=False)
    Is True, it will display the residuals, gaussian fit, area and best fit. In this scope, every time the user selects the two points of interest (of integration), a new window will appear on the screen. In order to close it and pass the next figure, the user will have to first clic on the graph (so the window will disappear) and then close the graph. (in Development)

  • iteration (dafalut=True)
    Shows the iterations done by the agn.fivel class.

  • plot_spectrum (default=False)
    Plots the initial spectrum

3. Statistics:

gaussian


Ions examples:

There are two equations used to make the calculations, from 2p2-like ions and 2p3-like ions

  1. Equations for 2p2-like ions

    The equation for the ion O[III] is:

    oiii

    While the equation for the ion N[II] is:

    nii

  2. Equations for 2p3-like ions

    The equation for the ion S[II] is:

    sii

    And for the O[II] ion is:

    oii

Graphs

2p2
2p3