Lv1_barycorr.py
def read_par(parfile):
    """
    Function that reads a par file. In particular, for the purposes of barycorr,
    it will return POSEPOCH, RAJ, DECJ, PMRA, and PMDEC.

    Step 1: Read par file line by line, where each line is stored as a string in the 'contents' array
    Step 2a: For PSRJ, RAJ, DECJ, PMRA, and PMDEC, those lines are teased out
    Step 2b: The corresponding strings are split up without whitespace
    Step 3: Extract the values accordingly

    parfile - path of the .par file
    """
    if parfile[-4:] != '.par':
        raise ValueError("parfile is neither an empty string nor a .par file. Is this right?")

    contents = open(parfile,'r').read().split('\n')
    posepoch = [contents[i] for i in range(len(contents)) if 'POSEPOCH' in contents[i]][0].split()
    raj = [contents[i] for i in range(len(contents)) if 'RAJ' in contents[i]][0].split()[1].split(':')
    decj = [contents[i] for i in range(len(contents)) if 'DECJ' in contents[i]][0].split()[1].split(':')
    pmra = [contents[i] for i in range(len(contents)) if 'PMRA' in contents[i]][0].split()[1] #milliarcsec per year
    pmdec = [contents[i] for i in range(len(contents)) if 'PMDEC' in contents[i]][0].split()[1] #milliarcsec per year

    ra_deg = np.float(raj[0])*15 + np.float(raj[1])/60 * 15 + np.float(raj[2])/3600 * 15 #RA in HH:MM:SS to deg
    dec_deg = np.float(decj[0]) + np.float(decj[1])/60 + np.float(decj[2])/3600 #DEC in HH:MM:SS to deg

    return posepoch[1], ra_deg, dec_deg, pmra, pmdec

    Function that reads a par file. In particular, for the purposes of barycorr,
    it will return POSEPOCH, RAJ, DECJ, PMRA, and PMDEC.

    Step 1: Read par file line by line, where each line is stored as a string in the 'contents' array
    Step 2a: For PSRJ, RAJ, DECJ, PMRA, and PMDEC, those lines are teased out
    Step 2b: The corresponding strings are split up without whitespace
    Step 3: Extract the values accordingly

    parfile - path of the .par file
    
Function that reads a par file.

Step 1: Read par file line by line, where each line is stored as a string in the 'contents' array
Step 2a: For PSRJ, RAJ, DECJ, PMRA, and PMDEC, those lines are teased out
Step 2b: The corresponding strings are split up without whitespace
Step 3: Extract the values accordingly

path of the .par file
Function that reads a par file . Step 1 : Read par file line by line where each line is stored as a string in the ' contents ' array Step 2a : For PSRJ RAJ DECJ PMRA and PMDEC those lines are teased out Step 2b : The corresponding strings are split up without whitespace Step 3 : Extract the values accordingly path of the . par file
def read_par(parfile):
    if parfile[-4:] != '.par':
        raise ValueError("parfile is neither an empty string nor a .par file. Is this right?")
    contents = open(parfile,'r').read().split('\n')
    posepoch = [contents[i] for i in range(len(contents)) if 'POSEPOCH' in contents[i]][0].split()
    raj = [contents[i] for i in range(len(contents)) if 'RAJ' in contents[i]][0].split()[1].split(':')
    decj = [contents[i] for i in range(len(contents)) if 'DECJ' in contents[i]][0].split()[1].split(':')
    pmra = [contents[i] for i in range(len(contents)) if 'PMRA' in contents[i]][0].split()[1] 
    pmdec = [contents[i] for i in range(len(contents)) if 'PMDEC' in contents[i]][0].split()[1] 
    ra_deg = np.float(raj[0])*15 + np.float(raj[1])/60 * 15 + np.float(raj[2])/3600 * 15 
    dec_deg = np.float(decj[0]) + np.float(decj[1])/60 + np.float(decj[2])/3600 
    return posepoch[1], ra_deg, dec_deg, pmra, pmdec
def read_par ( parfile ) : if parfile [ - 4 : ] != '.par' : raise ValueError ( "parfile is neither an empty string nor a .par file. Is this right?" ) contents = open ( parfile , 'r' ) . read ( ) . split ( '\n' ) posepoch = [ contents [ i ] for i in range ( len ( contents ) ) if 'POSEPOCH' in contents [ i ] ] [ 0 ] . split ( ) raj = [ contents [ i ] for i in range ( len ( contents ) ) if 'RAJ' in contents [ i ] ] [ 0 ] . split ( ) [ 1 ] . split ( ':' ) decj = [ contents [ i ] for i in range ( len ( contents ) ) if 'DECJ' in contents [ i ] ] [ 0 ] . split ( ) [ 1 ] . split ( ':' ) pmra = [ contents [ i ] for i in range ( len ( contents ) ) if 'PMRA' in contents [ i ] ] [ 0 ] . split ( ) [ 1 ] pmdec = [ contents [ i ] for i in range ( len ( contents ) ) if 'PMDEC' in contents [ i ] ] [ 0 ] . split ( ) [ 1 ] ra_deg = np . float ( raj [ 0 ] ) * 15 + np . float ( raj [ 1 ] ) / 60 * 15 + np . float ( raj [ 2 ] ) / 3600 * 15 dec_deg = np . float ( decj [ 0 ] ) + np . float ( decj [ 1 ] ) / 60 + np . float ( decj [ 2 ] ) / 3600 return posepoch [ 1 ] , ra_deg , dec_deg , pmra , pmdec
Function that reads a par file.
Function that reads a par file .
"""
    Function that reads a par file. In particular, for the purposes of barycorr,
    it will return POSEPOCH, RAJ, DECJ, PMRA, and PMDEC.

    Step 1: Read par file line by line, where each line is stored as a string in the 'contents' array
    Step 2a: For PSRJ, RAJ, DECJ, PMRA, and PMDEC, those lines are teased out
    Step 2b: The corresponding strings are split up without whitespace
    Step 3: Extract the values accordingly

    parfile - path of the .par file
    """ #milliarcsec per year #milliarcsec per year #RA in HH:MM:SS to deg #DEC in HH:MM:SS to deg
parfile