nicer tools

nicer.nicer.add_lc(filename, T_ref=0, ax=None, **kargs)

Add a Xselect lightcurve from a file to a graph using the plt.errorbar

Parameters
  • filename – name of the xselect .lc file

  • T_ref – a reference ‘NICER’ time which we want as the zero of the time-axis

  • ax – (None) the ax to which the lightcurve should be added

  • kargs – any additional parameters to pass to the plt.errorbar function.

nicer.nicer.add_pha(filename, ax=None, **kargs)

Add a Xselect PHA spectrum from a file to a graph, using the plt.step function

Parameters
  • filename – name of the xselect pha file

  • ax – (None) the ax to which the spectrum should be added

  • kargs – any additional parameters to pass to the step function.

nicer.nicer.gti_info(gti, verbose=False)

Returns the duration of each GTI and the gap in between each GTI

Parameters
  • gti – a GTI object read from the GTI fits extension.

  • verbose – (False) flag to print out the GTI information

Rtype duration

array with the duration of each GTI (in sec)

Rtype gap

array with the gap (in sec) between each GTI

nicer.nicer.load_curve(filename, T0=0)

Load a light curve from Xselect.

The light curve starts from the first GTI.

Parameters
  • filename – The name of the file containing the Xselect LC.

  • T0

    1. Difference between the start of the GTI in the Xselect LC, and that of the desired “zero” time stamp.

Rtype time_LC

= Xselect Time stamp + start of Xselect first GTI - T0.

Rtype LC

The light curve

nicer.nicer.nicerl2_command_create(filename='ObsID.dat', output='nicerl2_command.sh')

Creates a bash script that contains command to run Nicerl2 for each ObsID in the list (read from filename=’ObsID.dat’.

The options for the Nicerl2 are listed as ${FLAGS} in the script. By defining this environement variable, the same script can be used for different processing options.

The cleaned event list are renamed to cl_${TYPE}, where the environement variable ${TYPE} contains the desired suffix. This is so that the Nicerl2 can be used with different options, for comparison (the default behavior of Nicerl2 is to clobber).

See the nicerl2_source.sh template to see how to set the environement variables.

Parameters
  • filename – (‘ObsID.dat’), the filename that contains the list of ObsID.

  • output – (‘nicerl2_command.sh’), the filename of the output bash script

Return type

None. Creates a bash script called output=’nicerl2_command.sh’

nicer.nicer.nimaketime_command_create(folder, filename='ObsID.dat', include=False, run_f='run.sh')

This function creates the command for the nimaketime task. The commands are written in run.sh inside the folder (see below) directory. After running bash run.sh from the terminal, the gti file with name niObsID.gti will be created inside each of the ObsID directory. Inside folder/ObsID/, there should be text file with name obsid_time.txt, the obsid_time.txt is expected to have a list of time intervals which are to be included (include=True) or excluded (include=False) while running nicerl2.

In addition, this function also writes down the expression used in nimaketime inside the ObsID directory under the name of ObsID_nimaketime_expr.txt.

Parameters
  • folder – folder is the directory containing directories with names given in filename.

  • filename – (‘ObsID.dat’) name of the file containing the list of ObsID

  • include – whether to include the gtis, or exclude them

  • run_f – (‘run.sh’) name of the file containing all of the run commands (created in folder)

nicer.nicer.plot_mk2(filename='ObsID.dat', obspath='.', clean_type='', LC_path='.', LC_clean_type='', PDF_path='.', merge_gap=300)

Make a graph of the enviromental condition plus Xselect light curves.

Needed:

  • The ufa files: obspath/obsIDfolder/xti/event_cl/niObsID_0mpu7_ufa.evt – they are the base for the global GTI information. The start of the first GTI defined t=0 (T0 in the code)

  • Some cleaned evt list: obspath/obsIDfolder/xti/event_cl/niObsID_0mpu7_cl(_type).evt. This will be use to mark the good GTIs.

  • The mask 3 files: obspath/obsIDfolder/auxil/ni’+obs+’.mkf3

  • A set of LC made from the UFA (LC-ufa-full/, LC-ufa-highcut/, LC-ufa-midcut/). Named ObsID.lc

  • A set of LC made from the clean evt list (LC-LC_CLEAN_TYPE-full/, LC-LC_CLEAN_TYPE-highcut/, LC-LC_CLEAN_TYPE-midcut/). Named ObsID.lc

Parameters
  • filename – (‘ObsID.dat’) File containing the list of ObsID

  • obspath – (‘.’) Path where the ObsID folders are located.

  • clean_type – (‘’) the suffix to use for the clean event files (niObsID_0mpu7_cl(CLEAN_TYPE).evt

  • merge_gap

    1. If two raw GTIs are separated by less than merge_gap (in sec), they will be printed on the same page.

  • LC_path – (‘.’) the path where the LC folders are located.

  • LC_clean_type – (‘’) the suffix to use for the folder containing the cleaned LC (e.g. LC-LC_CLEAN_TYPE-full/)

  • PDF_path – (‘.’) the path where the PDFs will be saved (e.g. pdf_path/ObsID.pdf)

nicer.nicer.xselect_command_create(folder, filename='ObsID.dat', template_f='template.dat', run_f='run.sh')

This function reads in a xselect template and substitute the ObsID numbers

In the template, the obsID is replaced with {}. The template is expected to be located in the specified folder. A xselect .xco script will be created for each ObsID. Also, a run file (default ‘run.sh’) will be created, to execute all of the .xco script at once, with a bash run.sh

Parameters
  • folder – the folder containing the template, and that will contain the created scripts

  • filename – (‘ObsID.dat’) name of the file containing the list of ObsID

  • template_f – (‘template.dat’) name of the file containing the template to use (expected location in folder)

  • run_f – (‘run.sh’) name of the file containing all of the run commands (created in folder)