Lv3_incoming.py
def nicerql(eventfile,extra_nicerql_args):
    """
    Probably the second step in the process, but this is to generate the psrpipe
    diagnostic plots, to see if there are any obvious red flags in the data.

    Will just really need eventfile ; orb file and mkf file is assumed to be in the SAME folder

    eventfile - path to the event file. Will extract ObsID from this for the NICER files.
    extra_nicerql_args - extra arguments to the nicerql script
    """
    parent_folder = str(pathlib.Path(eventfile).parent)
    orbfiles = glob.glob(parent_folder+'/*.orb')
    mkffiles = glob.glob(parent_folder+'/*.mkf*')
    if len(orbfiles) != 1 and len(mkffiles) != 1:
        raise ValueError("Either there's no orb/mkf file (in which case, make sure they're in the same folder as the event file!) or there are multiple files - do check!")

    logfile = parent_folder + '/nicerql.log'
    print('Running nicerql now for ' + eventfile + ':')
    with open(logfile,'w') as logtextfile:
        output = subprocess.run(['nicerql.py',eventfile,'--orb',orbfiles[0],'--mkf',mkffiles[0]] + extra_nicerql_args,capture_output=True,text=True)
        logtextfile.write(output.stdout)
        logtextfile.write('*------------------------------* \n')
        logtextfile.write(output.stderr)
        logtextfile.close()

    png_files = glob.glob('*evt*png')
    for i in range(len(png_files)):
        subprocess.run(['mv',png_files[i],parent_folder+'/'])

    return

    Probably the second step in the process, but this is to generate the psrpipe
    diagnostic plots, to see if there are any obvious red flags in the data.

    Will just really need eventfile ; orb file and mkf file is assumed to be in the SAME folder

    eventfile - path to the event file. Will extract ObsID from this for the NICER files.
    extra_nicerql_args - extra arguments to the nicerql script
    
Probably the second step in the process, but this is to generate the psrpipe
diagnostic plots, to see if there are any obvious red flags in the data.

Will just really need eventfile ; orb file and mkf file is assumed to be in the SAME folder

path to the event file. Will extract ObsID from this for the NICER files.
extra_nicerql_args - extra arguments to the nicerql script
Probably the second step in the process but this is to generate the psrpipe diagnostic plots to see if there are any obvious red flags in the data . Will just really need eventfile ; orb file and mkf file is assumed to be in the SAME folder path to the event file . Will extract ObsID from this for the NICER files . extra_nicerql_args - extra arguments to the nicerql script
def nicerql(eventfile,extra_nicerql_args):
    parent_folder = str(pathlib.Path(eventfile).parent)
    orbfiles = glob.glob(parent_folder+'/*.orb')
    mkffiles = glob.glob(parent_folder+'/*.mkf*')
    if len(orbfiles) != 1 and len(mkffiles) != 1:
        raise ValueError("Either there's no orb/mkf file (in which case, make sure they're in the same folder as the event file!) or there are multiple files - do check!")
    logfile = parent_folder + '/nicerql.log'
    print('Running nicerql now for ' + eventfile + ':')
    with open(logfile,'w') as logtextfile:
        output = subprocess.run(['nicerql.py',eventfile,'--orb',orbfiles[0],'--mkf',mkffiles[0]] + extra_nicerql_args,capture_output=True,text=True)
        logtextfile.write(output.stdout)
        logtextfile.write('*------------------------------* \n')
        logtextfile.write(output.stderr)
        logtextfile.close()
    png_files = glob.glob('*evt*png')
    for i in range(len(png_files)):
        subprocess.run(['mv',png_files[i],parent_folder+'/'])
    return
def nicerql ( eventfile , extra_nicerql_args ) : parent_folder = str ( pathlib . Path ( eventfile ) . parent ) orbfiles = glob . glob ( parent_folder + '/*.orb' ) mkffiles = glob . glob ( parent_folder + '/*.mkf*' ) if len ( orbfiles ) != 1 and len ( mkffiles ) != 1 : raise ValueError ( "Either there's no orb/mkf file (in which case, make sure they're in the same folder as the event file!) or there are multiple files - do check!" ) logfile = parent_folder + '/nicerql.log' print ( 'Running nicerql now for ' + eventfile + ':' ) with open ( logfile , 'w' ) as logtextfile : output = subprocess . run ( [ 'nicerql.py' , eventfile , '--orb' , orbfiles [ 0 ] , '--mkf' , mkffiles [ 0 ] ] + extra_nicerql_args , capture_output = True , text = True ) logtextfile . write ( output . stdout ) logtextfile . write ( '*------------------------------* \n' ) logtextfile . write ( output . stderr ) logtextfile . close ( ) png_files = glob . glob ( '*evt*png' ) for i in range ( len ( png_files ) ) : subprocess . run ( [ 'mv' , png_files [ i ] , parent_folder + '/' ] ) return
Probably the second step in the process, but this is to generate the psrpipe
diagnostic plots, to see if there are any obvious red flags in the data.
Probably the second step in the process but this is to generate the psrpipe diagnostic plots to see if there are any obvious red flags in the data .
"""
    Probably the second step in the process, but this is to generate the psrpipe
    diagnostic plots, to see if there are any obvious red flags in the data.

    Will just really need eventfile ; orb file and mkf file is assumed to be in the SAME folder

    eventfile - path to the event file. Will extract ObsID from this for the NICER files.
    extra_nicerql_args - extra arguments to the nicerql script
    """
eventfile
extra_nicerql_args