Lv2_create_time_res_spec.py
def grppha(eventfile):
    """
    Function that does GRPPHA on a set of pha files.
    The function will output pha files of the format 'grp_$file'!

    eventfile - path to the event file. Will extract ObsID from this for the NICER files.
    """
    parent_folder = str(pathlib.Path(eventfile).parent)
    niextract_folder = parent_folder + '/accelsearch_GTIs/spectra/'
    binned_phas = sorted(glob.glob(niextract_folder+'*pha'))

    command_file = niextract_folder + 'grppha_commands.go'
    writing = open(command_file,'w')
    #### now to build the grppha command
    grppha = 'grppha'
    chatter = 'chatter=0'
    for i in range(len(binned_phas)):
        #comm = 'comm="group nicer_channels_to_group.dat & systematics 30-1200 0.02 & chkey ANCRFILE /Volumes/Samsung_T5/nicer-consim135p-teamonly-array50.arf & chkey RESPFILE /Volumes/Samsung_T5/nicer-rmf6s-teamonly-array50.rmf & chkey BACKFILE ' + backfile + ' & exit"'
        comm = 'comm="group nicer_channels_to_group.dat & systematics 30-1200 0.02 & exit"'
        infile = 'infile="' + str(pathlib.Path(binned_phas[i]).name) + '"'
        outfile = 'outfile="grp_' + str(pathlib.Path(binned_phas[i]).name) + '"'
        writing.write(grppha+' '+infile+' '+outfile+' '+chatter+' '+comm+'\n')
    writing.close()

    Function that does GRPPHA on a set of pha files.
    The function will output pha files of the format 'grp_$file'!

    eventfile - path to the event file. Will extract ObsID from this for the NICER files.
    
Function that does GRPPHA on a set of pha files.
The function will output pha files of the format 'grp_$file'!

path to the event file. Will extract ObsID from this for the NICER files.
Function that does GRPPHA on a set of pha files . The function will output pha files of the format ' grp_$file ' ! path to the event file . Will extract ObsID from this for the NICER files .
def grppha(eventfile):
    parent_folder = str(pathlib.Path(eventfile).parent)
    niextract_folder = parent_folder + '/accelsearch_GTIs/spectra/'
    binned_phas = sorted(glob.glob(niextract_folder+'*pha'))
    command_file = niextract_folder + 'grppha_commands.go'
    writing = open(command_file,'w')
    grppha = 'grppha'
    chatter = 'chatter=0'
    for i in range(len(binned_phas)):
        comm = 'comm="group nicer_channels_to_group.dat & systematics 30-1200 0.02 & exit"'
        infile = 'infile="' + str(pathlib.Path(binned_phas[i]).name) + '"'
        outfile = 'outfile="grp_' + str(pathlib.Path(binned_phas[i]).name) + '"'
        writing.write(grppha+' '+infile+' '+outfile+' '+chatter+' '+comm+'\n')
    writing.close()
def grppha ( eventfile ) : parent_folder = str ( pathlib . Path ( eventfile ) . parent ) niextract_folder = parent_folder + '/accelsearch_GTIs/spectra/' binned_phas = sorted ( glob . glob ( niextract_folder + '*pha' ) ) command_file = niextract_folder + 'grppha_commands.go' writing = open ( command_file , 'w' ) grppha = 'grppha' chatter = 'chatter=0' for i in range ( len ( binned_phas ) ) : comm = 'comm="group nicer_channels_to_group.dat & systematics 30-1200 0.02 & exit"' infile = 'infile="' + str ( pathlib . Path ( binned_phas [ i ] ) . name ) + '"' outfile = 'outfile="grp_' + str ( pathlib . Path ( binned_phas [ i ] ) . name ) + '"' writing . write ( grppha + ' ' + infile + ' ' + outfile + ' ' + chatter + ' ' + comm + '\n' ) writing . close ( )
Function that does GRPPHA on a set of pha files.
Function that does GRPPHA on a set of pha files .
"""
    Function that does GRPPHA on a set of pha files.
    The function will output pha files of the format 'grp_$file'!

    eventfile - path to the event file. Will extract ObsID from this for the NICER files.
    """ #### now to build the grppha command #comm = 'comm="group nicer_channels_to_group.dat & systematics 30-1200 0.02 & chkey ANCRFILE /Volumes/Samsung_T5/nicer-consim135p-teamonly-array50.arf & chkey RESPFILE /Volumes/Samsung_T5/nicer-rmf6s-teamonly-array50.rmf & chkey BACKFILE ' + backfile + ' & exit"'
eventfile