cositools / cosipy

The COSI high-level data analysis tools
Apache License 2.0
3 stars 16 forks source link

Make the creation of dwell time map quiet and clean; fix filename issue in the FullDetectorResponse module; add fast ts fit module #108

Closed Yong2Sheng closed 7 months ago

Yong2Sheng commented 7 months ago

Update 1 -- SpacecraftFile and FullDetectorResponse

According to #88, I added two parameters (quiet and save) for get_target_in_sc_frame and get_dwell_map methods:

  1. quiet controls if intermediate messages during calculation are printed. Default is False.
  2. save controls if the target path in the SC frame and the dwell time map are saved. Default is False.

The issue caused by FullDetectorResponse.open method when the input is a pathlib.Path object instead of str is fixed. Now the filename will be converted into a pathlib.Path object regardless of the type of input.

Update 2 -- FastTSMap

I also added two new modules: fast_norm_fit.py and fast_ts_fit.py.

  1. fast_norm_fit.py is taken from the BusrtCube tool (simply copy and paste), so it doesn't need review (I guess so?). @israelmcmc please let me know what we should do to credit this module.

  2. fast_ts_fit.py is the one I wrote to compute the parallel ts computation based on fast_norm_fit.py, which requires review.

  3. The tutorial notebook is located at /docs/tutorials/Parallel_TS_map_computation.ipynb. It contains the necessary cells with simple explanatory comments to run through the whole process. I will update it in future PR with more text in detail to explain what it's actually doing. Let me know if you have any questions regarding this.

  4. Now FastTSMap uses all the available cores to run the parallel computation. Please let me know if it significantly slows down your machine.

  5. The data are upload to the folder /cosipy/test_data:

    • new_healpix_rsp_Binned_Bkg_2s_model.hdf5
    • new_healpix_rsp_Binned_Cosmic2s.hdf5
    • new_healpix_rsp_Binned_protoGRB.hdf5

    I already set up the path to the files in Parallel_TS_map_computation.ipynb, but if it doesn't work on your machine, please update the path accordingly.

Thanks!

ckierans commented 7 months ago

Hi Yong, I've looked through this pull request. Mostly I focused on the Parallel_TS_map_computation jupyter-notebook, and I have a few comments but these are mostly cosmetic vs functional.