Skip to content

Commit

Permalink
Fixing flake8 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorbell57 committed Jun 18, 2024
1 parent fe6d3e1 commit 00c987e
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions src/eureka/S6_planet_spectra/s6_spectra.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,20 +189,26 @@ def plot_spectra(eventlabel, ecf_path=None, s5_meta=None, input_meta=None):
meta.y_label, meta.y_label_unit) = vals
log.writelog(f'Plotting {meta.y_param}...')

meta.y_param_basic = meta.y_param.split('_pl')[0].split('_ch')[0].split('^')[0]
meta.y_param_basic = meta.y_param.split('_pl')[0]
meta.y_param_basic = meta.y_param_basic.split('_ch')[0]
meta.y_param_basic = meta.y_param_basic.split('^')[0]
if meta.y_param[-2:] == '^2':
meta.y_param_basic += '^2'

# Figure out which channel we're working with
channelNumber = meta.y_param.split('_ch')[-1].split('_pl')[0].split('^')[0]
channelNumber = meta.y_param.split('_ch')[-1]
channelNumber = channelNumber.split('_pl')[0]
channelNumber = channelNumber.split('^')[0]
if channelNumber.isnumeric():
channelNumber = int(channelNumber)

Check warning on line 203 in src/eureka/S6_planet_spectra/s6_spectra.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S6_planet_spectra/s6_spectra.py#L203

Added line #L203 was not covered by tests
else:
channelNumber = 0
meta.channelNumber = channelNumber

# Figure out which planet we're working with
planetNumber = meta.y_param.split('_pl')[-1].split('_ch')[0].split('^')[0]
planetNumber = meta.y_param.split('_pl')[-1]
planetNumber = planetNumber.split('_ch')[0]
planetNumber = planetNumber.split('^')[0]
if planetNumber.isnumeric():
planetNumber = int(planetNumber)

Check warning on line 213 in src/eureka/S6_planet_spectra/s6_spectra.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S6_planet_spectra/s6_spectra.py#L213

Added line #L213 was not covered by tests
else:
Expand Down Expand Up @@ -258,7 +264,8 @@ def plot_spectra(eventlabel, ecf_path=None, s5_meta=None, input_meta=None):
elif meta.y_param_basic == 'fn':
# Nightside emission
suffix = getPlanetSuffix(meta)+getChannelSuffix(meta)
meta.y_label = '$F_{\\rm p,night'+suffix+'}/F_{\\rm *}$'
meta.y_label = ('$F_{\\rm p,night'+suffix +

Check warning on line 267 in src/eureka/S6_planet_spectra/s6_spectra.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S6_planet_spectra/s6_spectra.py#L266-L267

Added lines #L266 - L267 were not covered by tests
'}/F_{\\rm *}$')
elif meta.y_param_basic == 't0':
# Time of transit
suffix = getPlanetSuffix(meta)+getChannelSuffix(meta)
Expand Down Expand Up @@ -298,7 +305,8 @@ def plot_spectra(eventlabel, ecf_path=None, s5_meta=None, input_meta=None):
elif meta.y_param_basic == 'pc_amp2':
# Phase Curve Amplitude, second order
suffix = getPlanetSuffix(meta)+getChannelSuffix(meta)
meta.y_label = 'Second Order Phase Curve Amplitude'+suffix
meta.y_label = ('Second Order Phase Curve Amplitude' +

Check warning on line 308 in src/eureka/S6_planet_spectra/s6_spectra.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S6_planet_spectra/s6_spectra.py#L307-L308

Added lines #L307 - L308 were not covered by tests
suffix)
elif meta.y_param_basic in [f'u{i}' for i in range(1, 5)]:
# Limb darkening parameter
suffix = getChannelSuffix(meta)
Expand All @@ -317,15 +325,18 @@ def plot_spectra(eventlabel, ecf_path=None, s5_meta=None, input_meta=None):
elif meta.y_param_basic in [f'c{i}' for i in range(0, 10)]:
# Polynomial in time coefficient
suffix = getChannelSuffix(meta)
meta.y_label = '$c_{\\rm '+meta.y_param_basic[1:]+'}$'+suffix
meta.y_label = ('$c_{\\rm '+meta.y_param_basic[1:] +

Check warning on line 328 in src/eureka/S6_planet_spectra/s6_spectra.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S6_planet_spectra/s6_spectra.py#L327-L328

Added lines #L327 - L328 were not covered by tests
'}$'+suffix)
elif meta.y_param_basic in [f'r{i}' for i in range(6)]:
# Exponential ramp parameters
suffix = getChannelSuffix(meta)
meta.y_label = '$r_{\\rm '+meta.y_param_basic[1:]+'}$'+suffix
meta.y_label = ('$r_{\\rm '+meta.y_param_basic[1:] +
'}$'+suffix)
elif meta.y_param_basic in ['1/r1', '1/r4']:
# Exponential ramp timescales
suffix = getChannelSuffix(meta)
meta.y_label = '$1/r_{\\rm '+meta.y_param_basic[-1]+'}$'+suffix
meta.y_label = ('$1/r_{\\rm '+meta.y_param_basic[-1] +

Check warning on line 338 in src/eureka/S6_planet_spectra/s6_spectra.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S6_planet_spectra/s6_spectra.py#L337-L338

Added lines #L337 - L338 were not covered by tests
'}$'+suffix)
else:
meta.y_label = meta.y_param

Expand Down Expand Up @@ -1124,8 +1135,10 @@ def __init__(self):
for ell in range(1, meta.ydeg+1):
for m in range(-ell, ell+1):
if hasattr(temp, f'Y{ell}{m}{suffix}'):
planet_map[ell, m, :] = getattr(temp, f'Y{ell}{m}{suffix}')[i]
planet_map2[ell, m, :] = getattr(temp, f'Y{ell}{m}{suffix}')[i]
planet_map[ell, m, :] = getattr(temp,

Check warning on line 1138 in src/eureka/S6_planet_spectra/s6_spectra.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S6_planet_spectra/s6_spectra.py#L1137-L1138

Added lines #L1137 - L1138 were not covered by tests
f'Y{ell}{m}{suffix}')[i]
planet_map2[ell, m, :] = getattr(temp,

Check warning on line 1140 in src/eureka/S6_planet_spectra/s6_spectra.py

View check run for this annotation

Codecov / codecov/patch

src/eureka/S6_planet_spectra/s6_spectra.py#L1140

Added line #L1140 was not covered by tests
f'Y{ell}{m}{suffix}')[i]
planet_map.amp = fp[i][inds]/planet_map2.flux(theta=0)[0]

fluxes = planet_map.flux(theta=180)[0].eval()
Expand Down

0 comments on commit 00c987e

Please sign in to comment.