Lv2_preprocess.py
def preprocess(obsdir,nicerl2_flags,psrpipe_flags,refframe,orbitfile,parfile,nicer_datafile,nicer_output,nicersoft_datafile,nicersoft_output,nicersoft_folder,custom_coords):
    """
    Preprocessing the NICER data for use in PRESTO, so running gunzip, psrpipe, and barycorr.

    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
    psrpipe_flags - a LIST of input flags for psrpipe
    refframe - reference frame for barycenter corrections (usually ICRS)
    orbitfile - orbit file (from the NICER data directory) for the barycenter corrections
    parfile - .par file if any
    nicer_datafile - event file from the original NICER data directory
    nicer_output - output/barycenter-corrected event file from the original NICER data directory
    nicersoft_datafile - event file (usually cleanfilt.evt) from the NICERsoft data directory
    nicersoft_output - output/barycenter-corrected event file from the NICERsoft data directory
    nicersoft_folder - output folder for the NICERsoft data
    custom_coords - either an empty list/array or a list/array with two elements (RA/DEC)
    """
    if type(psrpipe_flags) != list:
        raise TypeError("flags should be a list! Not even an array.")
    if type(nicerl2_flags) != list:
        raise TypeError("flags should be a list! Not even an array.")
    if refframe != 'ICRS' and refframe != 'FK5':
        raise ValueError("refframe should either be ICRS or FK5! Otherwise, update Lv1_barycorr.py if there are options I was unaware of.")

    print('Now unzipping all the files!')
    Lv0_gunzip.unzip_all(obsdir) #unzipping the contents within the observation
    print('Now running nicerl2!')
    Lv0_nicerl2.nicerl2(obsdir,nicerl2_flags)
    print('Now running psrpipe.py from NICERsoft!')
    Lv0_psrpipe.psrpipe(nicer_datafile,psrpipe_flags) #applying custom cuts (though no need --shrinkelv after HEASOFT 6.26)

    print('Now running barycorr from HEASOFT!')
    ##### For the NICER data
    Lv1_barycorr.barycorr(nicer_datafile,nicer_output,refframe,orbitfile,parfile,obsdir,custom_coords)
    ##### For the NICERsoft file (cleanfilt.evt, usually)
    Lv1_barycorr.barycorr(nicersoft_datafile,nicersoft_output,refframe,orbitfile,parfile,nicersoft_folder,custom_coords)

    return

    Preprocessing the NICER data for use in PRESTO, so running gunzip, psrpipe, and barycorr.

    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
    psrpipe_flags - a LIST of input flags for psrpipe
    refframe - reference frame for barycenter corrections (usually ICRS)
    orbitfile - orbit file (from the NICER data directory) for the barycenter corrections
    parfile - .par file if any
    nicer_datafile - event file from the original NICER data directory
    nicer_output - output/barycenter-corrected event file from the original NICER data directory
    nicersoft_datafile - event file (usually cleanfilt.evt) from the NICERsoft data directory
    nicersoft_output - output/barycenter-corrected event file from the NICERsoft data directory
    nicersoft_folder - output folder for the NICERsoft data
    custom_coords - either an empty list/array or a list/array with two elements (RA/DEC)
    
Preprocessing the NICER data for use in PRESTO, so running gunzip, psrpipe, and barycorr.
Preprocessing the NICER data for use in PRESTO so running gunzip psrpipe and barycorr .
def preprocess(obsdir,nicerl2_flags,psrpipe_flags,refframe,orbitfile,parfile,nicer_datafile,nicer_output,nicersoft_datafile,nicersoft_output,nicersoft_folder,custom_coords):
    if type(psrpipe_flags) != list:
        raise TypeError("flags should be a list! Not even an array.")
    if type(nicerl2_flags) != list:
        raise TypeError("flags should be a list! Not even an array.")
    if refframe != 'ICRS' and refframe != 'FK5':
        raise ValueError("refframe should either be ICRS or FK5! Otherwise, update Lv1_barycorr.py if there are options I was unaware of.")
    print('Now unzipping all the files!')
    Lv0_gunzip.unzip_all(obsdir) 
    print('Now running nicerl2!')
    Lv0_nicerl2.nicerl2(obsdir,nicerl2_flags)
    print('Now running psrpipe.py from NICERsoft!')
    Lv0_psrpipe.psrpipe(nicer_datafile,psrpipe_flags) 
    print('Now running barycorr from HEASOFT!')
    Lv1_barycorr.barycorr(nicer_datafile,nicer_output,refframe,orbitfile,parfile,obsdir,custom_coords)
    Lv1_barycorr.barycorr(nicersoft_datafile,nicersoft_output,refframe,orbitfile,parfile,nicersoft_folder,custom_coords)
    return
def preprocess ( obsdir , nicerl2_flags , psrpipe_flags , refframe , orbitfile , parfile , nicer_datafile , nicer_output , nicersoft_datafile , nicersoft_output , nicersoft_folder , custom_coords ) : if type ( psrpipe_flags ) != list : raise TypeError ( "flags should be a list! Not even an array." ) if type ( nicerl2_flags ) != list : raise TypeError ( "flags should be a list! Not even an array." ) if refframe != 'ICRS' and refframe != 'FK5' : raise ValueError ( "refframe should either be ICRS or FK5! Otherwise, update Lv1_barycorr.py if there are options I was unaware of." ) print ( 'Now unzipping all the files!' ) Lv0_gunzip . unzip_all ( obsdir ) print ( 'Now running nicerl2!' ) Lv0_nicerl2 . nicerl2 ( obsdir , nicerl2_flags ) print ( 'Now running psrpipe.py from NICERsoft!' ) Lv0_psrpipe . psrpipe ( nicer_datafile , psrpipe_flags ) print ( 'Now running barycorr from HEASOFT!' ) Lv1_barycorr . barycorr ( nicer_datafile , nicer_output , refframe , orbitfile , parfile , obsdir , custom_coords ) Lv1_barycorr . barycorr ( nicersoft_datafile , nicersoft_output , refframe , orbitfile , parfile , nicersoft_folder , custom_coords ) return
Preprocessing the NICER data for use in PRESTO, so running gunzip, psrpipe, and barycorr.
Preprocessing the NICER data for use in PRESTO so running gunzip psrpipe and barycorr .
"""
    Preprocessing the NICER data for use in PRESTO, so running gunzip, psrpipe, and barycorr.

    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
    psrpipe_flags - a LIST of input flags for psrpipe
    refframe - reference frame for barycenter corrections (usually ICRS)
    orbitfile - orbit file (from the NICER data directory) for the barycenter corrections
    parfile - .par file if any
    nicer_datafile - event file from the original NICER data directory
    nicer_output - output/barycenter-corrected event file from the original NICER data directory
    nicersoft_datafile - event file (usually cleanfilt.evt) from the NICERsoft data directory
    nicersoft_output - output/barycenter-corrected event file from the NICERsoft data directory
    nicersoft_folder - output folder for the NICERsoft data
    custom_coords - either an empty list/array or a list/array with two elements (RA/DEC)
    """ #unzipping the contents within the observation #applying custom cuts (though no need --shrinkelv after HEASOFT 6.26) ##### For the NICER data ##### For the NICERsoft file (cleanfilt.evt, usually)
obsdir
nicerl2_flags
psrpipe_flags
refframe
orbitfile
parfile
nicer_datafile
nicer_output
nicersoft_datafile
nicersoft_output
nicersoft_folder
custom_coords