Skip to content

Commit

Permalink
run format_source
Browse files Browse the repository at this point in the history
  • Loading branch information
Giuseppe Puglisi committed May 7, 2020
1 parent 1ca7e62 commit af5f1a4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 26 deletions.
4 changes: 2 additions & 2 deletions src/toast/_libtoast_pixels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ void init_pixels(py::module & m) {
(tuple): The (local submap, pixel within submap) for each global pixel.
)");
m.def("global_to_local", &global_to_local <int32_t> );
m.def("global_to_local", &global_to_local <int16_t> );
m.def("global_to_local", &global_to_local <int32_t>);
m.def("global_to_local", &global_to_local <int16_t>);
}
2 changes: 2 additions & 0 deletions src/toast/pipeline_tools/sky_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ def apply_conviqt(args, comm, data, cache_prefix="signal", verbose=True):

return cache_prefix


@function_timer
def apply_weighted_conviqt(args, comm, data, cache_prefix="signal", verbose=True):
if (
Expand Down Expand Up @@ -343,6 +344,7 @@ def apply_weighted_conviqt(args, comm, data, cache_prefix="signal", verbose=True

return cache_prefix


@function_timer
def scan_sky_signal(
args, comm, data, cache_prefix="signal", verbose=True, pixels="pixels", mc=0
Expand Down
50 changes: 26 additions & 24 deletions src/toast/todmap/conviqt.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,6 @@ def cache(self, data, det, convolved_data, verbose):
return



class OpSimWeightedConviqt(Operator):
"""Operator which uses libconviqt to generate beam-convolved timestreams.
This operator should be used in presence of a spinning HWP which makes the beam time-dependent,
Expand Down Expand Up @@ -508,14 +507,13 @@ def exec(self, data):
beam_file = self._beam_file[det]
except TypeError:
beam_file = self._beam_file.replace("DETECTOR", det)
beam_file_i00= beam_file.replace('.fits', '_I000.fits')
beam_file_0i0= beam_file.replace('.fits', '_0I00.fits')
beam_file_00i= beam_file.replace('.fits', '_00I0.fits')

beam_file_i00 = beam_file.replace(".fits", "_I000.fits")
beam_file_0i0 = beam_file.replace(".fits", "_0I00.fits")
beam_file_00i = beam_file.replace(".fits", "_00I0.fits")

beamI00 =self.get_beam(beam_file_i00, det,verbose )
beam0I0 =self.get_beam(beam_file_0i0, det,verbose )
beam00I =self.get_beam(beam_file_00i, det,verbose )
beamI00 = self.get_beam(beam_file_i00, det, verbose)
beam0I0 = self.get_beam(beam_file_0i0, det, verbose)
beam00I = self.get_beam(beam_file_00i, det, verbose)
detector = self.get_detector(det)

theta, phi, psi = self.get_pointing(data, det, verbose)
Expand All @@ -524,21 +522,27 @@ def exec(self, data):
for obs in data.obs:
tod = obs["tod"]
focalplane = obs["focalplane"]
psipol = self._get_psipol( focalplane, det )
#import pdb
#pdb.set_trace()
weight , hwpang = self._get_hwpangle(tod )
psitot = weight *( psipol + hwpang )

convolved_data = self.convolve(sky, beamI00, detector, pnt, det, verbose)
psipol = self._get_psipol(focalplane, det)
# import pdb
# pdb.set_trace()
weight, hwpang = self._get_hwpangle(tod)
psitot = weight * (psipol + hwpang)

convolved_data = self.convolve(
sky, beamI00, detector, pnt, det, verbose
)
theta, phi, psi = self.get_pointing(data, det, verbose)
pnt = self.get_buffer(theta, phi, psi, det, verbose)
del theta, phi, psi
convolved_data += np.cos(psitot ) * self.convolve(sky, beam0I0, detector, pnt, det, verbose)
convolved_data += np.cos(psitot) * self.convolve(
sky, beam0I0, detector, pnt, det, verbose
)
theta, phi, psi = self.get_pointing(data, det, verbose)
pnt = self.get_buffer(theta, phi, psi, det, verbose)
del theta, phi, psi
convolved_data += np.sin(psitot ) * self.convolve(sky, beam00I, detector, pnt, det, verbose)
convolved_data += np.sin(psitot) * self.convolve(
sky, beam00I, detector, pnt, det, verbose
)

self.calibrate(data, det, beamI00, convolved_data, verbose)

Expand All @@ -551,7 +555,6 @@ def exec(self, data):

return


def _get_detectors(self, data):
""" Assemble a list of detectors across all processes and
observations in `self._comm`.
Expand All @@ -569,8 +572,7 @@ def _get_detectors(self, data):
all_dets = self._comm.bcast(dets, root=0)
return all_dets


def _get_hwpangle (self,tod ):
def _get_hwpangle(self, tod):
"""
Return the spinning HWP angle and the multiplicative
factor to be applied when added to the signal polarization angle.
Expand All @@ -579,13 +581,13 @@ def _get_hwpangle (self,tod ):
_, nsamp = tod.local_samples
try:
hwpang = tod.local_hwp_angle()
factor = 4
factor = 4
except:
pass
if hwpang is None or np.all(hwpang==0 ):
if hwpang is None or np.all(hwpang == 0):
hwpang = np.zeros(nsamp, dtype=np.float64)
factor = 2
return factor,hwpang
factor = 2
return factor, hwpang

def _get_psipol(self, focalplane, det):
""" Parse polarization angle in radians from the focalplane
Expand Down

0 comments on commit af5f1a4

Please sign in to comment.