smart-astro 1.0.0__py3-none-any.whl

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.
Files changed (58) hide show
  1. smart/__init__.py +36 -0
  2. smart/forward_model/InterpolateModel.py +485 -0
  3. smart/forward_model/InterpolateModel_txt.py +494 -0
  4. smart/forward_model/__init__.py +3 -0
  5. smart/forward_model/apogee/__init__.py +3 -0
  6. smart/forward_model/apogee/bitmask.py +249 -0
  7. smart/forward_model/apogee/lsf.py +563 -0
  8. smart/forward_model/apogee/lsf_function.py +212 -0
  9. smart/forward_model/apogee/lsf_gh.py +17 -0
  10. smart/forward_model/classForwardModel.py +47 -0
  11. smart/forward_model/classForwardModelInit.py +252 -0
  12. smart/forward_model/classModel.py +232 -0
  13. smart/forward_model/classSpectrum.py +888 -0
  14. smart/forward_model/continuum.py +431 -0
  15. smart/forward_model/fringe_model.py +245 -0
  16. smart/forward_model/integralResample.py +89 -0
  17. smart/forward_model/mask.py +184 -0
  18. smart/forward_model/mcmc.py +1658 -0
  19. smart/forward_model/mcmc_utils.py +113 -0
  20. smart/forward_model/model_fit.py +1144 -0
  21. smart/forward_model/rotation_broaden.py +188 -0
  22. smart/forward_model/run_mcmc_science.py +803 -0
  23. smart/forward_model/run_mcmc_science_binary.py +920 -0
  24. smart/forward_model/run_mcmc_science_binary_igrins.py +928 -0
  25. smart/forward_model/run_mcmc_science_igrins.py +756 -0
  26. smart/forward_model/run_mcmc_telluric.py +630 -0
  27. smart/forward_model/run_mcmc_telluric_airmass_pwv.py +563 -0
  28. smart/forward_model/run_mcmc_telluric_airmass_pwv_fringe.py +511 -0
  29. smart/forward_model/run_mcmc_telluric_airmass_pwv_igrins.py +546 -0
  30. smart/forward_model/run_mcmc_telluric_airmass_pwv_no_wave_offset.py +549 -0
  31. smart/forward_model/run_mcmc_telluric_airmass_pwv_noise.py +557 -0
  32. smart/forward_model/tellurics.py +366 -0
  33. smart/initialize.py +42 -0
  34. smart/utils/__init__.py +3 -0
  35. smart/utils/addKeyword.py +147 -0
  36. smart/utils/barycorr.py +136 -0
  37. smart/utils/compute_galactic_thin_thick_disk.py +62 -0
  38. smart/utils/compute_uvw_velocity.py +127 -0
  39. smart/utils/data_reduction_utils.py +85 -0
  40. smart/utils/defringeflat.py +491 -0
  41. smart/utils/defringetelluric.py +298 -0
  42. smart/utils/hires_tool.py +149 -0
  43. smart/utils/interpolations.py +436 -0
  44. smart/utils/listTarget.py +119 -0
  45. smart/utils/mask.py +167 -0
  46. smart/utils/run_nsdrp.py +134 -0
  47. smart/utils/stats.py +19 -0
  48. smart/utils/subtractDark.py +82 -0
  49. smart/wavelength_calibration/__init__.py +3 -0
  50. smart/wavelength_calibration/cal_param.py +48 -0
  51. smart/wavelength_calibration/residual.py +49 -0
  52. smart/wavelength_calibration/telluric_wavelength_fit.py +1662 -0
  53. smart/wavelength_calibration/telluric_wavelength_fit_igrins.py +1488 -0
  54. smart_astro-1.0.0.dist-info/METADATA +167 -0
  55. smart_astro-1.0.0.dist-info/RECORD +58 -0
  56. smart_astro-1.0.0.dist-info/WHEEL +5 -0
  57. smart_astro-1.0.0.dist-info/licenses/LICENSE +21 -0
  58. smart_astro-1.0.0.dist-info/top_level.txt +1 -0
smart/__init__.py ADDED
@@ -0,0 +1,36 @@
1
+ __version__ = "1.0.0"
2
+
3
+ from .initialize import *
4
+ from .utils.barycorr import barycorr
5
+ from .forward_model.classModel import Model
6
+ from .forward_model.classSpectrum import Spectrum
7
+ from .forward_model.classForwardModelInit import ForwardModelInit
8
+ from .forward_model.integralResample import integralResample
9
+ from .forward_model.InterpolateModel import InterpModel
10
+ from .forward_model.rotation_broaden import lsf_rotate, broaden
11
+ from .forward_model.continuum import *
12
+ from .forward_model.tellurics import InterpTelluricModel, convolveTelluric
13
+ from .forward_model.model_fit import *
14
+ from .forward_model.fringe_model import double_sine, doub_sine_wave_dependent, double_sine_fringe, double_sine_fringe_telluric
15
+ from .forward_model.mcmc import run_mcmc, telluric_mcmc, run_mcmc2, run_mcmc3
16
+ from .forward_model.apogee.lsf_function import computeAPLSF, convolveAPLSF
17
+ try:
18
+ from .forward_model.apogee.lsf import eval
19
+ except FileNotFoundError:
20
+ print("You need to put the APOGEE LSF and wavelength fits files under forward_model/apogee. See README.md for more details.")
21
+ pass
22
+ from .forward_model.apogee.bitmask import bits_set
23
+ from .wavelength_calibration.telluric_wavelength_fit import *
24
+ from .wavelength_calibration.residual import residual
25
+ from .utils.stats import chisquare
26
+ from .utils.addKeyword import add_nsdrp_keyword, add_wfits_keyword
27
+ from .utils.listTarget import makeTargetList
28
+ from .utils.compute_uvw_velocity import compute_uvw_velocity
29
+ from .utils.compute_galactic_thin_thick_disk import compute_galactic_pop_prob
30
+ from .utils.interpolations import bilinear_interpolation, trilinear_interpolation, quadlinear_interpolation
31
+ try:
32
+ from .utils.defringeflat import defringeflat, defringeflatAll
33
+ except ImportError:
34
+ print("You need to install the wavelets package (https://github.com/aaren/wavelets) to use defringeflat functions.")
35
+ pass
36
+ #from .utils.subtractDark import subtractDark
@@ -0,0 +1,485 @@
1
+ import smart
2
+ import numpy as np
3
+ import sys, os, os.path, time
4
+ from astropy.table import Table
5
+ from astropy.io import fits
6
+ from numpy.linalg import inv, det
7
+ from ..utils.interpolations import trilinear_interpolation
8
+
9
+ ##############################################################################################################
10
+
11
+
12
+ def InterpModel(teff, logg=4, metal=0, alpha=0, kzz=0, co=0, modelset='phoenix-aces-agss-cond-2011', instrument='nirspec', order='O33'):
13
+ #print('Parameters', teff, logg, modelset, instrument, order)
14
+ FULL_PATH = os.path.realpath(__file__)
15
+ BASE, NAME = os.path.split(FULL_PATH)
16
+
17
+ # Check the model set and instrument
18
+ if instrument.lower() in ['nirspec', 'hires', 'igrins']:
19
+ path = BASE + '/../libraries/%s/%s-O%s/'%(smart.ModelSets[modelset.lower()], instrument.upper(), str(order).upper().strip('Oo'))
20
+ else:
21
+ path = BASE + '/../libraries/%s/%s-%s/'%(smart.ModelSets[modelset.lower()], instrument.upper(), order.upper())
22
+ Gridfile = BASE + '/../libraries/%s/%s_gridparams.csv'%(smart.ModelSets[modelset.lower()], smart.ModelSets[modelset.lower()])
23
+
24
+ if modelset.lower() == 'btsettl08':
25
+ path = BASE + '/../libraries/btsettl08/NIRSPEC-O%s-RAW/'%order
26
+ Gridfile = BASE + '/../libraries/btsettl08/btsettl08_gridparams.csv'
27
+
28
+ # Read the grid file
29
+ T1 = Table.read(Gridfile)
30
+ #print(T1)
31
+
32
+ ###################################################################################
33
+
34
+ def GetModel(temp, wave=False, **kwargs):
35
+
36
+ logg = kwargs.get('logg', 4.5)
37
+ metal = kwargs.get('metal', 0)
38
+ alpha = kwargs.get('alpha', 0)
39
+ kzz = kwargs.get('kzz', 0)
40
+ co = kwargs.get('co', 0)
41
+ gridfile = kwargs.get('gridfile', None)
42
+ instrument = kwargs.get('instrument', 'nirspec')
43
+ order = kwargs.get('order', None)
44
+ #print(temp, logg, metal, alpha)
45
+ if gridfile is None:
46
+ raise ValueError('Model gridfile must be provided.')
47
+
48
+ if modelset.lower() == 'btsettl08' and instrument.lower() == 'nirspec':
49
+ filename = 'btsettl08_t'+ str(int(temp.data[0])) + '_g' + '{0:.2f}'.format(float(logg)) + '_z-' + '{0:.2f}'.format(float(metal)) + '_en' + '{0:.2f}'.format(float(alpha)) + '_NIRSPEC-O' + str(order) + '-RAW.txt'
50
+ elif 'sonora' in modelset.lower() and '2023' not in modelset:
51
+ if instrument.lower() == 'nirspec':
52
+ filename = '%s'%smart.ModelSets[modelset.lower()] + '_t{0:03d}'.format(int(temp.data[0])) + '_g{0:.2f}'.format(float(logg)) + '_FeH0.00_Y0.28_CO1.00' + '_%s-O%s.fits'%(instrument.upper(), order.upper())
53
+ else:
54
+ filename = '%s'%smart.ModelSets[modelset.lower()] + '_t{0:03d}'.format(int(temp.data[0])) + '_g{0:.2f}'.format(float(logg)) + '_FeH0.00_Y0.28_CO1.00' + '_%s-%s.fits'%(instrument.upper(), order.upper())
55
+ elif modelset.lower() == 'sonora-2023':
56
+ if instrument.lower() == 'nirspec':
57
+ filename = '%s'%smart.ModelSets[modelset.lower()] + '_t{0:03d}'.format(int(temp.data[0])) + '_g{0:.2f}'.format(float(logg)) + '_z{0:.2f}'.format(float(metal)) + '_CO{0:.2f}'.format(float(co)) + '_kzz{0:.2f}'.format(float(kzz)) + '_%s-O%s.fits'%(instrument.upper(), order.upper())
58
+ else:
59
+ filename = '%s'%smart.ModelSets[modelset.lower()] + '_t{0:03d}'.format(int(temp.data[0])) + '_g{0:.2f}'.format(float(logg)) + '_z{0:.2f}'.format(float(metal)) + '_CO{0:.2f}'.format(float(co)) + '_kzz{0:.2f}'.format(float(kzz)) + '_%s-%s.fits'%(instrument.upper(), order.upper())
60
+ elif modelset.lower() == 'marcs-apogee-dr15':
61
+ cm = kwargs.get('cm', 0)
62
+ nm = kwargs.get('nm', 0)
63
+ filename = '%s'%smart.ModelSets[modelset.lower()] + '_t{0:03d}'.format(int(temp.data[0])) + '_g{0:.2f}'.format(float(logg)) + '_z{0:.2f}'.format(float(metal)) + '_en{0:.2f}'.format(float(alpha)) + '_cm{0:.2f}'.format(float(cm)) + '_nm{0:.2f}'.format(float(nm)) + '_%s-%s.fits'%(instrument.upper(), order.upper())
64
+ elif kzz != 0:
65
+ filename = '%s'%smart.ModelSets[modelset.lower()] + '_t{0:03d}'.format(int(temp.data[0])) + '_g{0:.2f}'.format(float(logg)) + '_z{0:.2f}'.format(float(metal)) + '_en{0:.2f}'.format(float(alpha)) + '_kzz{0:.2f}'.format(float(kzz)) + '_%s-%s.fits'%(instrument.upper(), order.upper())
66
+ else:
67
+ if instrument.lower()in ['nirspec', 'hires', 'igrins']:
68
+ filename = '%s'%smart.ModelSets[modelset.lower()] + '_t{0:03d}'.format(int(temp.data[0])) + '_g{0:.2f}'.format(float(logg)) + '_z{0:.2f}'.format(float(metal)) + '_en{0:.2f}'.format(float(alpha)) + '_%s-O%s.fits'%(instrument.upper(), order.upper())
69
+ else:
70
+ if modelset == 'hd206893-qkbbhires':
71
+ kzz = 1e8
72
+ filename = '%s'%smart.ModelSets[modelset.lower()] + '_t{0:03d}'.format(int(temp.data[0])) + '_g{0:.2f}'.format(float(logg)) + '_z{0:.2f}'.format(float(metal)) + '_en{0:.2f}'.format(float(alpha)) + '_kzz{0:.2f}'.format(float(kzz)) + '_%s-%s.fits'%(instrument.upper(), order.upper())
73
+ else:
74
+ filename = '%s'%smart.ModelSets[modelset.lower()] + '_t{0:03d}'.format(int(temp.data[0])) + '_g{0:.2f}'.format(float(logg)) + '_z{0:.2f}'.format(float(metal)) + '_en{0:.2f}'.format(float(alpha)) + '_%s-%s.fits'%(instrument.upper(), order.upper())
75
+ # Read in the model FITS file
76
+ if modelset.lower() == 'btsettl08':
77
+ Tab = Table.read(path+filename, format='ascii.tab', names=['wave', 'flux'])
78
+ else:
79
+ Tab = Table.read(path+filename)
80
+
81
+ # Return the model (wave of flux)
82
+ if wave:
83
+ return Tab['wave']
84
+ else:
85
+ return Tab['flux']
86
+
87
+ ###################################################################################
88
+
89
+ # Check if the model already exists (grid point)
90
+ if 'sonora' in modelset.lower() and '2023' not in modelset:
91
+ if (teff, logg) in zip(T1['teff'], T1['logg']):
92
+ metal, ys = 0, 0.28
93
+ index0 = np.where( (T1['teff'] == teff) & (T1['logg'] == logg) & (T1['FeH'] == metal) & (T1['Y'] == ys) )
94
+ #flux2 = GetModel(T1['teff'][index0], T1['logg'][index0], T1['M_H'][index0], modelset=modelset )
95
+ #waves2 = GetModel(T1['teff'][index0], T1['logg'][index0], T1['M_H'][index0], modelset=modelset, wave=True)
96
+ flux2 = GetModel(T1['teff'][index0], logg=T1['logg'][index0], metal=T1['FeH'][index0], alpha=T1['Y'][index0], instrument=instrument, order=order, gridfile=T1)
97
+ waves2 = GetModel(T1['teff'][index0], logg=T1['logg'][index0], metal=T1['FeH'][index0], alpha=T1['Y'][index0], instrument=instrument, order=order, gridfile=T1, wave=True)
98
+ return waves2, flux2
99
+
100
+ elif modelset.lower() == 'sonora-2023':
101
+ if (teff, logg, metal, kzz, co) in zip(T1['teff'], T1['logg'], T1['M_H'], T1['kzz'], T1['CO']):
102
+ index0 = np.where( (T1['teff'] == teff) & (T1['logg'] == logg) & (T1['M_H'] == metal) & (T1['kzz'] == kzz) & (T1['CO'] == co) )
103
+ #flux2 = GetModel(T1['teff'][index0], T1['logg'][index0], T1['M_H'][index0], modelset=modelset )
104
+ #waves2 = GetModel(T1['teff'][index0], T1['logg'][index0], T1['M_H'][index0], modelset=modelset, wave=True)
105
+ flux2 = GetModel(T1['teff'][index0], logg=T1['logg'][index0], metal=T1['M_H'][index0], kzz=T1['kzz'][index0], co=T1['CO'][index0], instrument=instrument, order=order, gridfile=T1)
106
+ waves2 = GetModel(T1['teff'][index0], logg=T1['logg'][index0], metal=T1['M_H'][index0], kzz=T1['kzz'][index0], co=T1['CO'][index0], instrument=instrument, order=order, gridfile=T1, wave=True)
107
+ return waves2, flux2
108
+
109
+ elif kzz != 0:
110
+ if (teff, logg, metal, alpha, kzz) in zip(T1['teff'], T1['logg'], T1['M_H'], T1['en'], T1['kzz']):
111
+ index0 = np.where( (T1['teff'] == teff) & (T1['logg'] == logg) & (T1['M_H'] == metal) & (T1['en'] == alpha) & (T1['kzz'] == kzz) )
112
+ #flux2 = GetModel(T1['teff'][index0], T1['logg'][index0], T1['M_H'][index0], modelset=modelset )
113
+ #waves2 = GetModel(T1['teff'][index0], T1['logg'][index0], T1['M_H'][index0], modelset=modelset, wave=True)
114
+ flux2 = GetModel(T1['teff'][index0], logg=T1['logg'][index0], metal=T1['M_H'][index0], alpha=T1['en'][index0], kzz=T1['kzz'][index0], instrument=instrument, order=order, gridfile=T1)
115
+ waves2 = GetModel(T1['teff'][index0], logg=T1['logg'][index0], metal=T1['M_H'][index0], alpha=T1['en'][index0], kzz=T1['kzz'][index0], instrument=instrument, order=order, gridfile=T1, wave=True)
116
+ return waves2, flux2
117
+
118
+ else:
119
+ if (teff, logg, metal, alpha) in zip(T1['teff'], T1['logg'], T1['M_H'], T1['en']):
120
+ index0 = np.where( (T1['teff'] == teff) & (T1['logg'] == logg) & (T1['M_H'] == metal) & (T1['en'] == alpha) )
121
+ #flux2 = GetModel(T1['teff'][index0], T1['logg'][index0], T1['M_H'][index0], modelset=modelset )
122
+ #waves2 = GetModel(T1['teff'][index0], T1['logg'][index0], T1['M_H'][index0], modelset=modelset, wave=True)
123
+ flux2 = GetModel(T1['teff'][index0], logg=T1['logg'][index0], metal=T1['M_H'][index0], alpha=T1['en'][index0], instrument=instrument, order=order, gridfile=T1)
124
+ waves2 = GetModel(T1['teff'][index0], logg=T1['logg'][index0], metal=T1['M_H'][index0], alpha=T1['en'][index0], instrument=instrument, order=order, gridfile=T1, wave=True)
125
+ return waves2, flux2
126
+
127
+
128
+ try:
129
+
130
+ if 'sonora' in modelset.lower() and '2023' not in modelset:
131
+
132
+ metal, alpha = 0, 0.28
133
+ # Get the nearest models to the gridpoint (teff)
134
+ x0 = np.max(T1['teff'][np.where(T1['teff'] <= teff)])
135
+ x1 = np.min(T1['teff'][np.where(T1['teff'] >= teff)])
136
+ #print(x0, x1)
137
+
138
+ # Get the nearest grid point to logg
139
+ y0 = np.max(list(set(T1['logg'][np.where( (T1['teff'] == x0) & (T1['logg'] <= logg) )]) &
140
+ set(T1['logg'][np.where( (T1['teff'] == x1) & (T1['logg'] <= logg) )])))
141
+ y1 = np.min(list(set(T1['logg'][np.where( (T1['teff'] == x0) & (T1['logg'] >= logg) )]) &
142
+ set(T1['logg'][np.where( (T1['teff'] == x1) & (T1['logg'] >= logg) )])))
143
+ #print(y0, y1)
144
+
145
+ # Get the nearest grid point to [M/H]
146
+ z0 = np.max(list(set(T1['FeH'][np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['FeH'] <= metal) )]) &
147
+ set(T1['FeH'][np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['FeH'] <= metal) )])))
148
+ z1 = np.min(list(set(T1['FeH'][np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['FeH'] >= metal) )]) &
149
+ set(T1['FeH'][np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['FeH'] >= metal) )])))
150
+ #print(z0, z1)
151
+
152
+ # Get the nearest grid point to Alpha
153
+ t0 = np.max(list(set(T1['Y'][np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['FeH'] == z0) & (T1['Y'] <= alpha) )]) &
154
+ set(T1['Y'][np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['FeH'] == z1) & (T1['Y'] <= alpha) )])))
155
+ t1 = np.min(list(set(T1['Y'][np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['FeH'] == z0) & (T1['Y'] >= alpha) )]) &
156
+ set(T1['Y'][np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['FeH'] == z1) & (T1['Y'] >= alpha) )])))
157
+ #print(t0, t1)
158
+
159
+ elif modelset.lower() == 'sonora-2023':
160
+
161
+ #metal, alpha = 0, 0.28
162
+ # Get the nearest models to the gridpoint (teff)
163
+ x0 = np.max(T1['teff'][np.where(T1['teff'] <= teff)])
164
+ x1 = np.min(T1['teff'][np.where(T1['teff'] >= teff)])
165
+ #print('teff:', x0, teff, x1)
166
+
167
+ # Get the nearest grid point to logg
168
+ y0 = np.max(list(set(T1['logg'][np.where( (T1['teff'] == x0) & (T1['logg'] <= logg) )]) &
169
+ set(T1['logg'][np.where( (T1['teff'] == x1) & (T1['logg'] <= logg) )])))
170
+ y1 = np.min(list(set(T1['logg'][np.where( (T1['teff'] == x0) & (T1['logg'] >= logg) )]) &
171
+ set(T1['logg'][np.where( (T1['teff'] == x1) & (T1['logg'] >= logg) )])))
172
+ #print('logg:', y0, logg, y1)
173
+
174
+ # Get the nearest grid point to [M/H]
175
+ z0 = np.max(list(set(T1['M_H'][np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] <= metal) )]) &
176
+ set(T1['M_H'][np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] <= metal) )])))
177
+ z1 = np.min(list(set(T1['M_H'][np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] >= metal) )]) &
178
+ set(T1['M_H'][np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] >= metal) )])))
179
+ #print('metal:', z0, metal, z1)
180
+
181
+ # Get the nearest grid point to kzz
182
+ t0 = np.max(list(set(T1['kzz'][np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] == z0) & (T1['kzz'] <= kzz) )]) &
183
+ set(T1['kzz'][np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] == z1) & (T1['kzz'] <= kzz) )])))
184
+ t1 = np.min(list(set(T1['kzz'][np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] == z0) & (T1['kzz'] >= kzz) )]) &
185
+ set(T1['kzz'][np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] == z1) & (T1['kzz'] >= kzz) )])))
186
+ #print('kzz:', t0, kzz, t1)
187
+
188
+ # Get the nearest grid point to co
189
+ w0 = np.max(list(set(T1['CO'][np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] == z0) & (T1['kzz'] == t0) & (T1['CO'] <= co) )]) &
190
+ set(T1['CO'][np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] == z1) & (T1['kzz'] == t1) & (T1['CO'] <= co) )])))
191
+ w1 = np.min(list(set(T1['CO'][np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] == z0) & (T1['kzz'] == t0) & (T1['CO'] >= co) )]) &
192
+ set(T1['CO'][np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] == z1) & (T1['kzz'] == t1) & (T1['CO'] >= co) )])))
193
+ #print('co:', w0, co, w1)
194
+
195
+ elif kzz != 0:
196
+
197
+ #print('KZZ Models')
198
+ # Get the nearest models to the gridpoint (teff)
199
+ #print(teff, logg, metal, alpha, kzz)
200
+ x0 = np.max(T1['teff'][np.where( (T1['teff'] <= teff) )])
201
+ x1 = np.min(T1['teff'][np.where( (T1['teff'] >= teff) )])
202
+ #print(x0, x1)
203
+
204
+ # Get the nearest grid point to logg
205
+ y0 = np.max(list(set(T1['logg'][np.where( (T1['teff'] == x0) & (T1['logg'] <= logg) )]) &
206
+ set(T1['logg'][np.where( (T1['teff'] == x1) & (T1['logg'] <= logg) )])))
207
+ y1 = np.min(list(set(T1['logg'][np.where( (T1['teff'] == x0) & (T1['logg'] >= logg) )]) &
208
+ set(T1['logg'][np.where( (T1['teff'] == x1) & (T1['logg'] >= logg) )])))
209
+ #print(y0, y1)
210
+
211
+ # Get the nearest grid point to [M/H]
212
+ z0 = np.max(list(set(T1['M_H'][np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] <= metal) )]) &
213
+ set(T1['M_H'][np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] <= metal) )])))
214
+ z1 = np.min(list(set(T1['M_H'][np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] >= metal) )]) &
215
+ set(T1['M_H'][np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] >= metal) )])))
216
+ #print(z0, z1)
217
+
218
+ # Get the nearest grid point to Kzz
219
+ t0 = np.max(list(set(T1['kzz'][np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] == z0) & (T1['kzz'] <= kzz) )]) &
220
+ set(T1['kzz'][np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] == z1) & (T1['kzz'] <= kzz) )])))
221
+ t1 = np.min(list(set(T1['kzz'][np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] == z0) & (T1['kzz'] >= kzz) )]) &
222
+ set(T1['kzz'][np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] == z1) & (T1['kzz'] >= kzz) )])))
223
+ #print(t0, t1)
224
+
225
+ else:
226
+
227
+ # Get the nearest models to the gridpoint (teff)
228
+ x0 = np.max(T1['teff'][np.where(T1['teff'] <= teff)])
229
+ x1 = np.min(T1['teff'][np.where(T1['teff'] >= teff)])
230
+ #print('teff:', x0, teff, x1)
231
+ # Get the nearest grid point to logg
232
+ y0 = np.max(list(set(T1['logg'][np.where( (T1['teff'] == x0) & (T1['logg'] <= logg) )]) &
233
+ set(T1['logg'][np.where( (T1['teff'] == x1) & (T1['logg'] <= logg) )])))
234
+ y1 = np.min(list(set(T1['logg'][np.where( (T1['teff'] == x0) & (T1['logg'] >= logg) )]) &
235
+ set(T1['logg'][np.where( (T1['teff'] == x1) & (T1['logg'] >= logg) )])))
236
+ #print('logg:', y0, logg, y1)
237
+ # Get the nearest grid point to [M/H]
238
+ #print(metal)
239
+ #print(list(set(T1['M_H'][np.where( (T1['teff'] == x0) & (T1['logg'] == y0) )])))
240
+ #print(list(set(T1['M_H'][np.where( (T1['teff'] == x1) & (T1['logg'] == y1) )])))
241
+ #print(list(set(T1['M_H'][np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] <= metal))])))
242
+ #print(list(set(T1['M_H'][np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] <= metal))])))
243
+ #print(list(set(T1['M_H'][np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] >= metal))])))
244
+ #print(list(set(T1['M_H'][np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] >= metal))])))
245
+ z0 = np.max(list(set(T1['M_H'][np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] <= metal) )]) &
246
+ set(T1['M_H'][np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] <= metal) )])))
247
+ z1 = np.min(list(set(T1['M_H'][np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] >= metal) )]) &
248
+ set(T1['M_H'][np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] >= metal) )])))
249
+ #print('metal:', z0, metal, z1)
250
+ # Get the nearest grid point to Alpha
251
+ #print(list(set(T1['en'][np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] == z0) )])))
252
+ #print(list(set(T1['en'][np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] == z1) )])))
253
+ #print(list(set(T1['en'][np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] == z0) & (T1['en'] <= alpha) )])))
254
+ #print(list(set(T1['en'][np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] == z1) & (T1['en'] <= alpha) )])))
255
+ #print(list(set(T1['en'][np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] == z0) & (T1['en'] >= alpha) )])))
256
+ #print(list(set(T1['en'][np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] == z1) & (T1['en'] >= alpha) )])))
257
+ t0 = np.max(list(set(T1['en'][np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] == z0) & (T1['en'] <= alpha) )]) &
258
+ set(T1['en'][np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] == z1) & (T1['en'] <= alpha) )])))
259
+ t1 = np.min(list(set(T1['en'][np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] == z0) & (T1['en'] >= alpha) )]) &
260
+ set(T1['en'][np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] == z1) & (T1['en'] >= alpha) )])))
261
+ #print('alpha:', z0, alpha, z1)
262
+
263
+ except:
264
+ raise ValueError('Model Parameters Teff: %0.3f, logg: %0.3f, [M/H]: %0.3f, Alpha: %0.3f, kzz: %0.3f, CO: %0.3f are outside the model grid.'%(teff, logg, metal, alpha, kzz, co))
265
+
266
+
267
+ if 'sonora' in modelset.lower() and '2023' not in modelset:
268
+
269
+ # Get the 16 points
270
+ ind0000 = np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['FeH'] == z0) & (T1['Y'] == t0) ) # 0000
271
+ ind0001 = np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['FeH'] == z0) & (T1['Y'] == t1) ) # 0001
272
+ ind0010 = np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['FeH'] == z1) & (T1['Y'] == t0) ) # 0010
273
+ ind0011 = np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['FeH'] == z1) & (T1['Y'] == t1) ) # 0011
274
+ ind0100 = np.where( (T1['teff'] == x0) & (T1['logg'] == y1) & (T1['FeH'] == z0) & (T1['Y'] == t0) ) # 0100
275
+ ind0101 = np.where( (T1['teff'] == x0) & (T1['logg'] == y1) & (T1['FeH'] == z0) & (T1['Y'] == t1) ) # 0101
276
+ ind0110 = np.where( (T1['teff'] == x0) & (T1['logg'] == y1) & (T1['FeH'] == z1) & (T1['Y'] == t0) ) # 0110
277
+ ind0111 = np.where( (T1['teff'] == x0) & (T1['logg'] == y1) & (T1['FeH'] == z1) & (T1['Y'] == t1) ) # 0111
278
+ ind1000 = np.where( (T1['teff'] == x1) & (T1['logg'] == y0) & (T1['FeH'] == z0) & (T1['Y'] == t0) ) # 1000
279
+ ind1001 = np.where( (T1['teff'] == x1) & (T1['logg'] == y0) & (T1['FeH'] == z0) & (T1['Y'] == t1) ) # 1001
280
+ ind1010 = np.where( (T1['teff'] == x1) & (T1['logg'] == y0) & (T1['FeH'] == z1) & (T1['Y'] == t0) ) # 1010
281
+ ind1011 = np.where( (T1['teff'] == x1) & (T1['logg'] == y0) & (T1['FeH'] == z1) & (T1['Y'] == t1) ) # 1011
282
+ ind1100 = np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['FeH'] == z0) & (T1['Y'] == t0) ) # 1100
283
+ ind1101 = np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['FeH'] == z0) & (T1['Y'] == t1) ) # 1101
284
+ ind1110 = np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['FeH'] == z1) & (T1['Y'] == t0) ) # 1110
285
+ ind1111 = np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['FeH'] == z1) & (T1['Y'] == t1) ) # 1111
286
+ Points = [ [np.log10(T1['teff'][ind0000].data[0]), T1['logg'][ind0000].data[0], T1['FeH'][ind0000].data[0], T1['Y'][ind0000].data[0],
287
+ np.log10(GetModel(T1['teff'][ind0000], logg=T1['logg'][ind0000], metal=T1['FeH'][ind0000], alpha=T1['Y'][ind0000], instrument=instrument, order=order, gridfile=T1))],
288
+ [np.log10(T1['teff'][ind0001].data[0]), T1['logg'][ind0001].data[0], T1['FeH'][ind0001].data[0], T1['Y'][ind0001].data[0],
289
+ np.log10(GetModel(T1['teff'][ind0001], logg=T1['logg'][ind0001], metal=T1['FeH'][ind0001], alpha=T1['Y'][ind0001], instrument=instrument, order=order, gridfile=T1))],
290
+ [np.log10(T1['teff'][ind0010].data[0]), T1['logg'][ind0010].data[0], T1['FeH'][ind0010].data[0], T1['Y'][ind0010].data[0],
291
+ np.log10(GetModel(T1['teff'][ind0010], logg=T1['logg'][ind0010], metal=T1['FeH'][ind0010], alpha=T1['Y'][ind0010], instrument=instrument, order=order, gridfile=T1))],
292
+ [np.log10(T1['teff'][ind0011].data[0]), T1['logg'][ind0011].data[0], T1['FeH'][ind0011].data[0], T1['Y'][ind0011].data[0],
293
+ np.log10(GetModel(T1['teff'][ind0011], logg=T1['logg'][ind0011], metal=T1['FeH'][ind0011], alpha=T1['Y'][ind0011], instrument=instrument, order=order, gridfile=T1))],
294
+ [np.log10(T1['teff'][ind0100].data[0]), T1['logg'][ind0100].data[0], T1['FeH'][ind0100].data[0], T1['Y'][ind0100].data[0],
295
+ np.log10(GetModel(T1['teff'][ind0100], logg=T1['logg'][ind0100], metal=T1['FeH'][ind0100], alpha=T1['Y'][ind0100], instrument=instrument, order=order, gridfile=T1))],
296
+ [np.log10(T1['teff'][ind0101].data[0]), T1['logg'][ind0101].data[0], T1['FeH'][ind0101].data[0], T1['Y'][ind0101].data[0],
297
+ np.log10(GetModel(T1['teff'][ind0101], logg=T1['logg'][ind0101], metal=T1['FeH'][ind0101], alpha=T1['Y'][ind0101], instrument=instrument, order=order, gridfile=T1))],
298
+ [np.log10(T1['teff'][ind0110].data[0]), T1['logg'][ind0110].data[0], T1['FeH'][ind0110].data[0], T1['Y'][ind0110].data[0],
299
+ np.log10(GetModel(T1['teff'][ind0110], logg=T1['logg'][ind0110], metal=T1['FeH'][ind0110], alpha=T1['Y'][ind0110], instrument=instrument, order=order, gridfile=T1))],
300
+ [np.log10(T1['teff'][ind0111].data[0]), T1['logg'][ind0111].data[0], T1['FeH'][ind0111].data[0], T1['Y'][ind0111].data[0],
301
+ np.log10(GetModel(T1['teff'][ind0111], logg=T1['logg'][ind0111], metal=T1['FeH'][ind0111], alpha=T1['Y'][ind0111], instrument=instrument, order=order, gridfile=T1))],
302
+ [np.log10(T1['teff'][ind1000].data[0]), T1['logg'][ind1000].data[0], T1['FeH'][ind1000].data[0], T1['Y'][ind1000].data[0],
303
+ np.log10(GetModel(T1['teff'][ind1000], logg=T1['logg'][ind1000], metal=T1['FeH'][ind1000], alpha=T1['Y'][ind1000], instrument=instrument, order=order, gridfile=T1))],
304
+ [np.log10(T1['teff'][ind1001].data[0]), T1['logg'][ind1001].data[0], T1['FeH'][ind1001].data[0], T1['Y'][ind1001].data[0],
305
+ np.log10(GetModel(T1['teff'][ind1001], logg=T1['logg'][ind1001], metal=T1['FeH'][ind1001], alpha=T1['Y'][ind1001], instrument=instrument, order=order, gridfile=T1))],
306
+ [np.log10(T1['teff'][ind1010].data[0]), T1['logg'][ind1010].data[0], T1['FeH'][ind1010].data[0], T1['Y'][ind1010].data[0],
307
+ np.log10(GetModel(T1['teff'][ind1010], logg=T1['logg'][ind1010], metal=T1['FeH'][ind1010], alpha=T1['Y'][ind1010], instrument=instrument, order=order, gridfile=T1))],
308
+ [np.log10(T1['teff'][ind1011].data[0]), T1['logg'][ind1011].data[0], T1['FeH'][ind1011].data[0], T1['Y'][ind1011].data[0],
309
+ np.log10(GetModel(T1['teff'][ind1011], logg=T1['logg'][ind1011], metal=T1['FeH'][ind1011], alpha=T1['Y'][ind1011], instrument=instrument, order=order, gridfile=T1))],
310
+ [np.log10(T1['teff'][ind1100].data[0]), T1['logg'][ind1100].data[0], T1['FeH'][ind1100].data[0], T1['Y'][ind1100].data[0],
311
+ np.log10(GetModel(T1['teff'][ind1100], logg=T1['logg'][ind1100], metal=T1['FeH'][ind1100], alpha=T1['Y'][ind1100], instrument=instrument, order=order, gridfile=T1))],
312
+ [np.log10(T1['teff'][ind1101].data[0]), T1['logg'][ind1101].data[0], T1['FeH'][ind1101].data[0], T1['Y'][ind1101].data[0],
313
+ np.log10(GetModel(T1['teff'][ind1101], logg=T1['logg'][ind1101], metal=T1['FeH'][ind1101], alpha=T1['Y'][ind1101], instrument=instrument, order=order, gridfile=T1))],
314
+ [np.log10(T1['teff'][ind1110].data[0]), T1['logg'][ind1110].data[0], T1['FeH'][ind1110].data[0], T1['Y'][ind1110].data[0],
315
+ np.log10(GetModel(T1['teff'][ind1110], logg=T1['logg'][ind1110], metal=T1['FeH'][ind1110], alpha=T1['Y'][ind1110], instrument=instrument, order=order, gridfile=T1))],
316
+ [np.log10(T1['teff'][ind1111].data[0]), T1['logg'][ind1111].data[0], T1['FeH'][ind1111].data[0], T1['Y'][ind1111].data[0],
317
+ np.log10(GetModel(T1['teff'][ind1111], logg=T1['logg'][ind1111], metal=T1['FeH'][ind1111], alpha=T1['Y'][ind1111], instrument=instrument, order=order, gridfile=T1))],
318
+ ]
319
+ #print(Points)
320
+ waves2 = GetModel(T1['teff'][ind1111], logg=T1['logg'][ind1111], metal=T1['FeH'][ind1111], alpha=T1['Y'][ind1111], instrument=instrument, order=order, gridfile=T1, wave=True)
321
+
322
+ elif modelset.lower() == 'sonora-2023':
323
+
324
+ # Get the 32 points
325
+ ind00000 = np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] == z0) & (T1['kzz'] == t0) & (T1['CO'] == w0) ) # 00000
326
+ ind00001 = np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] == z0) & (T1['kzz'] == t0) & (T1['CO'] == w1) ) # 00001
327
+ ind00010 = np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] == z0) & (T1['kzz'] == t1) & (T1['CO'] == w0) ) # 00010
328
+ ind00011 = np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] == z0) & (T1['kzz'] == t1) & (T1['CO'] == w1) ) # 00011
329
+ ind00100 = np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] == z1) & (T1['kzz'] == t0) & (T1['CO'] == w0) ) # 00100
330
+ ind00101 = np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] == z1) & (T1['kzz'] == t0) & (T1['CO'] == w1) ) # 00101
331
+ ind00110 = np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] == z1) & (T1['kzz'] == t1) & (T1['CO'] == w0) ) # 00110
332
+ ind00111 = np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] == z1) & (T1['kzz'] == t1) & (T1['CO'] == w1) ) # 00111
333
+ ind01000 = np.where( (T1['teff'] == x0) & (T1['logg'] == y1) & (T1['M_H'] == z0) & (T1['kzz'] == t0) & (T1['CO'] == w0) ) # 01000
334
+ ind01001 = np.where( (T1['teff'] == x0) & (T1['logg'] == y1) & (T1['M_H'] == z0) & (T1['kzz'] == t0) & (T1['CO'] == w1) ) # 01001
335
+ ind01010 = np.where( (T1['teff'] == x0) & (T1['logg'] == y1) & (T1['M_H'] == z0) & (T1['kzz'] == t1) & (T1['CO'] == w0) ) # 01010
336
+ ind01011 = np.where( (T1['teff'] == x0) & (T1['logg'] == y1) & (T1['M_H'] == z0) & (T1['kzz'] == t1) & (T1['CO'] == w1) ) # 01011
337
+ ind01100 = np.where( (T1['teff'] == x0) & (T1['logg'] == y1) & (T1['M_H'] == z1) & (T1['kzz'] == t0) & (T1['CO'] == w0) ) # 01100
338
+ ind01101 = np.where( (T1['teff'] == x0) & (T1['logg'] == y1) & (T1['M_H'] == z1) & (T1['kzz'] == t0) & (T1['CO'] == w1) ) # 01101
339
+ ind01110 = np.where( (T1['teff'] == x0) & (T1['logg'] == y1) & (T1['M_H'] == z1) & (T1['kzz'] == t1) & (T1['CO'] == w0) ) # 01110
340
+ ind01111 = np.where( (T1['teff'] == x0) & (T1['logg'] == y1) & (T1['M_H'] == z1) & (T1['kzz'] == t1) & (T1['CO'] == w1) ) # 01111
341
+ ind10000 = np.where( (T1['teff'] == x1) & (T1['logg'] == y0) & (T1['M_H'] == z0) & (T1['kzz'] == t0) & (T1['CO'] == w0) ) # 10000
342
+ ind10001 = np.where( (T1['teff'] == x1) & (T1['logg'] == y0) & (T1['M_H'] == z0) & (T1['kzz'] == t0) & (T1['CO'] == w1) ) # 10001
343
+ ind10010 = np.where( (T1['teff'] == x1) & (T1['logg'] == y0) & (T1['M_H'] == z0) & (T1['kzz'] == t1) & (T1['CO'] == w0) ) # 10010
344
+ ind10011 = np.where( (T1['teff'] == x1) & (T1['logg'] == y0) & (T1['M_H'] == z0) & (T1['kzz'] == t1) & (T1['CO'] == w1) ) # 10011
345
+ ind10100 = np.where( (T1['teff'] == x1) & (T1['logg'] == y0) & (T1['M_H'] == z1) & (T1['kzz'] == t0) & (T1['CO'] == w0) ) # 10100
346
+ ind10101 = np.where( (T1['teff'] == x1) & (T1['logg'] == y0) & (T1['M_H'] == z1) & (T1['kzz'] == t0) & (T1['CO'] == w1) ) # 10101
347
+ ind10110 = np.where( (T1['teff'] == x1) & (T1['logg'] == y0) & (T1['M_H'] == z1) & (T1['kzz'] == t1) & (T1['CO'] == w0) ) # 10110
348
+ ind10111 = np.where( (T1['teff'] == x1) & (T1['logg'] == y0) & (T1['M_H'] == z1) & (T1['kzz'] == t1) & (T1['CO'] == w1) ) # 10111
349
+ ind11000 = np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] == z0) & (T1['kzz'] == t0) & (T1['CO'] == w0) ) # 11000
350
+ ind11001 = np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] == z0) & (T1['kzz'] == t0) & (T1['CO'] == w1) ) # 11001
351
+ ind11010 = np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] == z0) & (T1['kzz'] == t1) & (T1['CO'] == w0) ) # 11010
352
+ ind11011 = np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] == z0) & (T1['kzz'] == t1) & (T1['CO'] == w1) ) # 11011
353
+ ind11100 = np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] == z1) & (T1['kzz'] == t0) & (T1['CO'] == w0) ) # 11100
354
+ ind11101 = np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] == z1) & (T1['kzz'] == t0) & (T1['CO'] == w1) ) # 11101
355
+ ind11110 = np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] == z1) & (T1['kzz'] == t1) & (T1['CO'] == w0) ) # 11110
356
+ ind11111 = np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] == z1) & (T1['kzz'] == t1) & (T1['CO'] == w1) ) # 11111
357
+ Points = [ [np.log10(T1['teff'][ind00000].data[0]), T1['logg'][ind00000].data[0], T1['M_H'][ind00000].data[0], np.log10(T1['kzz'][ind00000].data[0]), T1['CO'][ind00000].data[0],
358
+ np.log10(GetModel(T1['teff'][ind00000], logg=T1['logg'][ind00000], metal=T1['M_H'][ind00000], kzz=T1['kzz'][ind00000], co=T1['CO'][ind00000], instrument=instrument, order=order, gridfile=T1))],
359
+ [np.log10(T1['teff'][ind00001].data[0]), T1['logg'][ind00001].data[0], T1['M_H'][ind00001].data[0], np.log10(T1['kzz'][ind00001].data[0]), T1['CO'][ind00001].data[0],
360
+ np.log10(GetModel(T1['teff'][ind00001], logg=T1['logg'][ind00001], metal=T1['M_H'][ind00001], kzz=T1['kzz'][ind00001], co=T1['CO'][ind00001], instrument=instrument, order=order, gridfile=T1))],
361
+ [np.log10(T1['teff'][ind00010].data[0]), T1['logg'][ind00010].data[0], T1['M_H'][ind00010].data[0], np.log10(T1['kzz'][ind00010].data[0]), T1['CO'][ind00010].data[0],
362
+ np.log10(GetModel(T1['teff'][ind00010], logg=T1['logg'][ind00010], metal=T1['M_H'][ind00010], kzz=T1['kzz'][ind00010], co=T1['CO'][ind00010], instrument=instrument, order=order, gridfile=T1))],
363
+ [np.log10(T1['teff'][ind00011].data[0]), T1['logg'][ind00011].data[0], T1['M_H'][ind00011].data[0], np.log10(T1['kzz'][ind00011].data[0]), T1['CO'][ind00011].data[0],
364
+ np.log10(GetModel(T1['teff'][ind00011], logg=T1['logg'][ind00011], metal=T1['M_H'][ind00011], kzz=T1['kzz'][ind00011], co=T1['CO'][ind00011], instrument=instrument, order=order, gridfile=T1))],
365
+ [np.log10(T1['teff'][ind00100].data[0]), T1['logg'][ind00100].data[0], T1['M_H'][ind00100].data[0], np.log10(T1['kzz'][ind00100].data[0]), T1['CO'][ind00100].data[0],
366
+ np.log10(GetModel(T1['teff'][ind00100], logg=T1['logg'][ind00100], metal=T1['M_H'][ind00100], kzz=T1['kzz'][ind00100], co=T1['CO'][ind00100], instrument=instrument, order=order, gridfile=T1))],
367
+ [np.log10(T1['teff'][ind00101].data[0]), T1['logg'][ind00101].data[0], T1['M_H'][ind00101].data[0], np.log10(T1['kzz'][ind00101].data[0]), T1['CO'][ind00101].data[0],
368
+ np.log10(GetModel(T1['teff'][ind00101], logg=T1['logg'][ind00101], metal=T1['M_H'][ind00101], kzz=T1['kzz'][ind00101], co=T1['CO'][ind00101], instrument=instrument, order=order, gridfile=T1))],
369
+ [np.log10(T1['teff'][ind00110].data[0]), T1['logg'][ind00110].data[0], T1['M_H'][ind00110].data[0], np.log10(T1['kzz'][ind00110].data[0]), T1['CO'][ind00110].data[0],
370
+ np.log10(GetModel(T1['teff'][ind00110], logg=T1['logg'][ind00110], metal=T1['M_H'][ind00110], kzz=T1['kzz'][ind00110], co=T1['CO'][ind00110], instrument=instrument, order=order, gridfile=T1))],
371
+ [np.log10(T1['teff'][ind00111].data[0]), T1['logg'][ind00111].data[0], T1['M_H'][ind00111].data[0], np.log10(T1['kzz'][ind00111].data[0]), T1['CO'][ind00111].data[0],
372
+ np.log10(GetModel(T1['teff'][ind00111], logg=T1['logg'][ind00111], metal=T1['M_H'][ind00111], kzz=T1['kzz'][ind00111], co=T1['CO'][ind00111], instrument=instrument, order=order, gridfile=T1))],
373
+ [np.log10(T1['teff'][ind01000].data[0]), T1['logg'][ind01000].data[0], T1['M_H'][ind01000].data[0], np.log10(T1['kzz'][ind01000].data[0]), T1['CO'][ind01000].data[0],
374
+ np.log10(GetModel(T1['teff'][ind01000], logg=T1['logg'][ind01000], metal=T1['M_H'][ind01000], kzz=T1['kzz'][ind01000], co=T1['CO'][ind01000], instrument=instrument, order=order, gridfile=T1))],
375
+ [np.log10(T1['teff'][ind01001].data[0]), T1['logg'][ind01001].data[0], T1['M_H'][ind01001].data[0], np.log10(T1['kzz'][ind01001].data[0]), T1['CO'][ind01001].data[0],
376
+ np.log10(GetModel(T1['teff'][ind01001], logg=T1['logg'][ind01001], metal=T1['M_H'][ind01001], kzz=T1['kzz'][ind01001], co=T1['CO'][ind01001], instrument=instrument, order=order, gridfile=T1))],
377
+ [np.log10(T1['teff'][ind01010].data[0]), T1['logg'][ind01010].data[0], T1['M_H'][ind01010].data[0], np.log10(T1['kzz'][ind01010].data[0]), T1['CO'][ind01010].data[0],
378
+ np.log10(GetModel(T1['teff'][ind01010], logg=T1['logg'][ind01010], metal=T1['M_H'][ind01010], kzz=T1['kzz'][ind01010], co=T1['CO'][ind01010], instrument=instrument, order=order, gridfile=T1))],
379
+ [np.log10(T1['teff'][ind01011].data[0]), T1['logg'][ind01011].data[0], T1['M_H'][ind01011].data[0], np.log10(T1['kzz'][ind01011].data[0]), T1['CO'][ind01011].data[0],
380
+ np.log10(GetModel(T1['teff'][ind01011], logg=T1['logg'][ind01011], metal=T1['M_H'][ind01011], kzz=T1['kzz'][ind01011], co=T1['CO'][ind01011], instrument=instrument, order=order, gridfile=T1))],
381
+ [np.log10(T1['teff'][ind01100].data[0]), T1['logg'][ind01100].data[0], T1['M_H'][ind01100].data[0], np.log10(T1['kzz'][ind01100].data[0]), T1['CO'][ind01100].data[0],
382
+ np.log10(GetModel(T1['teff'][ind01100], logg=T1['logg'][ind01100], metal=T1['M_H'][ind01100], kzz=T1['kzz'][ind01100], co=T1['CO'][ind01100], instrument=instrument, order=order, gridfile=T1))],
383
+ [np.log10(T1['teff'][ind01101].data[0]), T1['logg'][ind01101].data[0], T1['M_H'][ind01101].data[0], np.log10(T1['kzz'][ind01101].data[0]), T1['CO'][ind01101].data[0],
384
+ np.log10(GetModel(T1['teff'][ind01101], logg=T1['logg'][ind01101], metal=T1['M_H'][ind01101], kzz=T1['kzz'][ind01101], co=T1['CO'][ind01101], instrument=instrument, order=order, gridfile=T1))],
385
+ [np.log10(T1['teff'][ind01110].data[0]), T1['logg'][ind01110].data[0], T1['M_H'][ind01110].data[0], np.log10(T1['kzz'][ind01110].data[0]), T1['CO'][ind01110].data[0],
386
+ np.log10(GetModel(T1['teff'][ind01110], logg=T1['logg'][ind01110], metal=T1['M_H'][ind01110], kzz=T1['kzz'][ind01110], co=T1['CO'][ind01110], instrument=instrument, order=order, gridfile=T1))],
387
+ [np.log10(T1['teff'][ind01111].data[0]), T1['logg'][ind01111].data[0], T1['M_H'][ind01111].data[0], np.log10(T1['kzz'][ind01111].data[0]), T1['CO'][ind01111].data[0],
388
+ np.log10(GetModel(T1['teff'][ind01111], logg=T1['logg'][ind01111], metal=T1['M_H'][ind01111], kzz=T1['kzz'][ind01111], co=T1['CO'][ind01111], instrument=instrument, order=order, gridfile=T1))],
389
+ [np.log10(T1['teff'][ind10000].data[0]), T1['logg'][ind10000].data[0], T1['M_H'][ind10000].data[0], np.log10(T1['kzz'][ind10000].data[0]), T1['CO'][ind10000].data[0],
390
+ np.log10(GetModel(T1['teff'][ind10000], logg=T1['logg'][ind10000], metal=T1['M_H'][ind10000], kzz=T1['kzz'][ind10000], co=T1['CO'][ind10000], instrument=instrument, order=order, gridfile=T1))],
391
+ [np.log10(T1['teff'][ind10001].data[0]), T1['logg'][ind10001].data[0], T1['M_H'][ind10001].data[0], np.log10(T1['kzz'][ind10001].data[0]), T1['CO'][ind10001].data[0],
392
+ np.log10(GetModel(T1['teff'][ind10001], logg=T1['logg'][ind10001], metal=T1['M_H'][ind10001], kzz=T1['kzz'][ind10001], co=T1['CO'][ind10001], instrument=instrument, order=order, gridfile=T1))],
393
+ [np.log10(T1['teff'][ind10010].data[0]), T1['logg'][ind10010].data[0], T1['M_H'][ind10010].data[0], np.log10(T1['kzz'][ind10010].data[0]), T1['CO'][ind10010].data[0],
394
+ np.log10(GetModel(T1['teff'][ind10010], logg=T1['logg'][ind10010], metal=T1['M_H'][ind10010], kzz=T1['kzz'][ind10010], co=T1['CO'][ind10010], instrument=instrument, order=order, gridfile=T1))],
395
+ [np.log10(T1['teff'][ind10011].data[0]), T1['logg'][ind10011].data[0], T1['M_H'][ind10011].data[0], np.log10(T1['kzz'][ind10011].data[0]), T1['CO'][ind10011].data[0],
396
+ np.log10(GetModel(T1['teff'][ind10011], logg=T1['logg'][ind10011], metal=T1['M_H'][ind10011], kzz=T1['kzz'][ind10011], co=T1['CO'][ind10011], instrument=instrument, order=order, gridfile=T1))],
397
+ [np.log10(T1['teff'][ind10100].data[0]), T1['logg'][ind10100].data[0], T1['M_H'][ind10100].data[0], np.log10(T1['kzz'][ind10100].data[0]), T1['CO'][ind10100].data[0],
398
+ np.log10(GetModel(T1['teff'][ind10100], logg=T1['logg'][ind10100], metal=T1['M_H'][ind10100], kzz=T1['kzz'][ind10100], co=T1['CO'][ind10100], instrument=instrument, order=order, gridfile=T1))],
399
+ [np.log10(T1['teff'][ind10101].data[0]), T1['logg'][ind10101].data[0], T1['M_H'][ind10101].data[0], np.log10(T1['kzz'][ind10101].data[0]), T1['CO'][ind10101].data[0],
400
+ np.log10(GetModel(T1['teff'][ind10101], logg=T1['logg'][ind10101], metal=T1['M_H'][ind10101], kzz=T1['kzz'][ind10101], co=T1['CO'][ind10101], instrument=instrument, order=order, gridfile=T1))],
401
+ [np.log10(T1['teff'][ind10110].data[0]), T1['logg'][ind10110].data[0], T1['M_H'][ind10110].data[0], np.log10(T1['kzz'][ind10110].data[0]), T1['CO'][ind10110].data[0],
402
+ np.log10(GetModel(T1['teff'][ind10110], logg=T1['logg'][ind10110], metal=T1['M_H'][ind10110], kzz=T1['kzz'][ind10110], co=T1['CO'][ind10110], instrument=instrument, order=order, gridfile=T1))],
403
+ [np.log10(T1['teff'][ind10111].data[0]), T1['logg'][ind10111].data[0], T1['M_H'][ind10111].data[0], np.log10(T1['kzz'][ind10111].data[0]), T1['CO'][ind10111].data[0],
404
+ np.log10(GetModel(T1['teff'][ind10111], logg=T1['logg'][ind10111], metal=T1['M_H'][ind10111], kzz=T1['kzz'][ind10111], co=T1['CO'][ind10111], instrument=instrument, order=order, gridfile=T1))],
405
+ [np.log10(T1['teff'][ind11000].data[0]), T1['logg'][ind11000].data[0], T1['M_H'][ind11000].data[0], np.log10(T1['kzz'][ind11000].data[0]), T1['CO'][ind11000].data[0],
406
+ np.log10(GetModel(T1['teff'][ind11000], logg=T1['logg'][ind11000], metal=T1['M_H'][ind11000], kzz=T1['kzz'][ind11000], co=T1['CO'][ind11000], instrument=instrument, order=order, gridfile=T1))],
407
+ [np.log10(T1['teff'][ind11001].data[0]), T1['logg'][ind11001].data[0], T1['M_H'][ind11001].data[0], np.log10(T1['kzz'][ind11001].data[0]), T1['CO'][ind11001].data[0],
408
+ np.log10(GetModel(T1['teff'][ind11001], logg=T1['logg'][ind11001], metal=T1['M_H'][ind11001], kzz=T1['kzz'][ind11001], co=T1['CO'][ind11001], instrument=instrument, order=order, gridfile=T1))],
409
+ [np.log10(T1['teff'][ind11010].data[0]), T1['logg'][ind11010].data[0], T1['M_H'][ind11010].data[0], np.log10(T1['kzz'][ind11010].data[0]), T1['CO'][ind11010].data[0],
410
+ np.log10(GetModel(T1['teff'][ind11010], logg=T1['logg'][ind11010], metal=T1['M_H'][ind11010], kzz=T1['kzz'][ind11010], co=T1['CO'][ind11010], instrument=instrument, order=order, gridfile=T1))],
411
+ [np.log10(T1['teff'][ind11011].data[0]), T1['logg'][ind11011].data[0], T1['M_H'][ind11011].data[0], np.log10(T1['kzz'][ind11011].data[0]), T1['CO'][ind11011].data[0],
412
+ np.log10(GetModel(T1['teff'][ind11011], logg=T1['logg'][ind11011], metal=T1['M_H'][ind11011], kzz=T1['kzz'][ind11011], co=T1['CO'][ind11011], instrument=instrument, order=order, gridfile=T1))],
413
+ [np.log10(T1['teff'][ind11100].data[0]), T1['logg'][ind11100].data[0], T1['M_H'][ind11100].data[0], np.log10(T1['kzz'][ind11100].data[0]), T1['CO'][ind11100].data[0],
414
+ np.log10(GetModel(T1['teff'][ind11100], logg=T1['logg'][ind11100], metal=T1['M_H'][ind11100], kzz=T1['kzz'][ind11100], co=T1['CO'][ind11100], instrument=instrument, order=order, gridfile=T1))],
415
+ [np.log10(T1['teff'][ind11101].data[0]), T1['logg'][ind11101].data[0], T1['M_H'][ind11101].data[0], np.log10(T1['kzz'][ind11101].data[0]), T1['CO'][ind11101].data[0],
416
+ np.log10(GetModel(T1['teff'][ind11101], logg=T1['logg'][ind11101], metal=T1['M_H'][ind11101], kzz=T1['kzz'][ind11101], co=T1['CO'][ind11101], instrument=instrument, order=order, gridfile=T1))],
417
+ [np.log10(T1['teff'][ind11110].data[0]), T1['logg'][ind11110].data[0], T1['M_H'][ind11110].data[0], np.log10(T1['kzz'][ind11110].data[0]), T1['CO'][ind11110].data[0],
418
+ np.log10(GetModel(T1['teff'][ind11110], logg=T1['logg'][ind11110], metal=T1['M_H'][ind11110], kzz=T1['kzz'][ind11110], co=T1['CO'][ind11110], instrument=instrument, order=order, gridfile=T1))],
419
+ [np.log10(T1['teff'][ind11111].data[0]), T1['logg'][ind11111].data[0], T1['M_H'][ind11111].data[0], np.log10(T1['kzz'][ind11111].data[0]), T1['CO'][ind11111].data[0],
420
+ np.log10(GetModel(T1['teff'][ind11111], logg=T1['logg'][ind11111], metal=T1['M_H'][ind11111], kzz=T1['kzz'][ind11111], co=T1['CO'][ind11111], instrument=instrument, order=order, gridfile=T1))],
421
+ ]
422
+ #print(Points)
423
+ waves2 = GetModel(T1['teff'][ind11111], logg=T1['logg'][ind11111], metal=T1['M_H'][ind11111], kzz=T1['kzz'][ind11111], co=T1['CO'][ind11111], instrument=instrument, order=order, gridfile=T1, wave=True)
424
+
425
+ else:
426
+
427
+ # Get the 16 points
428
+ ind0000 = np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] == z0) & (T1['en'] == t0) ) # 0000
429
+ ind0001 = np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] == z0) & (T1['en'] == t1) ) # 0001
430
+ ind0010 = np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] == z1) & (T1['en'] == t0) ) # 0010
431
+ ind0011 = np.where( (T1['teff'] == x0) & (T1['logg'] == y0) & (T1['M_H'] == z1) & (T1['en'] == t1) ) # 0011
432
+ ind0100 = np.where( (T1['teff'] == x0) & (T1['logg'] == y1) & (T1['M_H'] == z0) & (T1['en'] == t0) ) # 0100
433
+ ind0101 = np.where( (T1['teff'] == x0) & (T1['logg'] == y1) & (T1['M_H'] == z0) & (T1['en'] == t1) ) # 0101
434
+ ind0110 = np.where( (T1['teff'] == x0) & (T1['logg'] == y1) & (T1['M_H'] == z1) & (T1['en'] == t0) ) # 0110
435
+ ind0111 = np.where( (T1['teff'] == x0) & (T1['logg'] == y1) & (T1['M_H'] == z1) & (T1['en'] == t1) ) # 0111
436
+ ind1000 = np.where( (T1['teff'] == x1) & (T1['logg'] == y0) & (T1['M_H'] == z0) & (T1['en'] == t0) ) # 1000
437
+ ind1001 = np.where( (T1['teff'] == x1) & (T1['logg'] == y0) & (T1['M_H'] == z0) & (T1['en'] == t1) ) # 1001
438
+ ind1010 = np.where( (T1['teff'] == x1) & (T1['logg'] == y0) & (T1['M_H'] == z1) & (T1['en'] == t0) ) # 1010
439
+ ind1011 = np.where( (T1['teff'] == x1) & (T1['logg'] == y0) & (T1['M_H'] == z1) & (T1['en'] == t1) ) # 1011
440
+ ind1100 = np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] == z0) & (T1['en'] == t0) ) # 1100
441
+ ind1101 = np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] == z0) & (T1['en'] == t1) ) # 1101
442
+ ind1110 = np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] == z1) & (T1['en'] == t0) ) # 1110
443
+ ind1111 = np.where( (T1['teff'] == x1) & (T1['logg'] == y1) & (T1['M_H'] == z1) & (T1['en'] == t1) ) # 1111
444
+ Points = [ [np.log10(T1['teff'][ind0000].data[0]), T1['logg'][ind0000].data[0], T1['M_H'][ind0000].data[0], T1['en'][ind0000].data[0],
445
+ np.log10(GetModel(T1['teff'][ind0000], logg=T1['logg'][ind0000], metal=T1['M_H'][ind0000], alpha=T1['en'][ind0000], instrument=instrument, order=order, gridfile=T1))],
446
+ [np.log10(T1['teff'][ind0001].data[0]), T1['logg'][ind0001].data[0], T1['M_H'][ind0001].data[0], T1['en'][ind0001].data[0],
447
+ np.log10(GetModel(T1['teff'][ind0001], logg=T1['logg'][ind0001], metal=T1['M_H'][ind0001], alpha=T1['en'][ind0001], instrument=instrument, order=order, gridfile=T1))],
448
+ [np.log10(T1['teff'][ind0010].data[0]), T1['logg'][ind0010].data[0], T1['M_H'][ind0010].data[0], T1['en'][ind0010].data[0],
449
+ np.log10(GetModel(T1['teff'][ind0010], logg=T1['logg'][ind0010], metal=T1['M_H'][ind0010], alpha=T1['en'][ind0010], instrument=instrument, order=order, gridfile=T1))],
450
+ [np.log10(T1['teff'][ind0011].data[0]), T1['logg'][ind0011].data[0], T1['M_H'][ind0011].data[0], T1['en'][ind0011].data[0],
451
+ np.log10(GetModel(T1['teff'][ind0011], logg=T1['logg'][ind0011], metal=T1['M_H'][ind0011], alpha=T1['en'][ind0011], instrument=instrument, order=order, gridfile=T1))],
452
+ [np.log10(T1['teff'][ind0100].data[0]), T1['logg'][ind0100].data[0], T1['M_H'][ind0100].data[0], T1['en'][ind0100].data[0],
453
+ np.log10(GetModel(T1['teff'][ind0100], logg=T1['logg'][ind0100], metal=T1['M_H'][ind0100], alpha=T1['en'][ind0100], instrument=instrument, order=order, gridfile=T1))],
454
+ [np.log10(T1['teff'][ind0101].data[0]), T1['logg'][ind0101].data[0], T1['M_H'][ind0101].data[0], T1['en'][ind0101].data[0],
455
+ np.log10(GetModel(T1['teff'][ind0101], logg=T1['logg'][ind0101], metal=T1['M_H'][ind0101], alpha=T1['en'][ind0101], instrument=instrument, order=order, gridfile=T1))],
456
+ [np.log10(T1['teff'][ind0110].data[0]), T1['logg'][ind0110].data[0], T1['M_H'][ind0110].data[0], T1['en'][ind0110].data[0],
457
+ np.log10(GetModel(T1['teff'][ind0110], logg=T1['logg'][ind0110], metal=T1['M_H'][ind0110], alpha=T1['en'][ind0110], instrument=instrument, order=order, gridfile=T1))],
458
+ [np.log10(T1['teff'][ind0111].data[0]), T1['logg'][ind0111].data[0], T1['M_H'][ind0111].data[0], T1['en'][ind0111].data[0],
459
+ np.log10(GetModel(T1['teff'][ind0111], logg=T1['logg'][ind0111], metal=T1['M_H'][ind0111], alpha=T1['en'][ind0111], instrument=instrument, order=order, gridfile=T1))],
460
+ [np.log10(T1['teff'][ind1000].data[0]), T1['logg'][ind1000].data[0], T1['M_H'][ind1000].data[0], T1['en'][ind1000].data[0],
461
+ np.log10(GetModel(T1['teff'][ind1000], logg=T1['logg'][ind1000], metal=T1['M_H'][ind1000], alpha=T1['en'][ind1000], instrument=instrument, order=order, gridfile=T1))],
462
+ [np.log10(T1['teff'][ind1001].data[0]), T1['logg'][ind1001].data[0], T1['M_H'][ind1001].data[0], T1['en'][ind1001].data[0],
463
+ np.log10(GetModel(T1['teff'][ind1001], logg=T1['logg'][ind1001], metal=T1['M_H'][ind1001], alpha=T1['en'][ind1001], instrument=instrument, order=order, gridfile=T1))],
464
+ [np.log10(T1['teff'][ind1010].data[0]), T1['logg'][ind1010].data[0], T1['M_H'][ind1010].data[0], T1['en'][ind1010].data[0],
465
+ np.log10(GetModel(T1['teff'][ind1010], logg=T1['logg'][ind1010], metal=T1['M_H'][ind1010], alpha=T1['en'][ind1010], instrument=instrument, order=order, gridfile=T1))],
466
+ [np.log10(T1['teff'][ind1011].data[0]), T1['logg'][ind1011].data[0], T1['M_H'][ind1011].data[0], T1['en'][ind1011].data[0],
467
+ np.log10(GetModel(T1['teff'][ind1011], logg=T1['logg'][ind1011], metal=T1['M_H'][ind1011], alpha=T1['en'][ind1011], instrument=instrument, order=order, gridfile=T1))],
468
+ [np.log10(T1['teff'][ind1100].data[0]), T1['logg'][ind1100].data[0], T1['M_H'][ind1100].data[0], T1['en'][ind1100].data[0],
469
+ np.log10(GetModel(T1['teff'][ind1100], logg=T1['logg'][ind1100], metal=T1['M_H'][ind1100], alpha=T1['en'][ind1100], instrument=instrument, order=order, gridfile=T1))],
470
+ [np.log10(T1['teff'][ind1101].data[0]), T1['logg'][ind1101].data[0], T1['M_H'][ind1101].data[0], T1['en'][ind1101].data[0],
471
+ np.log10(GetModel(T1['teff'][ind1101], logg=T1['logg'][ind1101], metal=T1['M_H'][ind1101], alpha=T1['en'][ind1101], instrument=instrument, order=order, gridfile=T1))],
472
+ [np.log10(T1['teff'][ind1110].data[0]), T1['logg'][ind1110].data[0], T1['M_H'][ind1110].data[0], T1['en'][ind1110].data[0],
473
+ np.log10(GetModel(T1['teff'][ind1110], logg=T1['logg'][ind1110], metal=T1['M_H'][ind1110], alpha=T1['en'][ind1110], instrument=instrument, order=order, gridfile=T1))],
474
+ [np.log10(T1['teff'][ind1111].data[0]), T1['logg'][ind1111].data[0], T1['M_H'][ind1111].data[0], T1['en'][ind1111].data[0],
475
+ np.log10(GetModel(T1['teff'][ind1111], logg=T1['logg'][ind1111], metal=T1['M_H'][ind1111], alpha=T1['en'][ind1111], instrument=instrument, order=order, gridfile=T1))],
476
+ ]
477
+ #print(Points)
478
+ waves2 = GetModel(T1['teff'][ind1111], logg=T1['logg'][ind1111], metal=T1['M_H'][ind1111], alpha=T1['en'][ind1111], instrument=instrument, order=order, gridfile=T1, wave=True)
479
+
480
+ if modelset.lower() == 'sonora-2023':
481
+ return waves2, smart.utils.interpolations.quintilinear_interpolation(np.log10(teff), logg, metal, np.log10(kzz), co, Points)
482
+ else:
483
+ return waves2, smart.utils.interpolations.quadlinear_interpolation(np.log10(teff), logg, metal, alpha, Points)
484
+
485
+ ################################################################################################################################################################################################