Skip to content

Commit

Permalink
Merge pull request #94 from galsci/run_202410_s4_phase1_chile
Browse files Browse the repository at this point in the history
run 202410 s4 phase1 chile
  • Loading branch information
zonca authored Oct 24, 2024
2 parents 42c541c + acc99fc commit 9959a4a
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 34 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,6 @@ distribute-*.tar.gz
.DS_Store

*.png
*.pdf
*.pdf

*.code-workspace
88 changes: 56 additions & 32 deletions mapsims/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,47 +470,71 @@ def execute(self, write_outputs=False):
if self.run_pysm:
for ch_index, each in enumerate(ch):
log.info("Bandpass integration for %s", str(each))
bandpass_integrated_map = self.pysm_sky.get_emission(
*each.bandpass
).value
beam_width_arcmin = each.beam
# smoothing and coordinate rotation with 1 spherical harmonics transform
log.info("Smoothing and coord-transform for %s", str(each))
other_args = {}
if each.custom_beam is not None:
other_args["beam_window"] = each.custom_beam
else:
other_args["fwhm"] = beam_width_arcmin
smoothed_maps = pysm.apply_smoothing_and_coord_transform(
bandpass_integrated_map,
lmax=self.lmax,
# if get_emission of pysm sky supports fwhm I pass fwhm and return smoothed alm
# so I can do coord rotation
# for catalog this means creating already smoothed car maps and turn them into alm
# for presmoothed interp means interpolate, apply the differential beam and return the alm
# actually better if I directly return the smoothed and coord-rotated map
common_kwargs = dict(
return_healpix=self.healpix,
return_car=self.car,
lmax=self.lmax,
output_nside=self.nside,
output_car_resol=self.car_resolution,
rot=(
None
if input_reference_frame == self.output_reference_frame
else hp.Rotator(
coord=(
)
if self.pysm_sky.includes_smoothing:
smoothed_maps = self.pysm_sky.get_emission(
*each.bandpass,
fwhm=each.beam,
coord=(
None
if input_reference_frame == self.output_reference_frame
else (
input_reference_frame,
self.output_reference_frame,
)
)
),
map_dist=(
None
if COMM_WORLD is None
else pysm.MapDistribution(
nside=self.nside,
smoothing_lmax=self.lmax,
mpi_comm=COMM_WORLD,
)
),
**other_args,
)
),
**common_kwargs,
)
else:
bandpass_integrated_map = self.pysm_sky.get_emission(
*each.bandpass
).value
beam_width_arcmin = each.beam
# smoothing and coordinate rotation with 1 spherical harmonics transform
log.info("Smoothing and coord-transform for %s", str(each))
other_args = {}
if each.custom_beam is not None:
other_args["beam_window"] = each.custom_beam
else:
other_args["fwhm"] = beam_width_arcmin
smoothed_maps = pysm.apply_smoothing_and_coord_transform(
bandpass_integrated_map,
rot=(
None
if input_reference_frame == self.output_reference_frame
else hp.Rotator(
coord=(
input_reference_frame,
self.output_reference_frame,
)
)
),
map_dist=(
None
if COMM_WORLD is None
else pysm.MapDistribution(
nside=self.nside,
smoothing_lmax=self.lmax,
mpi_comm=COMM_WORLD,
)
),
**common_kwargs,
**other_args,
)
if len(self.pixelizations) == 1:
smoothed_maps = [smoothed_maps]
smoothed_maps = [getattr(m, "value", m) for m in smoothed_maps]

# turn UNSEEN into NaN
if self.healpix:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies = [
"astropy",
"pixell==0.26.0",
"so_noise_models @ https://github.com/zonca/so_noise_models/archive/3.1.1.tar.gz",
"pysm3 @ git+https://github.com/zonca/pysm.git@debug_catalog#egg=pysm",
"pysm3 @ git+https://github.com/galsci/pysm.git@main#egg=pysm",
]

[project.scripts]
Expand Down

0 comments on commit 9959a4a

Please sign in to comment.