Skip to content
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

Pointing systematics HWP class #344

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open

Conversation

yusuke-takase
Copy link
Collaborator

As I presented today's telecon, I have implemented the pointing systematics due to wedged transmissive HWP (or precessing reflective HWP) which causes a rotational disturbance to the pointings around the expected pointing direction.
The HWP angle redefinition that happened recently (#340) is also covered.

Current version of pointing-sys API has Simulation and List[DetectorInfo] as arguments like:

pntsys = lbs.PointingSys(sim, dets_list)

However it was not useful for MPI distribution, so in this PR, the Observation is added in arguments as:

pntsys = lbs.PointingSys(sim, obs, dets_list)

By this changing, we can multiply any systematic quaternions to any chunk of time given by MPI.

And several methods that do quaternion multiplications were bit messy and redundant, so everything is unified to this method:

lbs.left_multiply_syst_quats(
    result: RotQuaternion,
    syst_quats: RotQuaternion,
    detector: DetectorInfo,
    start_time,
    sampling_rate_hz
)

Maybe following thing should not discussed here though let me point it out.

An issue that I met in a preparation of e2e-pipeline for the pointing systematics is #189 .
Because this HWP-pointing systematics is happened in 19Hz intrinsically, so we forced to compute the spin2ecliptic_quats in 19Hz as well to perform the RotQuaternion multiplication without stacking.

It requires a lot of memory because when we call the Simulation.set_scanning_strategy(), all MPI processes compute quaternions start to end of simulation.
It can be avoided by:

(obs,) = sim.create_observations(
    detectors=dets,
    n_blocks_det=1,
    n_blocks_time=size,
    split_list_over_processes=False
)
scanning_strategy = lbs.SpinningScanningStrategy.from_imo(
    url= f"/releases/{imo_version}/satellite/scanning_parameters/",
    imo=imo,
)
sim.spin2ecliptic_quats = scanning_strategy.generate_spin2ecl_quaternions(
    start_time=obs.start_time,
    time_span_s=obs.n_samples/obs.sampling_rate_hz,
    delta_time_s=delta_time_s,
)

although if it is solved in clever way, it's definitely useful.

@ziotom78
Copy link
Member

Yeah, that is a long-standing TODO, but the idea I got at the time was to split the computation across the MPI processes and then gather all the quaternions in each process so that all the quaternions are available everywhere. This is, of course, not going to work in this specific case.

Your trick is probably the best way to do this. Perhaps we could add a paragraph or two about this in the documentation?

@yusuke-takase
Copy link
Collaborator Author

Hi @ziotom78,
Thank you for responding it! I understood the idea, it just contributes the calculation time reduction, not for memory allocation. Okay, I keep my way and I'm happy to write its documentation.

After #342 is merged, shall I write all of pointing systematics API usages, and this MPI tips? (Because I'm busy due to my PhD thesis writing, it takes a time bit...)

ziotom78 and others added 6 commits November 23, 2024 20:22
* Use PyData as the default theme for docs and update Sphinx and deps

* Rework the structure of the documentation

* Merge `Bandpasses` chapter into Detector and split `Scanning`

* Remove duplicated material

* Add missing reference

* Remove spurious comma

* Fix the grammar of a few sentences

* Fix grammar and broken links, update references where needed

* example in the noise page included, argument random in Simulation.add_noise is now optional

* removed part of last commit

* [skip ci] Update CHANGELOG

---------

Co-authored-by: Luca Pagano <[email protected]>
* add plot_fp.py

* ask duration_yr

* CHANGELOG.md: Add entry for plot_fp.py implementation and its functionality

* update README

* add plot.fp.rst in docs

* docs: Improve formatting and clarity in plot_fp.rst

* Fix the formatting to make ruff happy

---------

Co-authored-by: Yusuke Takase <[email protected]>
Co-authored-by: Maurizio Tomasi <[email protected]>
* Simulation.add_noise uses self.random as default

* CHANGELOG updated
@yusuke-takase
Copy link
Collaborator Author

Hi @ziotom78 ,

I wrote documentation of pointing systematics. I think it is ready to be merged into master if you are convinced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants