-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactoring the C++ extension codes, introducing pointing flags with code optimization #1
base: main
Are you sure you want to change the base?
Conversation
In the last commit, I:
|
In the for i in range(Nrows):
if pointings[i] == -1:
continue
vec_out[2 * pointings[i]] += v[i] * cos[i]
vec_out[2 * pointings[i] + 1] += v[i] * sin[i] and in for i in range(Nrows):
if pointings[i] == -1:
continue
x[i] += v[2 * pointings[i]] * cos[i]
+v[2 * pointings[i] + 1] * sin[i] We can translate for i in range(Nrows):
pixel = pointings[i]
x[i] += pointings_flag[i] * (v[2*pixel] * cos[i]
+ v[2*pixel+1] * sin[i]) However, since pixel_flag = np.zeros(npix, dtype=bool)
for pixel in pixel_mask:
pixel_flag[pixel] = True With this, we can now write the for idx in range(Nrows):
pixel = pointings[idx]
pixflag = pixel_flag[pixel]
pixel *= pixflag # This marks pathological pixel to pixel index 0
pointflag = pixflag && pointings_flag[idx] # This flags the sample corresponding to pathological pixel to zero
x[i] += pointings_flag[i] * (v[2*pixel] * cos[i]
+ v[2*pixel+1] * sin[i]) The same has been implemented with the previous commit. |
…amples according to new_npix; added pixel_flag and old2new_pixel members in ProcessTimeSamples; made sure that dtype_float is promoted dtype from noise_weight and pol_angles; updated relevant tests
…om ProcessTimeSamples; updated the relevant tests
Picking from the last comment, we had the for loop for for idx in range(Nrows):
pixel = pointings[idx]
pixflag = pixel_flag[pixel]
pixel *= pixflag # This marks pathological pixel to pixel index 0
pointflag = pixflag && pointings_flag[idx] # This flags the sample corresponding to pathological pixel to zero
x[i] += pointings_flag[i] * (v[2*pixel] * cos[i]
+ v[2*pixel+1] * sin[i]) While it successfully deals with pathological pixels stored in the
With these changes, the loop becomes for idx in range(Nrows):
pixel = pointings[idx]
pointflag = pointings_flag[idx]
x[i] += pointings_flag[i] * (v[2*pixel] * cos[i]
+ v[2*pixel+1] * sin[i]) |
Shouldn’t the flag be applied to both operations ,e.g.
x[i] += pointings_flag[i] * (v[2*pixel] * cos[i] + v[2*pixel+1] * sin[i])
|
@giuspugl Yes, it has already been applied to both operators. |
…S map-maker for litebird_sim
With respect to the refactoring done so far, the previous class/function interfaces are now incompatible with the new one. In light of this, I have now implemented the function |
…d the const casting in cpp extensions
…or PointingLO and ProcessTimeSamples to ensure that the computed quantities are correct
…terminant and using it as the only condition to identify the pathological pixels; updated corresponding tests; added test to check the correctness of each block of preconditionerLO
… any python buffer can be provided as a template argument
For noise-less time-ordered data (TOD) from To fix this issue, we revisited the function We decided to replace this flagging scheme with the one where we flag all the pixels that might result in singular matrix block in the whereas for Eventually in the new pixel flagging scheme, we are computing the determinant of the matrix blocks in |
…iguous arrays are passed through with no implicit conversion
Everything looks good, few observations :
|
Yes, it does converge with one iteration in the presence of HWP
Thanks, I have now updated the comment! |
This PR introduces the following breaking changes in the code base:
ProcessTimeSamples
SparseLO
-->PointingLO
BlockDiagonalPreconditionerLO
brahmap/utilities/process_time_samples.py
brahmap/interfaces/linearoperators.py