Skip to content

Commit

Permalink
PEP8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
karllark committed Nov 9, 2017
1 parent 36e3f9a commit 5057c21
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 35 deletions.
54 changes: 27 additions & 27 deletions dust_extinction/dust_extinction.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,61 +729,61 @@ class P92(Fittable1DModel):
inputs = ('x',)
outputs = ('axav',)

# constant for conversion from Ax/Ab to (more standard) Ax/Av
# constant for conversion from Ax/Ab to (more standard) Ax/Av
AbAv = 1.0/3.08 + 1.0

BKG_amp = Parameter(description="BKG term: amplitude",
BKG_amp = Parameter(description="BKG term: amplitude",
default=165.*AbAv, min=0.0)
BKG_lambda = Parameter(description="BKG term: center wavelength",
BKG_lambda = Parameter(description="BKG term: center wavelength",
default=0.047)
BKG_b = Parameter(description="BKG term: b coefficient",
BKG_b = Parameter(description="BKG term: b coefficient",
default=90.)
BKG_n = Parameter(description="BKG term: n coefficient",
BKG_n = Parameter(description="BKG term: n coefficient",
default=2.0, fixed=True)

FUV_amp = Parameter(description="FUV term: amplitude",
FUV_amp = Parameter(description="FUV term: amplitude",
default=14.*AbAv, min=0.0)
FUV_lambda = Parameter(description="FUV term: center wavelength",
FUV_lambda = Parameter(description="FUV term: center wavelength",
default=0.08, bounds=(0.07,0.09))
FUV_b = Parameter(description="FUV term: b coefficient",
FUV_b = Parameter(description="FUV term: b coefficient",
default=4.0)
FUV_n = Parameter(description="FUV term: n coefficient",
FUV_n = Parameter(description="FUV term: n coefficient",
default=6.5)

NUV_amp = Parameter(description="NUV term: amplitude",
NUV_amp = Parameter(description="NUV term: amplitude",
default=0.045*AbAv, min=0.0)
NUV_lambda = Parameter(description="NUV term: center wavelength",
NUV_lambda = Parameter(description="NUV term: center wavelength",
default=0.22, bounds=(0.20,0.24))
NUV_b = Parameter(description="NUV term: b coefficient",
NUV_b = Parameter(description="NUV term: b coefficient",
default=-1.95)
NUV_n = Parameter(description="NUV term: n coefficient",
NUV_n = Parameter(description="NUV term: n coefficient",
default=2.0, fixed=True)

SIL1_amp = Parameter(description="SIL1 term: amplitude",
SIL1_amp = Parameter(description="SIL1 term: amplitude",
default=0.002*AbAv, min=0.0)
SIL1_lambda = Parameter(description="SIL1 term: center wavelength",
SIL1_lambda = Parameter(description="SIL1 term: center wavelength",
default=9.7, bounds=(7.0,13.0))
SIL1_b = Parameter(description="SIL1 term: b coefficient",
SIL1_b = Parameter(description="SIL1 term: b coefficient",
default=-1.95)
SIL1_n = Parameter(description="SIL1 term: n coefficient",
SIL1_n = Parameter(description="SIL1 term: n coefficient",
default=2.0, fixed=True)

SIL2_amp = Parameter(description="SIL2 term: amplitude",
SIL2_amp = Parameter(description="SIL2 term: amplitude",
default=0.002*AbAv, min=0.0)
SIL2_lambda = Parameter(description="SIL2 term: center wavelength",
SIL2_lambda = Parameter(description="SIL2 term: center wavelength",
default=18.0, bounds=(15.0,21.0))
SIL2_b = Parameter(description="SIL2 term: b coefficient",
SIL2_b = Parameter(description="SIL2 term: b coefficient",
default=-1.80)
SIL2_n = Parameter(description="SIL2 term: n coefficient",
SIL2_n = Parameter(description="SIL2 term: n coefficient",
default=2.0, fixed=True)

FIR_amp = Parameter(description="FIR term: amplitude",
FIR_amp = Parameter(description="FIR term: amplitude",
default=0.012*AbAv, min=0.0)
FIR_lambda = Parameter(description="FIR term: center wavelength",
FIR_lambda = Parameter(description="FIR term: center wavelength",
default=25.0, bounds=(20.0,30.0))
FIR_b = Parameter(description="FIR term: b coefficient",
FIR_b = Parameter(description="FIR term: b coefficient",
default=0.00)
FIR_n = Parameter(description="FIR term: n coefficient",
FIR_n = Parameter(description="FIR term: n coefficient",
default=2.0, fixed=True)

x_range = x_range_P92
Expand All @@ -794,7 +794,7 @@ def _p92_single_term(in_lambda, amplitude, cen_wave, b, n):
Function for calculating a single P92 term
.. math::
\frac{a}{(\lambda/cen_wave)^n + (cen_wave/\lambda)^n + b}
when n = 2, this term is equivalent to a Drude profile
Expand Down Expand Up @@ -978,7 +978,7 @@ def evaluate(self, in_x, Rv):
# Indications are that this is not correct from fm_unred.pro
# which is based on FMRCURVE.pro distributed by Fitzpatrick.
# --> confirmation needed
#
#
# Also, fm_unred.pro has different coeff and # of terms, possible
# update --> check with Fitzpatrick
opt_axebv_y = np.array([-0.426 + 1.0044*Rv,
Expand Down
16 changes: 8 additions & 8 deletions dust_extinction/tests/test_p92.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def get_axav_cor_vals():
MW_x = np.array(MW_x)
MW_exvebv = [-3.02, -2.91, -2.76, -2.58, -2.23, -1.60, -0.78, 0.00,
1.00, 1.30, 1.80, 3.10, 4.19, 4.90, 5.77, 6.57, 6.23,
5.52, 4.90, 4.65, 4.60, 4.73, 4.99, 5.36, 5.91,
5.52, 4.90, 4.65, 4.60, 4.73, 4.99, 5.36, 5.91,
6.55, 7.45, 8.45, 9.80, 11.30]
MW_exvebv = np.array(MW_exvebv)
Rv = 3.08
Expand Down Expand Up @@ -98,7 +98,7 @@ def test_P92_fitting():
x_quant, y = get_axav_cor_vals()

x = x_quant.value

# change from defaults to make the best fit harder to find
p92_init = P92()

Expand All @@ -107,12 +107,12 @@ def test_P92_fitting():
p92_fit = fit(p92_init, x, y, acc=1e-3)

fit_vals = p92_fit._parameters
good_vals = [222.820720554, 0.0468116978742, 87.5683270158, 2.0,
18.1622695074, 0.0770527204445, 2.83090815471, 6.40496987921,
0.0518566585953, 0.218641802256, -1.95087797308, 2.0,
0.00600017900912, 13.0, 109.369888618, 2.0,
0.09441454528, 15.0, -251.33735749, 2.0,

good_vals = [222.820720554, 0.0468116978742, 87.5683270158, 2.0,
18.1622695074, 0.0770527204445, 2.83090815471, 6.40496987921,
0.0518566585953, 0.218641802256, -1.95087797308, 2.0,
0.00600017900912, 13.0, 109.369888618, 2.0,
0.09441454528, 15.0, -251.33735749, 2.0,
0.189219789029, 20.0, -1130.90875587, 2.0]

np.testing.assert_allclose(good_vals, fit_vals)

0 comments on commit 5057c21

Please sign in to comment.