In [26]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from astropy.constants import c
from astropy.convolution import Gaussian1DKernel, convolve
import sys , os
sys.path.append("../../src/lines")
import lineTools as lt
### working dir. and files
wd = "/home/stephane/Science/RadioGalaxy/ALMA/absorptions/analysis/a/"
os.chdir(wd)
datadir = "dataSpecAll/"
dbline = "lineAll.db"
transfile = "splatalogue.csv"
dirplot = "plots/"
In [27]:
def plotSource(lines, vel, amp , vx):
"Overplot the different candidate lines"
#
plt.figure(figsize=(8.0,4.5))
style = ["k-","r--", "b.-"]
plt.xlim(vx[0],vx[1])
for lindex in range(len(lines)):
v = vel[lindex]
a = amp[lindex]
s = style[lindex]
plt.step(v, a, s , linewidth = 1.0 , label = lines[lindex][0])
plt.xlabel ("v (km/s)")
plt.ylabel(r"$S^*$")
plt.legend()
plt.show()
In [28]:
def getData(dataid, z, freqtrans):
al = lt.analysisLines(dbline)
cmdsql = "select filedata FROM dataset WHERE dataid = '%d'"%(dataid)
resdb = al.query(cmdsql)
pl = lt.plotLines("fake", "fake", "fake")
datafile = datadir + resdb[0][0]
freq , amp = pl.extractData(datafile)
amp = amp / np.mean(amp)
freq = freq * (1. + z)
dv = c.value * 1e-3 * (freq - freqtrans) / freqtrans
return(dv , amp)
In [29]:
source = "J2148+0657"
z = 0.8983000
lines = []
line1 = ("HCO+v=0", 178.37506 , 4762)
lines.append(line1)
line1 = ("C18O", 439.08877 , 2041)
lines.append(line1)
velline = []
ampline = []
for l in lines:
dv , amp = getData(l[2], z , l[1])
amp = amp / np.mean(amp)
ampline.append(amp)
velline.append(dv)
plotSource(lines, velline, ampline, [-200., 100.])
In [30]:
## fine tuning..
al = lt.analysisLines(dbline)
resLines = al.findSpeciesFineTuningSource(source , z, -32., -31., flag = False, outputline = 10)
------
Source: J2148+0657
Redshift: 0.898300
Frequency redshifted: 93.959127
Frequency at rest: 178.362611
Frequency offset:
0.0184424124104 GHz 0.0190385161227 GHz
Species Chemical Name ... Lovas/AST Intensity EU_K
--------------- ------------------- ... ------------------- ----------
HCO+v=0 Formylium ... -- 12.84094
HCO+v=0 Formylium ... -- 12.84094
HCO+v=0 Formylium ... -- 12.84094
... ... ... ... ...
HOCH2CN Hydroxyacetonitrile ... -- 1896.43979
cis-CH2OHCHOv=3 Glycolaldehyde ... -- 2098.95534
cis-CH2OHCHOv=3 Glycolaldehyde ... -- 2098.95534
Length = 96 rows
------
Source: J2148+0657
Redshift: 0.898300
Frequency redshifted: 92.789206
Frequency at rest: 176.141750
Frequency offset:
0.0182096972833 GHz 0.0188014602822 GHz
Species Chemical Name ... Lovas/AST Intensity EU_K
----------------- --------------------- ... ------------------- ----------
O217O-sym,v2=1 Ozone ... -- 0.0
CHD(OH)CHO Glycolaldehyde ... -- 16.29788
CH3CODvt=0 Acetaldehyde ... -- 20.80636
... ... ... ... ...
CH2F2v4=1 Difluoromethane ... -- 2660.48649
CH2F2v4=1 Difluoromethane ... -- 2660.48662
aG'g-CH3CHOHCH2OH 1,2-propanediol, aG'g ... -- 2965.07571
Length = 298 rows
------
Source: J2148+0657
Redshift: 0.898300
Frequency redshifted: 92.754049
Frequency at rest: 176.075011
Frequency offset:
0.0182050967534 GHz 0.0187943365771 GHz
Species Chemical Name ... Lovas/AST Intensity EU_K
--------------- ---------------- ... ------------------- ----------
S3 Thiozone ... -- 20.27428
C3H6O2 Hydroxyacetone ... -- 33.37956
CH2OHCOCH2OHv=0 Dihydroxyacetone ... -- 42.73773
... ... ... ... ...
CHOCHOHCH2OH Glyceraldehyde ... -- 1617.64683
CHOCHOHCH2OH Glyceraldehyde ... -- 1617.64683
cis-CH2OHCHOv=3 Glycolaldehyde ... -- 2527.25586
Length = 168 rows
------
Source: J2148+0657
Redshift: 0.898300
Frequency redshifted: 229.984549
Frequency at rest: 436.579669
Frequency offset:
0.045144367951 GHz 0.0466007367661 GHz
Species Chemical Name ... Lovas/AST Intensity EU_K
-------- ----------------- ... ------------------- ----------
a-C2H5SH Ethanethiol, anti ... -- 99.91558
a-C2H5SH Ethanethiol, anti ... -- 99.91558
H2C2S Ethenthione ... -- 540.50141
HCCCH2OH Propargyl Alcohol ... -- 1515.04996
------
Source: J2148+0657
Redshift: 0.898300
Frequency redshifted: 231.290951
Frequency at rest: 439.059612
Frequency offset:
0.0454005185548 GHz 0.046865447139 GHz
Species Chemical Name ... Lovas/AST Intensity EU_K
------------ -------------- ... ------------------- ----------
CH3OCHOv=0 Methyl Formate ... -- 154.80276
CH3OCHOv=0 Methyl Formate ... -- 154.80362
CH2CHCNv11=1 Vinyl Cyanide ... -- 520.49838
... ... ... ... ...
C3H8 Propane ... -- 1548.31581
CH2CN Cyanomethyl ... -- 1823.31585
CH2CN Cyanomethyl ... -- 1823.31585
Length = 20 rows
------
Source: J2148+0657
Redshift: 0.898300
Frequency redshifted: 231.284115
Frequency at rest: 439.046636
Frequency offset:
0.0453986015528 GHz 0.046864061991 GHz
Species Chemical Name ... Lovas/AST Intensity EU_K
------------- --------------- ... ------------------- ----------
C18O Carbon Monoxide ... -- 52.684
C18O Carbon Monoxide ... -- 52.684
C18O Carbon Monoxide ... -- 52.684
... ... ... ... ...
HNO3v5=1/v9=2 Nitric acid ... -- 2447.95312
HNO3v5=1/v9=2 Nitric acid ... -- 2447.95312
HNO3v5=1/v9=2 Nitric acid ... -- 2447.95312
Length = 67 rows
------
Source: J2148+0657
Redshift: 0.898300
Frequency redshifted: 231.275814
Frequency at rest: 439.030878
Frequency offset:
0.0453973554819 GHz 0.0468623799966 GHz
Species Chemical Name ... Lovas/AST Intensity EU_K
------------- -------------- ... ------------------- ----------
D2CO Formaldehyde ... -- 100.62946
CH3OCH3 Dimethyl ether ... -- 130.90144
CH3CH2CNv=0 Ethyl Cyanide ... -- 167.64357
... ... ... ... ...
HNO3v5=1/v9=2 Nitric acid ... -- 2447.95259
HNO3v5=1/v9=2 Nitric acid ... -- 2447.95259
D2CO Formaldehyde ... -- 3017.09251
Length = 35 rows
------
Source: J2148+0657
Redshift: 0.898300
Frequency redshifted: 230.575130
Frequency at rest: 437.700769
Frequency offset:
0.0452601993499 GHz 0.0467204035431 GHz
Species Chemical Name ... Lovas/AST Intensity EU_K
----------------- ---------------- ... ------------------- ----------
CH3OCH3 Dimethyl ether ... -- 300.21956
CH3OCH3 Dimethyl ether ... -- 300.22294
CH2OHCOCH2OHv28=1 Dihydroxyacetone ... -- 1504.88991
CH2OHCOCH2OHv28=1 Dihydroxyacetone ... -- 1504.88991
------
Source: J2148+0657
Redshift: 0.898300
Frequency redshifted: 230.540951
Frequency at rest: 437.635887
Frequency offset:
0.0452533942481 GHz 0.0467134780057 GHz
Species Chemical Name ... Lovas/AST Intensity EU_K
------------------ ---------------------- ... ------------------- ----------
HO3 HOOO radical ... -- 51.75851
HO3 HOOO radical ... -- 51.75854
HO3 HOOO radical ... -- 51.75855
... ... ... ... ...
HNO3v9=1 Nitric acid ... -- 1247.04318
O81BrO Bromine dioxide ... -- 1552.53145
g'G'g-CH3CHOHCH2OH 1,2-propanediol, g'G'g ... -- 2083.75946
Length = 9 rows
------
Source: J2148+0657
Redshift: 0.898300
Frequency redshifted: 230.538509
Frequency at rest: 437.631252
Frequency offset:
0.0452529150958 GHz 0.0467129831942 GHz
Species Chemical Name ... Lovas/AST Intensity EU_K
---------------- ---------------- ... ------------------- ----------
H2NCH2COOH-IIv=0 Glycine ... -- 230.88583
HDCCO Ketene ... -- 261.11205
O35ClO Chlorine dioxide ... -- 431.1155
... ... ... ... ...
HNO3v6=1 Nitric acid ... -- 1300.34199
c-H13COOH Formic acid ... -- 4384.536
c-H13COOH Formic acid ... -- 4384.536
Length = 14 rows
------
Source: J2148+0657
Redshift: 0.898300
Frequency redshifted: 243.470532
Frequency at rest: 462.180111
Frequency offset:
0.0477918656404 GHz 0.049333340963 GHz
Species Chemical Name ... Lovas/AST Intensity EU_K
----------------- ------------------ ... ------------------- ----------
i-C3H7CN iso-propyl cyanide ... -- 335.01414
i-C3H7CN iso-propyl cyanide ... -- 335.01414
aa-(C2H5)2O Diethyl ether ... -- 419.20607
... ... ... ... ...
CH2OHCOCH2OHv29=1 Dihydroxyacetone ... -- 768.99763
CH3C15N Methyl Cyanide ... -- 1505.63369
C3H8 Propane ... -- 2794.48487
Length = 9 rows
------
Source: J2148+0657
Redshift: 0.898300
Frequency redshifted: 244.157055
Frequency at rest: 463.483338
Frequency offset:
0.0479270091754 GHz 0.0494724480367 GHz
Species Chemical Name ... Lovas/AST Intensity EU_K
-------------- -------------- ... ------------------- ----------
O218O-sym,v2=1 Ozone ... -- 0.0
O218O-asym Ozone ... -- 0.0
HON18OO Nitric acid ... -- 285.19667
... ... ... ... ...
34SO2v=0 Sulfur Dioxide ... -- 3200.04146
H2CCO Ketene ... -- 9611.09581
H2CCO Ketene ... -- 9611.09581
Length = 41 rows
------
Source: J2148+0657
Redshift: 0.898300
Frequency redshifted: 244.641430
Frequency at rest: 464.402827
Frequency offset:
0.0480217054608 GHz 0.0495705947686 GHz
Species Chemical Name ... Lovas/AST Intensity EU_K
---------- ------------------ ... ------------------- ----------
S4 Tetrasulfur ... -- 129.86776
NH2CHO Formamide ... -- 270.74952
NH2CHO Formamide ... -- 270.74952
... ... ... ... ...
13CH3CH2CN Ethyl Cyanide ... -- 1282.08748
CH2OO Methylene peroxide ... -- 1311.32631
C6H5OH Phenol ... -- 1354.69561
Length = 25 rows
------
Source: J2148+0657
Redshift: 0.898300
Frequency redshifted: 114.149021
Frequency at rest: 216.689087
Frequency offset:
0.0224086237227 GHz 0.0231295037117 GHz
Species Chemical Name ... Lovas/AST Intensity EU_K
------------- --------------- ... ------------------- ----------
13CN Cyanide Radical ... -- 15.64246
13CN Cyanide Radical ... -- 15.64246
13CN Cyanide Radical ... -- 15.64254
... ... ... ... ...
HNO3v5=1/v9=2 Nitric acid ... -- 3084.31248
HNO3v5=1/v9=2 Nitric acid ... -- 3084.31248
HNO3v5=1/v9=2 Nitric acid ... -- 3084.31248
Length = 139 rows
------
Source: J2148+0657
Redshift: 0.898300
Frequency redshifted: 114.164646
Frequency at rest: 216.718748
Frequency offset:
0.0224105405284 GHz 0.0231326697353 GHz
Species Chemical Name ... Lovas/AST Intensity EU_K
-------------- ------------------- ... ------------------- ----------
O37ClO Chlorine dioxide ... -- 65.89679
HOCH2CN Hydroxyacetonitrile ... -- 111.78304
NH2CH2CH2OHv=0 Aminoethanol ... -- 116.30262
... ... ... ... ...
HNO3v9=1 Nitric acid ... -- 2800.76977
HNO3v9=1 Nitric acid ... -- 2800.76977
HNO3v9=1 Nitric acid ... -- 2800.76977
Length = 60 rows
------
Source: J2148+0657
Redshift: 0.898300
Frequency redshifted: 103.837505
Frequency at rest: 197.114736
Frequency offset:
0.0203818568059 GHz 0.0210401275129 GHz
Species Chemical Name ... Lovas/AST Intensity EU_K
-------- ----------------- ... ------------------- ----------
C3H6O2 Hydroxyacetone ... -- 34.12967
HCCCH2OH Propargyl Alcohol ... -- 68.35039
HON18OO Nitric acid ... -- 73.72214
... ... ... ... ...
HNO3v6=1 Nitric acid ... -- 3159.76995
HNO3v6=1 Nitric acid ... -- 3159.76995
HNO3v6=1 Nitric acid ... -- 3159.76996
Length = 52 rows
------
Source: J2148+0657
Redshift: 0.898300
Frequency redshifted: 103.825787
Frequency at rest: 197.092491
Frequency offset:
0.0203780229982 GHz 0.0210377531472 GHz
Species Chemical Name ... Lovas/AST Intensity EU_K
------------- ------------------- ... ------------------- ----------
a-s-CH2DCH2OH <i>anti</i>-Ethanol ... -- 19.20045
HOONO Peroxynitrous acid ... -- 29.75134
HOONO Peroxynitrous acid ... -- 29.75145
... ... ... ... ...
HNO3 Nitric acid ... -- 2852.18133
HNO3 Nitric acid ... -- 2852.18133
HNO3 Nitric acid ... -- 2852.18134
Length = 203 rows
------
Source: J2148+0657
Redshift: 0.898300
Frequency redshifted: 101.985943
Frequency at rest: 193.599916
Frequency offset:
0.0200176403689 GHz 0.0206649538165 GHz
Species Chemical Name ... Lovas/AST Intensity EU_K
---------------- ------------------ ... ------------------- ----------
SO2v=0 Sulfur dioxide ... -- 41.9902
SO2v=0 Sulfur dioxide ... -- 41.9902
SO2v=0 Sulfur dioxide ... -- 41.99063
... ... ... ... ...
H2NCH2COOH-IIv=1 Glycine ... -- 2377.99046
H2NCH2COOH-IIv=1 Glycine ... -- 2377.99046
CH2OO Methylene peroxide ... -- 3796.44763
Length = 151 rows
------
Source: J2148+0657
Redshift: 0.898300
Frequency redshifted: 101.970318
Frequency at rest: 193.570255
Frequency offset:
0.0200153402021 GHz 0.0206617877929 GHz
Species Chemical Name ... Lovas/AST Intensity EU_K
--------------- ------------------ ... ------------------- ----------
O218O-asym,v2=1 Ozone ... -- 0.0
HNO3 Nitric acid ... -- 22.5195
HNO3 Nitric acid ... -- 22.51951
... ... ... ... ...
HNO3v5=1/v9=2 Nitric acid ... -- 1337.68029
HNO3v5=1/v9=2 Nitric acid ... -- 1337.68029
t-HC(O)SH Monothiformic acid ... -- 1425.42174
Length = 78 rows
------
Source: J2148+0657
Redshift: 0.898300
Frequency redshifted: 101.740818
Frequency at rest: 193.134595
Frequency offset:
0.0199695239336 GHz 0.0206152852381 GHz
Species Chemical Name ... Lovas/AST Intensity EU_K
----------------- --------------------- ... ------------------- ----------
CH3CH2CH2CN-anti Butyronitrile ... -- 13.72346
C3H6O2 Hydroxyacetone ... -- 34.93222
gG'a-CH3CHOHCH2OH 1,2-propanediol, gG'a ... -- 37.40789
... ... ... ... ...
HNO3v9=1 Nitric acid ... -- 2472.01351
HNO3v9=1 Nitric acid ... -- 2472.01351
HNO3v9=1 Nitric acid ... -- 2472.01351
Length = 102 rows
------
Source: J2148+0657
Redshift: 0.898300
Frequency redshifted: 101.727146
Frequency at rest: 193.108641
Frequency offset:
0.0199672237668 GHz 0.0206125149421 GHz
Species Chemical Name ... Lovas/AST Intensity EU_K
---------------- --------------------------- ... ------------------- ----------
Hε Hydrogen Recombination Line ... -- 0.0
CH3CH2CH2CN-anti Butyronitrile ... -- 12.4502
Na13CN/NaN13C Sodium Cyanide ... -- 65.71718
... ... ... ... ...
HOONO Peroxynitrous acid ... -- 3719.84955
HOONO Peroxynitrous acid ... -- 3719.84955
HOONO Peroxynitrous acid ... -- 3719.84955
Length = 96 rows
------
Source: J2148+0657
Redshift: 0.898300
Frequency redshifted: 100.053318
Frequency at rest: 189.931214
Frequency offset:
0.019639045632 GHz 0.0202733546883 GHz
Species Chemical Name ... Lovas/AST Intensity EU_K
--------------- ---------------- ... ------------------- -----------
H2NCH2COOH-Iv=2 Glycine ... -- 41.88964
H2NCH2COOH-Iv=2 Glycine ... -- 41.88964
H2NCH2COOH-Iv=0 Glycine ... -- 41.88965
... ... ... ... ...
17OD Hydroxyl radical ... -- 13364.52935
17OD Hydroxyl radical ... -- 13364.52966
17OD Hydroxyl radical ... -- 13364.53003
Length = 66 rows
------
Source: J2148+0657
Redshift: 0.898300
Frequency redshifted: 93.959127
Frequency at rest: 178.362611
Frequency offset:
0.0184424124104 GHz 0.0190385161227 GHz
Species Chemical Name ... Lovas/AST Intensity EU_K
--------------- ------------------- ... ------------------- ----------
HCO+v=0 Formylium ... -- 12.84094
HCO+v=0 Formylium ... -- 12.84094
HCO+v=0 Formylium ... -- 12.84094
... ... ... ... ...
HOCH2CN Hydroxyacetonitrile ... -- 1896.43979
cis-CH2OHCHOv=3 Glycolaldehyde ... -- 2098.95534
cis-CH2OHCHOv=3 Glycolaldehyde ... -- 2098.95534
Length = 96 rows
------
Source: J2148+0657
Redshift: 0.898300
Frequency redshifted: 92.789206
Frequency at rest: 176.141750
Frequency offset:
0.0182096972833 GHz 0.0188014602822 GHz
Species Chemical Name ... Lovas/AST Intensity EU_K
----------------- --------------------- ... ------------------- ----------
O217O-sym,v2=1 Ozone ... -- 0.0
CHD(OH)CHO Glycolaldehyde ... -- 16.29788
CH3CODvt=0 Acetaldehyde ... -- 20.80636
... ... ... ... ...
CH2F2v4=1 Difluoromethane ... -- 2660.48649
CH2F2v4=1 Difluoromethane ... -- 2660.48662
aG'g-CH3CHOHCH2OH 1,2-propanediol, aG'g ... -- 2965.07571
Length = 298 rows
------
Source: J2148+0657
Redshift: 0.898300
Frequency redshifted: 92.754049
Frequency at rest: 176.075011
Frequency offset:
0.0182050967534 GHz 0.0187943365771 GHz
Species Chemical Name ... Lovas/AST Intensity EU_K
--------------- ---------------- ... ------------------- ----------
S3 Thiozone ... -- 20.27428
C3H6O2 Hydroxyacetone ... -- 33.37956
CH2OHCOCH2OHv=0 Dihydroxyacetone ... -- 42.73773
... ... ... ... ...
CHOCHOHCH2OH Glyceraldehyde ... -- 1617.64683
CHOCHOHCH2OH Glyceraldehyde ... -- 1617.64683
cis-CH2OHCHOv=3 Glycolaldehyde ... -- 2527.25586
Length = 168 rows
Content source: bosscha/alma-calibrator
Similar notebooks: