Tutorials

This is a series of tutorials explaining step by step the various components of the cosipy library and how to use it. Although they are rendered as a webpage here, these are interactive Python notebooks (ipynb) that you can execute and modify, distributed as part of the cosipy repository. You can download them using the links below, or by cloning the whole repository running git clone git@github.com:cositools/cosipy.git.

If you are interested instead of the description of each class and method, please see our API section.

See also COSI’s second data challenge for the scientific description of the simulated data used in the tutorials, as well as an explanation of the statistical tools used by cosipy.

List of tutorials and contents, as a link to the corresponding Python notebook in the repository:

  1. Data format and handling (ipynb)

  • Data format, binned and unbinned

  • Binning the data in both local and galactic coordinates

  • Combining files.

  • Inspecting and plotting the data

  1. Spacecraft orientation and location (ipynb)

  • SC file format and manipulation it —e.g. get a time range, rebin it.

  • The dwell time map and how to obtain it

  • Generate point source response and export to the format that can be read by XSPEC

  • The scatt map and how to obtain it

  1. Detector response and signal expectation (ipynb)

  • Explanation of the detector response format and meaning

  • Visualizing the response

  • Convolving the detector response with a point source model (location + spectrum) + spacecraft file to obtain the expected signal counts. Both in SC and galactic coordinates.

  1. TS Map: localizing a GRB (ipynb)

  • TS calculation

  • Meaning of the TS map and how to compute confidence contours

  • Computing a TS map, getting the best location and estimating the error

  1. Fitting the spectrum of a GRB (ipynb)

  • Introduction to 3ML and astromodels

  • Likelihood analysis.

  • Mechanics of background estimation.

  • Fitting a simple power law, assuming you know the time of the GRB

  • Plotting the result

  • Comparing the result with the data

  1. Fitting the spectrum of the Crab (ipynb)

  • Analysing a continuous source transiting in the sky.

  1. Extended source model fitting (ipynb)

  • Obtaining the extended source response as a convolution of multiple point sources

  • Pre-computing a response in galactic coordinates for all-sky

  • Fitting an extended source

  1. Image deconvolution (ipynb)

  • Explain the RL algorithm. Reference the previous example. Explain the difference with a TS map.

  • Scatt binning and its advantages/disadvantages

  • Fitting the 511 diffuse emission.

  1. TODO: Source injector

  • Nice to have: allow theorist to test the sensitivity of their models

Warning

Under construction. Some of the explanations described above might be missing. However, the notebooks are fully functional. If you have a question not yet covered by the tutorials, please discuss issue so we can prioritize it.