Function demos
0. Importing modules
For Google Colab, clone the nicer repository into the Colab. If you are working locally and have a cloned version of the package in your PYTHONPATH, you can ignore the cell below.
[7]:
!git clone https://github.com/veropetit/nicer
fatal: destination path 'nicer' already exists and is not an empty directory.
This cell below is to pull the repo again if I made some changes (without have to reset the runtime)
[8]:
%cd /content/nicer
!git pull
%cd ..
/content/nicer
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (1/1), done.
remote: Total 3 (delta 2), reused 3 (delta 2), pack-reused 0
Unpacking objects: 100% (3/3), done.
From https://github.com/veropetit/nicer
f5605da..1cfeafa main -> origin/main
Updating f5605da..1cfeafa
Fast-forward
nicer.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
/content
[9]:
import nicer.nicer as ni
import numpy as np
import matplotlib.pyplot as plt
import importlib # This is in case I made modification to the module, to force reloading
importlib.reload(ni)
[9]:
<module 'nicer.nicer' from '/content/nicer/nicer.py'>
[10]:
fig, ax = plt.subplots(2,1)
ni.add_pha('nicer/tutorials/data/ni3627010101.pha', ax=ax[0])
ax[0].set_title('eps Lupi')
ni.add_pha('nicer/tutorials/data/ni4672010201.pha', ax=ax[1])
ax[1].set_title('zeta')
for item in ax:
item.set_xlabel('Energy (keV)')
item.set_ylabel('Count rate')
item.set_xscale('log')
item.set_xlim(0.1, 15)
plt.tight_layout()

[19]:
fig, ax = plt.subplots(1,1)
ni.add_lc('nicer/tutorials/data/ni3627010501.lc', T_ref=2.25e8,ax=ax,ls='',marker='o',alpha=0.5)
ax.set_title('eps Lupi')
ax.set_xlabel('Time since '+r'$\mathrm{T}_\mathrm{ref}$'+' (seconds)')
ax.set_ylabel('Count rate')
plt.tight_layout()
