Lv2_create_time_res_spec.py
def instructions(eventfile):
    """
    Writing a set of instructions to use in XSELECT, in order to extract the spectra and all!

    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/'

    instruct_file = niextract_folder + '/instructions.txt'

    eventfiles = sorted(glob.glob(niextract_folder+'/*E0050-1200.evt'))
    instruct = open(instruct_file,'w')
    for i in range(len(eventfiles)):
        eventfile = str(pathlib.Path(eventfiles[i]).name)

        instruct.write('set mission nicer' + '\n')
        instruct.write('set inst xti' + '\n')
        instruct.write('set datadir ' + niextract_folder + '\n')
        instruct.write('read event ' + eventfile + '\n')
        instruct.write('extract spectrum' + '\n')
        instruct.write('save spectrum ' + eventfile[:-3] + 'pha' + '\n')
        instruct.write('clear data' + '\n')
        instruct.write(' ' + '\n')

    instruct.close()

    return

    Writing a set of instructions to use in XSELECT, in order to extract the spectra and all!

    eventfile - path to the event file. Will extract ObsID from this for the NICER files.
    
Writing a set of instructions to use in XSELECT, in order to extract the spectra and all.
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
Writing a set of instructions to use in XSELECT in order to extract the spectra and all . eventfile - path to the event file . Will extract ObsID from this for the NICER files .
def instructions(eventfile):
    parent_folder = str(pathlib.Path(eventfile).parent)
    niextract_folder = parent_folder + '/accelsearch_GTIs/spectra/'
    instruct_file = niextract_folder + '/instructions.txt'
    eventfiles = sorted(glob.glob(niextract_folder+'/*E0050-1200.evt'))
    instruct = open(instruct_file,'w')
    for i in range(len(eventfiles)):
        eventfile = str(pathlib.Path(eventfiles[i]).name)
        instruct.write('set mission nicer' + '\n')
        instruct.write('set inst xti' + '\n')
        instruct.write('set datadir ' + niextract_folder + '\n')
        instruct.write('read event ' + eventfile + '\n')
        instruct.write('extract spectrum' + '\n')
        instruct.write('save spectrum ' + eventfile[:-3] + 'pha' + '\n')
        instruct.write('clear data' + '\n')
        instruct.write(' ' + '\n')
    instruct.close()
    return
def instructions ( eventfile ) : parent_folder = str ( pathlib . Path ( eventfile ) . parent ) niextract_folder = parent_folder + '/accelsearch_GTIs/spectra/' instruct_file = niextract_folder + '/instructions.txt' eventfiles = sorted ( glob . glob ( niextract_folder + '/*E0050-1200.evt' ) ) instruct = open ( instruct_file , 'w' ) for i in range ( len ( eventfiles ) ) : eventfile = str ( pathlib . Path ( eventfiles [ i ] ) . name ) instruct . write ( 'set mission nicer' + '\n' ) instruct . write ( 'set inst xti' + '\n' ) instruct . write ( 'set datadir ' + niextract_folder + '\n' ) instruct . write ( 'read event ' + eventfile + '\n' ) instruct . write ( 'extract spectrum' + '\n' ) instruct . write ( 'save spectrum ' + eventfile [ : - 3 ] + 'pha' + '\n' ) instruct . write ( 'clear data' + '\n' ) instruct . write ( ' ' + '\n' ) instruct . close ( ) return
Writing a set of instructions to use in XSELECT, in order to extract the spectra and all!
Writing a set of instructions to use in XSELECT in order to extract the spectra and all!
"""
    Writing a set of instructions to use in XSELECT, in order to extract the spectra and all!

    eventfile - path to the event file. Will extract ObsID from this for the NICER files.
    """
eventfile