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 https://github.com/cositools/cosipy.
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:
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
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
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.
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
Fitting the spectrum of the Crab (binned) (ipynb)
Introduction to 3ML and astromodels
Likelihood analysis.
Mechanics of background estimation.
Plotting the result
Comparing the result with the data
Analysing a continuous source transiting in the sky.
Fitting the spectrum of a GRB (unbinned) (ipynb)
Introduction to unbinned analysis using normalizing flows.
Setting up the neural-network response and background approximations.
Initializing and saving adaptive integration caches for faster folding.
Performing the unbinned likelihood fit for a GRB point source.
Plotting the result and comparing it with the injected spectrum.
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
Image deconvolution (ipynb)
Explain the RL algorithm. Reference the previous example. Explain the difference with a TS map.
Fitting the 511 diffuse emission.
Analyze data in the Compton data space with galactic coordinates.
Link to a notebook using Scatt binning which shows its advantages/disadvantages.
Source injector (ipynb)
Convolve the response, point source model and orientation to obtain the mock data.
More types of source (e,g. extended source and polarization) will be suppored.
Continuum background estimation (ipynb)
Estimating the continuum background from the data.
Line background estimation (ipynb)
Estimating the background from neighboring energy bins.
Polarization (ASAD method) (ipynb)
Estimating the polarization degree and angle of a GRB using the Azimuthal Scattering Angle Distribution (ASAi)
Transient background estimation (ipynb)
Estimating the background for transients.
Polarization (ASAD method) (ipynb)
Estimating the polarization degree and angle of a GRB using the Azimuthal Scattering Angle Distribution (ASAD)
Polarization (Stokes parameters method) (ipynb)
Estimating the polarization of a GRB using Stokes parameters
Phase-resolved analysis (ipynb)
Folding event data and scaling mission exposure using pulsar timing models (ephemeris).
Point source Sensitivity calculator (ipynb)
Example to show how to compute sensitivity for point source model
Extended source Sensitivity calculator (ipynb)
Example to show how to compute sensitivity for extended source model
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.
- Data format and handling
- Detector response and signal expectation
- Fitting the spectrum of the Crab (binned)
- Fitting the spectrum of a GRB (unbinned)
- Extended source model fitting
- Image deconvolution
- Source injector
- Continuum Background Estimation
- Line background estimation
- Polarization (ASAD method)
- Transient background estimation
- Phase-resolved analysis
- Point source sensitivity calculator
- Extended source sensitivity calculator