Assertion Error in tod.py
joydidier opened this issue · 5 comments
I was trying to get the so_MC_app.py running and noticed I got an error that I didn't get with simple_app.py.
I traced it down to this difference in code between the two example apps:
== in simple_app.py ==
d = []
for det in tqdm(range(inst.focal_plane.nbolometer)):
d.append(tod.map2tod(det))
## Project TOD to maps
tod.tod2map(np.array(d), sky_out_tot)
== in so_MC_app.py ==
for pair in tod.pair_list:
d = np.array([tod.map2tod(det) for det in pair])
## Project TOD to maps
tod.tod2map(d, sky_out_tot)
When I use the "so_MC_app" way in the simple app, I get the same error.
The error is:
Traceback (most recent call last):
File "examples/test/simple_app.py", line 179, in
tod.tod2map(d, sky_out_tot)
File "/data/home/joy/simons_observatory/code/s4cmb/s4cmb/tod.py", line 635, in tod2map
assert npixfp == self.point_matrix.shape[0]
AssertionError
Do you understand what's going on? Does the use of one code vs the other has to match the "perpair" parameter?
Thanks!!
The way you loop over focal plane pixel to do the mapmaking depends indeed on the value of mapping_perpair
parameter. In simple_app.py, one first load all the pixel (and set mapping_perpair=False
in the tod initialisation) and then perform the mapmaking with all the pixels at once. In so_MC_app.py, the mapmaking is done pair-by-pair (and mapping_perpair=True
).
You closed the issue because you found the solution, or by mistake?
You are right, I will make it clearer! Thanks!
I have changed the code accordingly. Should be clearer now!