Lv2_average_ps_methods.py
def realfft(eventfile,segment_length):
    """
    Performing PRESTO's realfft on the binned data (.dat)

    eventfile - path to the event file. Will extract ObsID from this for the NICER files.
    segment_length - length of the individual segments
    """
    parent_folder = str(pathlib.Path(eventfile).parent)
    dat_files = sorted(glob.glob(parent_folder+'/accelsearch_' + str(segment_length) + 's/*.dat')) #not that order matters here I think, but just in case
    # recall that un-truncated data is "*bary.dat", so "*bary_*.dat" is truncated data!
    logfile = parent_folder + '/accelsearch_' + str(segment_length) + 's/realfft.log'

    print('Doing realfft now!')
    with open(logfile,'w') as logtextfile:
        for i in tqdm(range(len(dat_files))):
            if os.path.exists(dat_files[i][:-3] + 'fft')==False:
                output = subprocess.run(['realfft',dat_files[i]],capture_output=True,text=True)
                logtextfile.write(output.stdout)
                logtextfile.write('*------------------------------* \n')
                logtextfile.write(output.stderr)
        logtextfile.close()

    return

    Performing PRESTO's realfft on the binned data (.dat)

    eventfile - path to the event file. Will extract ObsID from this for the NICER files.
    segment_length - length of the individual segments
    
Performing PRESTO's realfft on the binned data (.dat)
eventfile - path to the event file. Will extract ObsID from this for the NICER files.
segment_length - length of the individual segments
Performing PRESTO ' s realfft on the binned data ( . dat ) eventfile - path to the event file . Will extract ObsID from this for the NICER files . segment_length - length of the individual segments
def realfft(eventfile,segment_length):
    parent_folder = str(pathlib.Path(eventfile).parent)
    dat_files = sorted(glob.glob(parent_folder+'/accelsearch_' + str(segment_length) + 's/*.dat')) 
    logfile = parent_folder + '/accelsearch_' + str(segment_length) + 's/realfft.log'
    print('Doing realfft now!')
    with open(logfile,'w') as logtextfile:
        for i in tqdm(range(len(dat_files))):
            if os.path.exists(dat_files[i][:-3] + 'fft')==False:
                output = subprocess.run(['realfft',dat_files[i]],capture_output=True,text=True)
                logtextfile.write(output.stdout)
                logtextfile.write('*------------------------------* \n')
                logtextfile.write(output.stderr)
        logtextfile.close()
    return
def realfft ( eventfile , segment_length ) : parent_folder = str ( pathlib . Path ( eventfile ) . parent ) dat_files = sorted ( glob . glob ( parent_folder + '/accelsearch_' + str ( segment_length ) + 's/*.dat' ) ) logfile = parent_folder + '/accelsearch_' + str ( segment_length ) + 's/realfft.log' print ( 'Doing realfft now!' ) with open ( logfile , 'w' ) as logtextfile : for i in tqdm ( range ( len ( dat_files ) ) ) : if os . path . exists ( dat_files [ i ] [ : - 3 ] + 'fft' ) == False : output = subprocess . run ( [ 'realfft' , dat_files [ i ] ] , capture_output = True , text = True ) logtextfile . write ( output . stdout ) logtextfile . write ( '*------------------------------* \n' ) logtextfile . write ( output . stderr ) logtextfile . close ( ) return
Performing PRESTO's realfft on the binned data (.dat)
eventfile - path to the event file.
Performing PRESTO ' s realfft on the binned data ( . dat ) eventfile - path to the event file .
"""
    Performing PRESTO's realfft on the binned data (.dat)

    eventfile - path to the event file. Will extract ObsID from this for the NICER files.
    segment_length - length of the individual segments
    """ #not that order matters here I think, but just in case # recall that un-truncated data is "*bary.dat", so "*bary_*.dat" is truncated data!
eventfile
segment_length