-
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
Conversation
if Pos == "All": | ||
NodNum = len(Spectra) | ||
else: | ||
NodNum = len(Spectra) / 2.0 | ||
NodNum = len(Spectra) if Pos == "All" else len(Spectra) / 2.0 |
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:
- Replace if statement with if expression
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Function ccf_astro refactored with the following changes:
- Simplify logical expression
elif sun and model: | ||
elif sun: |
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 main refactored with the following changes:
- Remove redundant conditional
y = wave * doppler_factor | ||
return y | ||
return wave * doppler_factor |
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 doppler_factor_shift refactored with the following changes:
- Inline variable that is only used once
y = wave * (1 + beta) | ||
return y | ||
return wave * (1 + beta) |
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 doppler_shift refactored with the following changes:
- Inline variable that is only used once
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 | ||
) |
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 parallel_chisqr_2D refactored with the following changes:
- Inline variable that is only used once
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 | ||
) |
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 parallel_chisqr_3D refactored with the following changes:
- Inline variable that is only used once
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 | ||
) |
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 parallel_chisqr_4D refactored with the following changes:
- Inline variable that is only used once
args = parser.parse_args() | ||
return args | ||
return parser.parse_args() |
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 _parser refactored with the following changes:
- Inline variable that is only used once
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) |
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 find_closest_phoenix refactored with the following changes:
- Remove redundant conditional
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Function s_profile refactored with the following changes:
- Inline variable that is only used once
args = parser.parse_args() | ||
return args | ||
return parser.parse_args() |
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 _parser refactored with the following changes:
- Inline variable that is only used once
snr = np.mean(spectra) / np.std(spectra, ddof=0) | ||
return snr | ||
return np.mean(spectra) / np.std(spectra, ddof=0) |
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 snr refactored with the following changes:
- Inline variable that is only used once
args = parser.parse_args() | ||
return args | ||
return parser.parse_args() |
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 _parser refactored with the following changes:
- Inline variable that is only used once
snr = np.mean(spectra) / np.std(spectra, ddof=ddof) | ||
return snr | ||
return np.mean(spectra) / np.std(spectra, ddof=ddof) |
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 snr refactored with the following changes:
- Inline variable that is only used once
args = parser.parse_args() | ||
return args | ||
return parser.parse_args() |
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 _parser refactored with the following changes:
- Inline variable that is only used once
if chip is None: | ||
chips = range(1, 5) | ||
else: | ||
chips = [int(chip)] | ||
|
||
chips = range(1, 5) if chip is None else [int(chip)] |
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 main refactored with the following changes:
- Replace if statement with if expression
args = parser.parse_args() | ||
return args | ||
return parser.parse_args() |
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 _parser refactored with the following changes:
- Inline variable that is only used once
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) |
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 main refactored with the following changes:
- Hoist repeated code outside conditional statement
args = parser.parse_args() | ||
return args | ||
return parser.parse_args() |
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 _parser refactored with the following changes:
- Inline variable that is only used once
Branch
master
refactored by Sourcery.If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
Review changes via command line
To manually merge these changes, make sure you're on the
master
branch, then run: