Beispiel #1
0
Updated on Mon Jun 3 - Added name_par_list for NICERsoft segments

Plotting light curves

"""
from __future__ import division, print_function
from astropy.io import fits
import numpy as np
import Lv0_dirs, Lv0_fits2dict, Lv1_data_bin
from scipy import stats
import pathlib
import matplotlib.pyplot as plt
import os

Lv0_dirs.global_par()  #obtaining the global parameters


def whole(eventfile, par_list, tbin_size, mode):
    """
    Plot the entire raw time series without any cuts to the data.

    eventfile - path to the event file. Will extract ObsID from this for the NICER files.
    par_list - A list of parameters we'd like to extract from the FITS file
    (e.g., from eventcl, PI_FAST, TIME, PI,)
    tbin_size - the size of the time bins (in seconds!)
    >> e.g., tbin_size = 2 means bin by 2s
    >> e.g., tbin_size = 0.05 means bin by 0.05s!
    mode - whether we want to show or save the plot.
    """
    if type(eventfile) != str:
Beispiel #2
0
# -*- coding: utf-8 -*-
"""
Created on Thurs May 30 9:31am 2019

Program for doing nicerl2 (mix of nicercal, niprefilter2, nimaketime, nicermergeclean)

"""
from __future__ import division, print_function
import numpy as np
import Lv0_dirs
from tqdm import tqdm
import os
import subprocess
import glob

Lv0_dirs.global_par()

def nicerl2(obsdir,nicerl2_flags):
    """
    Running nicerl2 to do initial filtering of the ufa file!

    obsdir - NICER data directory containing all the data files (e.g., path_to_NICER_dir/1034070101)
    nicerl2_flags - a LIST of input flags for nicerl2
    """
    if type(nicerl2_flags) != list:
        raise TypeError("flags should be a list! Not even an array.")

    logfile = obsdir + '/nicerl2.log'
    with open(logfile,'w') as logtextfile:
        output = subprocess.run(['nicerl2',obsdir]+nicerl2_flags,capture_output=True,text=True)
        logtextfile.write(output.stdout)