-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sourcery refactored master branch #24
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,7 +61,7 @@ def ccf_astro(spectrum1, spectrum2, rvmin=0, rvmax=200, drv=1): | |
s = False | ||
w, f = spectrum1 | ||
tw, tf = spectrum2 | ||
if not len(w) or not len(tw): | ||
if not (len(w) and len(tw)): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function ccf_astro refactored with the following changes:
|
||
return 0, 0, 0, 0, 0 | ||
c = 299792.458 | ||
drvs = np.arange(rvmin, rvmax, drv) | ||
|
@@ -441,7 +441,7 @@ def main(fname, fname2, lines=False, model=False, telluric=False, sun=False, | |
else: | ||
print('Warning: Solar spectrum not available in wavelength range.') | ||
sun = False | ||
elif sun and model: | ||
elif sun: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function main refactored with the following changes:
|
||
print('Warning: Both solar spectrum and a model spectrum are selected. Using model spectrum.') | ||
sun = False | ||
|
||
|
@@ -495,7 +495,7 @@ def main(fname, fname2, lines=False, model=False, telluric=False, sun=False, | |
if ccf != 'none': | ||
if ccf in ['sun', 'both'] and sun: | ||
# remove tellurics from the Solar spectrum | ||
if telluric and sun: | ||
if telluric: | ||
print('Correcting solar spectrum for tellurics...') | ||
i_sun = i_sun / i_tel | ||
print('Calculating CCF for the Sun...') | ||
|
@@ -628,9 +628,9 @@ def main(fname, fname2, lines=False, model=False, telluric=False, sun=False, | |
elif rv1 and rv2: | ||
ax1.set_title( | ||
'{0!s}\nSun/model: {1!s} km/s, telluric: {2!s} km/s'.format(fname, rv1, rv2)) | ||
elif rv1 and not rv2: | ||
elif rv1: | ||
ax1.set_title('{0!s}\nSun/model: {1!s} km/s'.format(fname, rv1)) | ||
elif not rv1 and rv2: | ||
elif rv2: | ||
ax1.set_title('{0!s}\nTelluric: {1!s} km/s'.format(fname, rv2)) | ||
elif ccf == 'model': | ||
ax1.set_title('{0!s}\nModel(CCF): {1!s} km/s'.format(fname, rv1)) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,9 +35,7 @@ def unitary_Gauss(x, center, fwhm): | |
sigma = np.abs(fwhm) / (2 * np.sqrt(2 * np.log(2))) | ||
Amp = 1.0 / (sigma * np.sqrt(2 * np.pi)) | ||
tau = -((x - center)**2) / (2 * (sigma**2)) | ||
result = Amp * np.exp(tau) | ||
|
||
return result | ||
return Amp * np.exp(tau) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function unitary_Gauss refactored with the following changes:
|
||
|
||
|
||
def fast_convolve(wav_val, R, wav_extended, flux_extended, fwhm_lim): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,9 +42,7 @@ def unitary_Gauss(x, center, fwhm): | |
sigma = np.abs(fwhm) / (2 * np.sqrt(2 * np.log(2))) | ||
Amp = 1.0 / (sigma * np.sqrt(2 * np.pi)) | ||
tau = -((x - center) ** 2) / (2 * (sigma ** 2)) | ||
result = Amp * np.exp(tau) | ||
|
||
return result | ||
return Amp * np.exp(tau) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function unitary_Gauss refactored with the following changes:
|
||
|
||
|
||
def fast_convolve(wav_val, R, wav_extended, flux_extended, fwhm_lim): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,9 +51,7 @@ def unitary_Gauss(x, center, fwhm): | |
sigma = np.abs(fwhm) / (2 * np.sqrt(2 * np.log(2))) | ||
Amp = 1.0 / (sigma * np.sqrt(2 * np.pi)) | ||
tau = -((x - center) ** 2) / (2 * (sigma ** 2)) | ||
result = Amp * np.exp(tau) | ||
|
||
return result | ||
return Amp * np.exp(tau) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function unitary_Gauss refactored with the following changes:
|
||
|
||
|
||
def fast_convolve(wav_val, R, wav_extended, flux_extended, fwhm_lim): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,15 +21,13 @@ def doppler_factor_shift(wave, velocity): | |
beta = velocity / constants.c | ||
doppler_factor = ((1 + beta) / (1 - beta)) ** 0.5 | ||
|
||
y = wave * doppler_factor | ||
return y | ||
return wave * doppler_factor | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function doppler_factor_shift refactored with the following changes:
|
||
|
||
|
||
def doppler_shift(wave, velocity): | ||
"""Doppler shift using non-realtivistically.""" | ||
beta = velocity / constants.c | ||
y = wave * (1 + beta) | ||
return y | ||
return wave * (1 + beta) | ||
Comment on lines
-31
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function doppler_shift refactored with the following changes:
|
||
|
||
|
||
shift_factor = doppler_factor_shift(wavelength, rv) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,7 @@ | |
def convert_labels_to_rv(x, labels): | ||
x_mid = np.mean(x) | ||
c = 299792.458 # km/s | ||
transform = ["{0:2.1f}".format((label / x_mid) * c) for label in labels] | ||
return transform | ||
return ["{0:2.1f}".format((label / x_mid) * c) for label in labels] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function convert_labels_to_rv refactored with the following changes:
|
||
|
||
|
||
x = np.arange(10) + 2110 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,8 +14,7 @@ | |
|
||
def Calculate_RV(Lambda, deltalambda): | ||
c = 299792458. # m/s | ||
V = [c * deltalambda / lmda for lmda in Lambda] | ||
return V | ||
return [c * deltalambda / lmda for lmda in Lambda] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function Calculate_RV refactored with the following changes:
|
||
|
||
|
||
def Calculate_WLshift(wav, v): | ||
|
@@ -27,22 +26,19 @@ def Calculate_WLshift(wav, v): | |
if isinstance(v, (int, float)): | ||
return (v / c) * wav | ||
else: | ||
deltalambda = [(v / c) * lmda for lmda in wav] | ||
return deltalambda | ||
return [(v / c) * lmda for lmda in wav] | ||
Comment on lines
-30
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function Calculate_WLshift refactored with the following changes:
|
||
|
||
|
||
def Calc_RV(Lambda, deltalambda): | ||
# Fixed wavelength | ||
c = 299792458. # m/s | ||
V = [c * (delta / Lambda) for delta in deltalambda] | ||
return V | ||
return [c * (delta / Lambda) for delta in deltalambda] | ||
Comment on lines
-37
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function Calc_RV refactored with the following changes:
|
||
|
||
|
||
def Calc_WLshift(Lambda, vels): | ||
# Fixed wavelength | ||
c = 299792458. # m/s | ||
V = [(vel / c) * Lambda for vel in vels] | ||
return V | ||
return [(vel / c) * Lambda for vel in vels] | ||
Comment on lines
-44
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function Calc_WLshift refactored with the following changes:
|
||
# NIR range we have | ||
# 2110 nm to 2170 nm | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,15 +120,15 @@ def wl_interpolation(wl, spec, ref_wl, method="scipy", kind="linear", verbose=Fa | |
v_print = print if verbose else lambda *a, **k: None | ||
|
||
starttime = time.time() | ||
if method == "scipy": | ||
v_print(kind + " scipy interpolation") | ||
linear_interp = interp1d(wl, spec, kind=kind) | ||
new_spec = linear_interp(ref_wl) | ||
elif method == "numpy": | ||
if method == "numpy": | ||
if kind.lower() is not "linear": | ||
v_print("Warning: Cannot do " + kind + " interpolation with numpy, switching to linear") | ||
v_print("Linear numpy interpolation") | ||
new_spec = np.interp(ref_wl, wl, spec) # 1-d peicewise linear interpolat | ||
elif method == "scipy": | ||
v_print(kind + " scipy interpolation") | ||
linear_interp = interp1d(wl, spec, kind=kind) | ||
new_spec = linear_interp(ref_wl) | ||
Comment on lines
-123
to
+131
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function wl_interpolation refactored with the following changes:
|
||
else: | ||
v_print("Method was given as " + method) | ||
raise("Interpolation method not correct") | ||
|
@@ -150,9 +150,7 @@ def unitary_Gauss(x, center, FWHM): | |
sigma = np.abs(FWHM) / (2 * np.sqrt(2 * np.log(2))) | ||
amp = 1.0 / (sigma * np.sqrt(2 * np.pi)) | ||
tau = -((x - center)**2) / (2 * (sigma**2)) | ||
result = amp * np.exp(tau) | ||
|
||
return result | ||
return amp * np.exp(tau) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function unitary_Gauss refactored with the following changes:
|
||
|
||
|
||
def fast_convolve(wav_val, R, wav_extended, flux_extended, fwhm_lim): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,8 +26,7 @@ def _parser(): | |
parser.add_argument("-k", "--keep_original", help="Keep the original file", action="store_true") | ||
parser.add_argument("-s", "--species", help="Specify constituents if known e.g. h20, noh20", type=str) | ||
|
||
args = parser.parse_args() | ||
return args | ||
return parser.parse_args() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function _parser refactored with the following changes:
|
||
|
||
|
||
def main(fname, extract=False, prefix="", keep_original=False, species=False): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,8 +48,7 @@ def _parser(): | |
parser.add_argument("-n", "--request_number", help="Tapas request number. Iterate on previous request number.", | ||
type=int) | ||
parser.add_argument("-v", "--verbose", action="store_true", help="Turn on verbosity.") | ||
args = parser.parse_args() | ||
return args | ||
return parser.parse_args() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function _parser refactored with the following changes:
|
||
|
||
|
||
def main(fname=("/home/jneal/Phd/data/Crires/BDs-DRACS/HD30501-1/Combined_Nods/" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ | |
|
||
def combine_errors(chips=range(1, 5), save_path=None): | ||
"""Assumes the current directory contains the files for the nod cycle.""" | ||
# Update header | ||
from datetime import datetime | ||
Comment on lines
+11
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function combine_errors refactored with the following changes:
|
||
for chip in chips: | ||
# print("Chip", chip) | ||
ms_files = sorted(glob("C*_{0}.*ms.fits.*".format(chip))) | ||
|
@@ -19,8 +21,8 @@ def combine_errors(chips=range(1, 5), save_path=None): | |
assert len(norm_sum_file) == 1 | ||
norm_sum_file = norm_sum_file[0] | ||
# Check ms_file and norm_file match the start of norm_sum_file | ||
assert any([os.path.basename(norm_sum_file)[0:29] in name for name in ms_files]) | ||
assert any([os.path.basename(norm_sum_file)[0:29] in name for name in norm_files]) | ||
assert any(os.path.basename(norm_sum_file)[0:29] in name for name in ms_files) | ||
assert any(os.path.basename(norm_sum_file)[0:29] in name for name in norm_files) | ||
|
||
# Combine Spectrum errors quadratically | ||
square_error = np.zeros(1024) | ||
|
@@ -48,8 +50,6 @@ def combine_errors(chips=range(1, 5), save_path=None): | |
|
||
assert error_spectrum.shape == sum_spectrum.shape | ||
|
||
# Update header | ||
from datetime import datetime | ||
header["history"] = "Errors combined on {}".format(datetime.now()) | ||
header["comment"] = "Errors normalized, added in quadrature, then divide by number of nods" | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,8 +42,7 @@ def _parser(): | |
choices=["1", "2", "3"], | ||
default=None, | ||
) | ||
args = parser.parse_args() | ||
return args | ||
return parser.parse_args() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function _parser refactored with the following changes:
|
||
|
||
|
||
def main(chip=None, band=None, showplots=False): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,16 +30,11 @@ def _parser(): | |
choices=["1", "2", "3", "4"], | ||
default=None, | ||
) | ||
args = parser.parse_args() | ||
return args | ||
return parser.parse_args() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function _parser refactored with the following changes:
|
||
|
||
|
||
def main(chip=None, showplots=False): | ||
if chip is None: | ||
chips = range(1, 5) | ||
else: | ||
chips = [int(chip)] | ||
|
||
chips = range(1, 5) if chip is None else [int(chip)] | ||
Comment on lines
-38
to
+37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function main refactored with the following changes:
|
||
dir_path = os.getcwd() | ||
|
||
intermediate_path = os.path.join(dir_path, "Intermediate_steps", "") | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,8 +19,7 @@ def _parser(): | |
parser.add_argument('filenames', nargs='+', type=str, help='List of Filenames') | ||
parser.add_argument("-x", "--cut", type=str, default=":", help="Character to Remove (cut)") | ||
parser.add_argument("-v", "--paste", type=str, default="", help="Character to replace with (paste)") | ||
args = parser.parse_args() | ||
return args | ||
return parser.parse_args() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function _parser refactored with the following changes:
|
||
|
||
|
||
def char_replace(fname, remove_char, replace_char=""): | ||
|
@@ -48,8 +47,7 @@ def char_replace(fname, remove_char, replace_char=""): | |
|
||
""" | ||
name_parts = fname.split(remove_char) | ||
new_name = replace_char.join(name_parts) | ||
return new_name | ||
return replace_char.join(name_parts) | ||
Comment on lines
-51
to
+50
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function char_replace refactored with the following changes:
|
||
|
||
|
||
def main(filenames, cut=":", paste=""): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,28 +31,38 @@ def chi_squared(observed, expected, error=None): | |
|
||
|
||
def parallel_chisqr_1D(iter_1, obs, model, model_params, n_jobs=4): | ||
grid = Parallel(n_jobs=n_jobs)(delayed(chi_squared)(obs, model(a, *model_params)) for a in iter_1) | ||
return grid | ||
return Parallel(n_jobs=n_jobs)( | ||
delayed(chi_squared)(obs, model(a, *model_params)) for a in iter_1 | ||
) | ||
Comment on lines
-34
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function parallel_chisqr_1D refactored with the following changes:
|
||
|
||
|
||
# @memory.cache | ||
def parallel_chisqr_2D(iter_1, iter_2, obs, model, model_params, n_jobs=4): | ||
grid = Parallel(n_jobs=n_jobs)(delayed(chi_squared)(obs, model(a, b, *model_params)) | ||
for a in iter_1 for b in iter_2) | ||
return grid | ||
return Parallel(n_jobs=n_jobs)( | ||
delayed(chi_squared)(obs, model(a, b, *model_params)) | ||
for a in iter_1 | ||
for b in iter_2 | ||
) | ||
Comment on lines
-40
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function parallel_chisqr_2D refactored with the following changes:
|
||
|
||
|
||
# @memory.cache | ||
def parallel_chisqr_3D(iter_1, iter_2, iter_3, obs, model, model_params, n_jobs=4): | ||
grid = Parallel(n_jobs=n_jobs)(delayed(chi_squared)(obs, model(a, b, c, *model_params)) | ||
for a in iter_1 for b in iter_2 for c in iter_3) | ||
return grid | ||
return Parallel(n_jobs=n_jobs)( | ||
delayed(chi_squared)(obs, model(a, b, c, *model_params)) | ||
for a in iter_1 | ||
for b in iter_2 | ||
for c in iter_3 | ||
) | ||
Comment on lines
-47
to
+55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function parallel_chisqr_3D refactored with the following changes:
|
||
|
||
|
||
def parallel_chisqr_4D(iter_1, iter_2, iter_3, iter_4, obs, model, model_params, n_jobs=4): | ||
grid = Parallel(n_jobs=n_jobs)(delayed(chi_squared)(obs, model(a, b, c, d, *model_params)) | ||
for a in iter_1 for b in iter_2 for c in iter_3 for d in iter_4) | ||
return grid | ||
return Parallel(n_jobs=n_jobs)( | ||
delayed(chi_squared)(obs, model(a, b, c, d, *model_params)) | ||
for a in iter_1 | ||
for b in iter_2 | ||
for c in iter_3 | ||
for d in iter_4 | ||
) | ||
Comment on lines
-53
to
+65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function parallel_chisqr_4D refactored with the following changes:
|
||
|
||
|
||
# @memory.cache | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,8 +28,7 @@ def _parser(): | |
help="Calculate normalization fucntion errors on the flux.") | ||
parser.add_argument("-p", "--plot", default=False, action="store_true", | ||
help="Plot normalized result.") | ||
args = parser.parse_args() | ||
return args | ||
return parser.parse_args() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function _parser refactored with the following changes:
|
||
|
||
|
||
def main(): | ||
|
@@ -69,10 +68,7 @@ def main(): | |
|
||
|
||
fitssave = args.fitsname.replace(".fits", ".{!s}.fits".format(args.suffix)) | ||
if len(data) == 2: | ||
fits.writeto(fitssave, norm_flux, header=hdr) | ||
else: | ||
fits.writeto(fitssave, norm_flux, header=hdr) | ||
fits.writeto(fitssave, norm_flux, header=hdr) | ||
Comment on lines
-72
to
+71
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function main refactored with the following changes:
|
||
|
||
|
||
def flux_error(wave, flux, c): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,8 +96,7 @@ def _parser(): | |
parser.add_argument("filename", type=str, | ||
help="Specturm to continuum normalize.") | ||
|
||
args = parser.parse_args() | ||
return args | ||
return parser.parse_args() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function _parser refactored with the following changes:
|
||
|
||
|
||
if __name__ == "__main__": | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,8 +29,7 @@ def _parser(): | |
parser.add_argument("-o", "--output", help="Specify output filename", default=False) | ||
parser.add_argument("-s", "--separator", help="Separator for time section of fits", default=":") | ||
|
||
args = parser.parse_args() | ||
return args | ||
return parser.parse_args() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function _parser refactored with the following changes:
|
||
|
||
|
||
def main(fname, output=False, separator=":", verbose=True): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,17 +42,8 @@ def find_closest_phoenix(data_dir, teff, logg, feh, alpha=None): | |
closest_logg = loggs[np.abs(loggs - logg).argmin()] | ||
closest_feh = fehs[np.abs(fehs - feh).argmin()] | ||
|
||
if alpha is not None: | ||
if abs(alpha) > 0.2: | ||
print("Warning! Alpha is outside acceptable range -0.2->0.2") | ||
closest_alpha = alphas[np.abs(alphas - alpha).argmin()] | ||
phoenix_glob = ("/Z{2:+4.1f}.Alpha={3:+5.2f}/*{0:05d}{1:4.2f}" | ||
"{2:+4.1f}.Alpha={3:+5.2f}.PHOENIX*.fits" | ||
"").format(closest_teff, closest_logg, closest_feh, | ||
closest_alpha) | ||
else: | ||
phoenix_glob = ("/Z{2:+4.1f}/*{0:05d}{1:4.2f}{2:+4.1f}.PHOENIX*.fits" | ||
"").format(closest_teff, closest_logg, closest_feh) | ||
phoenix_glob = ("/Z{2:+4.1f}/*{0:05d}{1:4.2f}{2:+4.1f}.PHOENIX*.fits" | ||
"").format(closest_teff, closest_logg, closest_feh) | ||
Comment on lines
-45
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function find_closest_phoenix refactored with the following changes:
|
||
files = glob.glob(data_dir + phoenix_glob) | ||
if len(files) > 1: | ||
print("More than one file returned") | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,7 @@ def s_profile(wave, wav_0, depth, width, k): | |
|
||
s_amp = 2 * depth * np.exp(-np.pi * depth**2 * ((wave - wav_0)**2 + (k/2)**2) / width**2) | ||
s_inner = (np.pi * depth**2 * (wave - wav_0) * k) / width**2 | ||
s_lambda = s_amp * np.sinh(s_inner) | ||
return s_lambda | ||
return s_amp * np.sinh(s_inner) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function s_profile refactored with the following changes:
|
||
|
||
|
||
# I1, W1 and wav_1 are peak parameters. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function SumNods refactored with the following changes: