Lv2_swift_lc.py
def lcmath(corr_lc_files,corr_bg_files,bg_scale):
    """
    Running lcmath to do background subtraction on the xrtlccorr-corrected light curves

    corr_lc_files - list of corrected sw*_corr.lc files
    corr_bg_files - list of corrected sw*_bg_corr.lc files
    bg_scale - scaling factor for background
    """
    parent_folder = str(pathlib.Path(corr_lc_files[0]).parent)
    lcmath = open(parent_folder + '/lcmath_instruct.txt','w')

    for i in range(len(corr_lc_files)):
        inputfile = corr_lc_files[i]
        bgfile = corr_bg_files[i]
        outputfile = corr_lc_files[i][:-7] + 'bgsub_corr.lc'
        lcmath.write('lcmath ' + 'infile='+str(inputfile) + ' bgfile=' + bgfile + ' outfile=' + outputfile + ' multi=1' + ' multb=' + str(bg_scale) + ' addsubr=no' + ' err_mode=2' + '\n')

    lcmath.close()

    Running lcmath to do background subtraction on the xrtlccorr-corrected light curves

    corr_lc_files - list of corrected sw*_corr.lc files
    corr_bg_files - list of corrected sw*_bg_corr.lc files
    bg_scale - scaling factor for background
    
Running lcmath to do background subtraction on the xrtlccorr-corrected light curves
corr_lc_files - list of corrected sw*_corr.lc files
corr_bg_files - list of corrected sw*_bg_corr.lc files
bg_scale - scaling factor for background
Running lcmath to do background subtraction on the xrtlccorr - corrected light curves corr_lc_files - list of corrected sw * _corr . lc files corr_bg_files - list of corrected sw * _bg_corr . lc files bg_scale - scaling factor for background
def lcmath(corr_lc_files,corr_bg_files,bg_scale):
    parent_folder = str(pathlib.Path(corr_lc_files[0]).parent)
    lcmath = open(parent_folder + '/lcmath_instruct.txt','w')
    for i in range(len(corr_lc_files)):
        inputfile = corr_lc_files[i]
        bgfile = corr_bg_files[i]
        outputfile = corr_lc_files[i][:-7] + 'bgsub_corr.lc'
        lcmath.write('lcmath ' + 'infile='+str(inputfile) + ' bgfile=' + bgfile + ' outfile=' + outputfile + ' multi=1' + ' multb=' + str(bg_scale) + ' addsubr=no' + ' err_mode=2' + '\n')
    lcmath.close()
def lcmath ( corr_lc_files , corr_bg_files , bg_scale ) : parent_folder = str ( pathlib . Path ( corr_lc_files [ 0 ] ) . parent ) lcmath = open ( parent_folder + '/lcmath_instruct.txt' , 'w' ) for i in range ( len ( corr_lc_files ) ) : inputfile = corr_lc_files [ i ] bgfile = corr_bg_files [ i ] outputfile = corr_lc_files [ i ] [ : - 7 ] + 'bgsub_corr.lc' lcmath . write ( 'lcmath ' + 'infile=' + str ( inputfile ) + ' bgfile=' + bgfile + ' outfile=' + outputfile + ' multi=1' + ' multb=' + str ( bg_scale ) + ' addsubr=no' + ' err_mode=2' + '\n' ) lcmath . close ( )
Running lcmath to do background subtraction on the xrtlccorr-corrected light curves
corr_lc_files - list of corrected sw*_corr.lc files
corr_bg_files - list of corrected sw*_bg_corr.lc files
bg_scale - scaling factor for background
Running lcmath to do background subtraction on the xrtlccorr - corrected light curves corr_lc_files - list of corrected sw * _corr . lc files corr_bg_files - list of corrected sw * _bg_corr . lc files bg_scale - scaling factor for background
"""
    Running lcmath to do background subtraction on the xrtlccorr-corrected light curves

    corr_lc_files - list of corrected sw*_corr.lc files
    corr_bg_files - list of corrected sw*_bg_corr.lc files
    bg_scale - scaling factor for background
    """
corr_lc_files
corr_bg_files
bg_scale