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

Focal plane visualizer and detector file generator #345

Merged
merged 8 commits into from
Nov 20, 2024
Merged

Conversation

yusuke-takase
Copy link
Collaborator

@yusuke-takase yusuke-takase commented Nov 15, 2024

I often want to know information about the detector by specifying the FPU's location.
Furthermore, I thought it would be even better if I could create a file with a list of detectors from the visual information, assuming an e2e simulation.
So, I would like to propose this functionality in litebird_sim.

I made plot_fp.py which can be executed by

python -m litebird_sim.plot_fp

Then, this kind of conversation will be happened:

Available IMO versions: ['(1). v2']
Input IMO version's number: 
1
Input telescope's number: ['(1). LFT', '(2). MFT', '(3). HFT']
1
The availavle channels are: ['(1). L1-040', '(2). L2-050', '(3). L1-060', '(4). L3-068', '(5). L2-068', '(6). L4-078', '(7). L1-078', '(8). L3-089', '(9). L2-089', '(10). L4-100', '(11). 
L3-119', '(12). L4-140']
Input the channel's number:
1
Do you want to make a detector list file? (y/n) 
y
Create a detector list file.
Input mission duration to define a scaling factor for NET (unit: yr):
1
Specify the directory to save:
./
Click is available...
The detectors_LFT_L1-040_T+B.txt is generated.
Location: ./detectors_LFT_L1-040_T+B.txt

During this conversation, the function loads IMO which is installed in the local machine, and the FPU which is specified in the conversation will be visualized like this:
ex_plot_fp
By the clicking, the DetectorInfo is shown in right in real time.
Furthermore, detectors that were clicked and ‘starred’ when the plot was closed are saved to a file with the following content:

# Telescope     Channel         IMO_NET         Number_det      Scaled_NET      Detector_name
LFT		L1-040		114.63		6/48		23.4		000_003_004_UA_040_B
LFT		L1-040		114.63		6/48		23.4		000_003_004_UA_040_T
LFT		L1-040		114.63		6/48		23.4		000_003_005_QB_040_B
LFT		L1-040		114.63		6/48		23.4		000_003_005_QB_040_T

It will be the input of the e2e simulation and I hope it is useful for everyone.
How do you guys think this functionality?

Yusuke Takase and others added 2 commits November 15, 2024 22:42
@ziotom78
Copy link
Member

Hi @yusuke-takase , very lovely, I like it! For me, it is a nice feature. If there are no objections, we can merge it. I would suggest a few things:

  • Apart from the usual entry in the CHANGELOG, I think this deserves a mention in the README
  • Add a reference to this feature in the documentation. (However, perhaps it is better to wait for Reorganize the User’s manual #342 to be approved and then merge master in this branch before modifying the docs.)

@yusuke-takase
Copy link
Collaborator Author

yusuke-takase commented Nov 18, 2024

Thanks a lot, @ziotom78 !
I added info to CHANGELOG though I don't have an imagination about the section in README, do you have any examples?

Add a reference to this feature in the documentation.

I agree with this, and I can do it after #342 merged. Maybe it will be almost same description what we will write in README.

@ziotom78
Copy link
Member

I added info to CHANGELOG though I don't have an imagination about the section in README, do you have any examples?

Maybe you could add a short sub-section under the " Usage " section, where you put the description and image you posted in the topmost comment here. (Adding an image is an effective way to advertise things!)

@ziotom78
Copy link
Member

Hi @yusuke-takase , #342 has been merged in master. 🥳

@yusuke-takase
Copy link
Collaborator Author

Thanks, @ziotom78
I made this gif animation. I'm not 100% sure though maybe it can be called from README by indicating this place's URL.
Let me try it.

plot_fp_usage

@yusuke-takase
Copy link
Collaborator Author

Hi @ziotom78 ,
I think I could have completed the work. In my local environment, rendering by sphinx is seemed working.

@ziotom78 ziotom78 merged commit e7b14ea into master Nov 20, 2024
9 checks passed
@ziotom78 ziotom78 deleted the det_viewer branch November 20, 2024 17:17
yusuke-takase added a commit that referenced this pull request Nov 23, 2024
* 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]>
ziotom78 added a commit that referenced this pull request Nov 28, 2024
* angle correction for 1-detector-pointing due to wedge HWP

* Code simplifications (distructive changes) around the pointing systematics

* modifiy the `pointing_sys.py`

* add add_hwp_rot_disturb

* modify add_hwp_rot_disturb

* update documents

* add comments

* refactoring

* fix bug of __init__

* add comments

* reverse gitignore and remove cmb maps

* add detailed assertion comments

* refactor: update pointing_sys imports and __all__ exports

* destructive change on pointing_sys.py: update functionality for MPI

* update docs

* update docs, remove cmb

* fix scanning.py assertion

* merge master

* add test of hwp pointing sys

* update notebook

* Reorganize the User’s manual (#342)

* 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]>

* Focal plane visualizer and detector file generator  (#345)

* 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]>

* Change the default behavior of Simulation.add_noise() (#349)

* Simulation.add_noise uses self.random as default

* CHANGELOG updated

* reformat by ruff

* Update plot usage GIF in README.md

* Update focal plane visualization section header in plot_fp.rst

* Remove unused __init__.py file from pointing_sys module

* Refactor import statement in litebird_sim and adjust spin rate in simulation test

* update pointing reference file

* Add documentation for pointing systematics and introduce pointing_sys.rst

* Add author Yusuke Takase to pyproject.toml

* CHANGELOG.md: Update breaking changes for PointingSys and get_pointings functions

* refactoring for ruff

* update pointing sys notebooks

* docs: update

* remove `docs/build`

---------

Co-authored-by: Nicolò Raffuzzi <[email protected]>
Co-authored-by: Maurizio Tomasi <[email protected]>
Co-authored-by: Luca Pagano <[email protected]>
Co-authored-by: Yusuke Takase <[email protected]>
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.

2 participants