Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Implementation of other HD2017 models #51

Merged
merged 4 commits into from
Apr 14, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions pysm/data/presets.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,22 @@ nside_uval = 256
seed = 4632
f_car = 1.0
f_fe = 0.44
[d8]
class = "HensleyDraine2017"
map_I = "pysm_2/dust_t_new.fits"
map_Q = "pysm_2/dust_q_new.fits"
map_U = "pysm_2/dust_u_new.fits"
unit_I = "uK_RJ"
unit_Q = "uK_RJ"
unit_U = "uK_RJ"
freq_ref_I = "545 GHz"
freq_ref_P = "353 GHz"
rnd_uval = false
uval = 0.2
nside_uval = 256
seed = 4632
f_car = 1.0
f_fe = 0.44
[s0]
class = "PowerLaw"
map_I = "pysm_2/synch_t_new.fits"
Expand Down
16 changes: 9 additions & 7 deletions pysm/models/hd2017.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def __init__(
f_fe=None,
f_car=None,
rnd_uval=True,
uval=None,
nside_uval=256,
seed=None,
):
Expand Down Expand Up @@ -71,6 +72,8 @@ def __init__(
Fractional composition of grain population in carbonaceous grains.
rnd_uval: bool (optional, default=True)
Decide whether to draw a random realization of the ISRF.
uval: float
If no random realization is requested, can choose a fixed value of uval
nside_uval: int (optional, default=256)
HEALPix nside at which to evaluate the ISRF before ud_grade is applied
to get the output scaling law. The default is the resolution at which
Expand Down Expand Up @@ -193,6 +196,7 @@ def __init__(

# now draw the random realisation of uval if draw_uval = true
if rnd_uval:
assert uval is None, "Cannot request a random uval and also specify a value"
T_mean = self.read_map(
"pysm_2/COM_CompMap_dust-commander_0256_R2.00.fits",
unit="K",
Expand Down Expand Up @@ -235,16 +239,14 @@ def __init__(
),
nside_out=nside,
)
elif not rnd_uval:
else:
# I think this needs filling in for case when ISRF is not
# a random realization. What should the default be? Could
# choose a single value corresponding to T=20K, beta_d=1.54?
pass
zonca marked this conversation as resolved.
Show resolved Hide resolved
else:
print(
"""Hensley_Draine_2017 model selected, but draw_uval not set.
Set 'draw_uval' to True or False."""
)
assert (
uval is not None
), "Need to specify a uval value if not requesting a random realization"
self.uval = uval

# compute the SED at the reference frequencies of the input templates.
lambda_ref_i = self.freq_ref_I.to(u.um, equivalencies=u.spectral())
Expand Down
2 changes: 1 addition & 1 deletion pysm/tests/test_hd17.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


@pytest.mark.parametrize("freq", [100, 353, 900])
@pytest.mark.parametrize("model_tag", ["d7", "d5"])
@pytest.mark.parametrize("model_tag", ["d7", "d5", "d8"])
def test_highfreq_dust_model(model_tag, freq):

model = pysm.Sky(preset_strings=[model_tag], nside=64)
Expand Down