MapLine 1.0.6__tar.gz → 1.0.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: MapLine
3
- Version: 1.0.6
3
+ Version: 1.0.7
4
4
  Summary: A Python implementation of the 3D emission line fitting code
5
5
  Home-page: https://github.com/hjibarram/Map_line
6
- Download-URL: https://github.com/hjibarram/Map_line/archive/refs/tags/v1.0.6.tar.gz
6
+ Download-URL: https://github.com/hjibarram/Map_line/archive/refs/tags/v1.0.7.tar.gz
7
7
  Author: hjibarram
8
8
  Author-email: hjibarram@gmail.com
9
9
  License: MIT
@@ -18,5 +18,8 @@ Requires-Dist: matplotlib
18
18
  Requires-Dist: numpy
19
19
  Requires-Dist: scipy
20
20
  Requires-Dist: cloup
21
+ Requires-Dist: click
22
+ Requires-Dist: emcee
23
+ Requires-Dist: tqdm
21
24
 
22
25
  This is an empty readme file
@@ -3,3 +3,6 @@ matplotlib
3
3
  numpy
4
4
  scipy
5
5
  cloup
6
+ click
7
+ emcee
8
+ tqdm
@@ -3,5 +3,5 @@ import numpy as np
3
3
  globally across the MapLine modules
4
4
  """
5
5
 
6
- __version__ = 'MapLine v1.0.6'
6
+ __version__ = 'MapLine v1.0.7'
7
7
 
@@ -22,6 +22,17 @@ def line_fit_single(file1,file_out,file_out2,name_out2,config_lines='line_prop.y
22
22
  if error_c:
23
23
  pdl_dataE=table_data.field('ERROR')
24
24
  pdl_dataE=pdl_dataE*flux_f*erft
25
+ elif input_format == 'SDSS':
26
+ hdu_list = fits.open(file1)
27
+ table_hdu = hdu_list[1]
28
+ table_data = table_hdu.data
29
+ pdl_data=table_data.field('FLUX')
30
+ wave=table_data.field('LOGLAM')
31
+ wave=10**wave
32
+ if error_c:
33
+ pdl_dataE=table_data.field('IVAR')
34
+ pdl_dataE=1/np.sqrt(pdl_dataE)
35
+ pdl_dataE=pdl_dataE*flux_f*erft
25
36
  elif input_format == 'IrafFits':
26
37
  [pdl_data, hdr]=fits.getdata(file1, 0, header=True)
27
38
  if error_c:
@@ -603,9 +614,19 @@ def line_fit_single(file1,file_out,file_out2,name_out2,config_lines='line_prop.y
603
614
 
604
615
 
605
616
  def line_fit(file1,file2,file3,file_out,file_out2,name_out2,z=0.05536,j_t=0,i_t=0,config_lines='line_prop.yml',lA1=6450.0,lA2=6850.0,lorentz=False,broad=True,n_line=False,skew=False,error_c=True,test=False,plot_f=True,ncpu=10,pgr_bar=True,single=False,flux_f=1.0,erft=0.75,dv1t=200,sim=False,cont=False,hbfit=False):
606
- [pdl_cube, hdr]=fits.getdata(file1, 0, header=True)
617
+ try:
618
+ [pdl_cube, hdr]=fits.getdata(file1, 'FLUX', header=True)
619
+ except:
620
+ [pdl_cube, hdr]=fits.getdata(file1, 0, header=True)
607
621
  if error_c:
608
- pdl_cubeE =fits.getdata(file1, 1, header=False)
622
+ try:
623
+ pdl_cubeE =fits.getdata(file1, 'ERROR', header=False)
624
+ except:
625
+ try:
626
+ pdl_cubeE =fits.getdata(file1, 'IVAR', header=False)
627
+ pdl_cubeE=1.0/np.sqrt(pdl_cubeE)
628
+ except:
629
+ pdl_cubeE =fits.getdata(file1, 1, header=False)
609
630
  pdl_cubeE=pdl_cubeE*flux_f*erft
610
631
  nz,nx,ny=pdl_cube.shape
611
632
  pdl_cube=pdl_cube*flux_f
@@ -6,6 +6,7 @@ import os.path as ptt
6
6
  from scipy.special import erf as errf
7
7
  import yaml
8
8
  import sys
9
+ from astropy.io import fits
9
10
 
10
11
  def wfits_ext(name,hlist):
11
12
  sycall("rm "+name+'.gz')
@@ -82,4 +83,33 @@ def read_config_file(file):
82
83
  return data
83
84
  except:
84
85
  print('Config File not found')
85
- return None
86
+ return None
87
+
88
+ def get_fluxline(file,path='',ind1=3,ind2=7,ind3=4,ind4=9,lo=6564.632,zt=0.0,val0=0):
89
+ ct=299792.458
90
+ file0=path+'/'+file
91
+ [pdl_cube0, hdr0]=fits.getdata(file0, 0, header=True)
92
+ Amp=pdl_cube0[ind1,:,:]
93
+ fwhm=pdl_cube0[ind2,:,:]
94
+ vel=pdl_cube0[ind3,:,:]
95
+ nt=np.where(np.round(vel,decimals=3) == val0)
96
+ vel=vel+zt*ct
97
+
98
+ try:
99
+ cont=pdl_cube0[ind4,:,:]
100
+ conti=True
101
+ except:
102
+ conti=False
103
+ sigma=fwhm/ct*lo/(2.0*np.sqrt(2.0*np.log(2.0)))
104
+ flux=np.sqrt(2.0*np.pi)*sigma*Amp
105
+ if conti:
106
+ ew=flux/cont
107
+ else:
108
+ ew=None
109
+ sigma=fwhm/(2.0*np.sqrt(2.0*np.log(2.0)))
110
+ if len(nt) > 0:
111
+ vel[nt]=0
112
+ flux[nt]=0
113
+ sigma[nt]=0
114
+ ew[nt]=0
115
+ return flux,vel,sigma,ew
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: MapLine
3
- Version: 1.0.6
3
+ Version: 1.0.7
4
4
  Summary: A Python implementation of the 3D emission line fitting code
5
5
  Home-page: https://github.com/hjibarram/Map_line
6
- Download-URL: https://github.com/hjibarram/Map_line/archive/refs/tags/v1.0.6.tar.gz
6
+ Download-URL: https://github.com/hjibarram/Map_line/archive/refs/tags/v1.0.7.tar.gz
7
7
  Author: hjibarram
8
8
  Author-email: hjibarram@gmail.com
9
9
  License: MIT
@@ -18,5 +18,8 @@ Requires-Dist: matplotlib
18
18
  Requires-Dist: numpy
19
19
  Requires-Dist: scipy
20
20
  Requires-Dist: cloup
21
+ Requires-Dist: click
22
+ Requires-Dist: emcee
23
+ Requires-Dist: tqdm
21
24
 
22
25
  This is an empty readme file
@@ -286,8 +286,8 @@ def runoned(config_file,name,path,path_out,zt,rvel,ncpus,error,double,bcont,hbet
286
286
  file1=dirt+'NAME.csv'.replace('NAME',name)
287
287
  elif input_format == 'ASCII':
288
288
  file1=dirt+'NAME.txt'.replace('NAME',name)
289
- elif input_format == 'IrafFits' or input_format == 'TableFits':
290
- file1=dirt+'NAME.fits'.replace('NAME',name)
289
+ elif input_format == 'IrafFits' or input_format == 'TableFits' or input_format == 'SDSS':
290
+ file1=dirt+'NAME.fits'.replace('NAME',name)
291
291
  else:
292
292
  file1=dirt+'NAME'
293
293
  if ptt.exists(dir_out) == False:
@@ -20,6 +20,9 @@ requirements = [
20
20
  'numpy',#>=1.17.2',
21
21
  'scipy',#>=1.3.0',
22
22
  'cloup',
23
+ 'click',
24
+ 'emcee',
25
+ 'tqdm',
23
26
  ]
24
27
 
25
28
  DATA_DIRNAME = 'data'
File without changes
File without changes
File without changes
File without changes