Example #1
0
def read_spd_file(spdfn):
    """Return a SPCandidate object for the spd given.

        Input:
            spdfn: *.spd file name.

        Output:
            cand: Candidate object constructed from the given pfd
                file name.
    """
    spd = sp_utils.spd(spdfn)
    cand = SPCandidate(spd.best_dm, spd.ra_deg, spd.dec_deg, spdfn)
    return cand
Example #2
0
    def _compute_data(self, cand):
        """Create an sp_utils.spd object for the candidate's 
            *.spd file

            Input:
                cand: A ratings2.0 SPCandidate object.

            Output:
                spd: The corresponding sp_utils.spd object.
        """
        spdfn = cand.info['spdfn']
        spd = sp_utils.spd(spdfn)
        return spd
Example #3
0
def read_spd(spd_file, tar = None):
    """ 
       Reads in all the .spd and the .singlepulse.tgz info that can reproduce the sp plots.
       Inputs: spd_file: .spd file
               .singlepulse.tgz: if not supplied, it will only output .spd info. 
                                 Default: not supplied. 
       Output: An object that has all the relevant information to remake the plot. 
    """
    sp = sp_utils.spd(spd_file)
    if tar is not None:
        dmVt_dms, dmVt_times, dmVt_sigmas, dmVt_files = gen_arrays(sp.dmVt_this_dms, 5, sp.spfiles, tar)
        sp.dmVt_dms = dmVt_dms
        sp.dmVt_times = dmVt_times
        sp.dmVt_sigmas = dmVt_sigmas
        return sp
    else:
        return sp 
Example #4
0
def read_spd(spd_file, tar=None):
    """ 
       Reads in all the .spd and the .singlepulse.tgz info that can reproduce the sp plots.
       Inputs: spd_file: .spd file
               .singlepulse.tgz: if not supplied, it will only output .spd info. 
                                 Default: not supplied. 
       Output: An object that has all the relevant information to remake the plot. 
    """
    sp = sp_utils.spd(spd_file)
    if tar is not None:
        dmVt_dms, dmVt_times, dmVt_sigmas, dmVt_files = gen_arrays(
            sp.dmVt_this_dms, 5, sp.spfiles, tar)
        sp.dmVt_dms = dmVt_dms
        sp.dmVt_times = dmVt_times
        sp.dmVt_sigmas = dmVt_sigmas
        return sp
    else:
        return sp
Example #5
0
def main():
    spdfn = sys.argv[1]

    spd = sp_utils.spd(spdfn)

    cand = candidate.SPCandidate(spd.best_dm, \
                        spd.ra_deg, spd.dec_deg, \
                        spdfn)

    print "Loaded %s" % cand.spdfn
    print "-" * 20
    print "    Best DM (cm^-3/pc): %f" % cand.dm
    print "    RA (J2000 - deg): %f" % cand.raj_deg
    print "    Dec (J2000 - deg): %f" % cand.decj_deg

    gauss.add_data(cand)

    print "-" * 20
    fit_and_plot(cand, spd)
Example #6
0
def main():
    spdfn = sys.argv[1]

    spd = sp_utils.spd(spdfn)

    cand = candidate.SPCandidate(spd.best_dm, \
                        spd.ra_deg, spd.dec_deg, \
                        spdfn)

    print "Loaded %s" % cand.spdfn
    print "-"*20
    print "    Best DM (cm^-3/pc): %f" % cand.dm
    print "    RA (J2000 - deg): %f" % cand.raj_deg
    print "    Dec (J2000 - deg): %f" % cand.decj_deg

    gauss.add_data(cand)

    print "-"*20
    fit_and_plot(cand, spd)