MJD = hdr_data[1].strip("\n").replace(".", "_") MJDfloat = hdr_data[1].strip("\n") if (len(MJD) - MJD.index("_") - 1) > 4: #check to see if the MJD has more than 4 decimal places MJD = MJD[:MJD.index("_") + 5] #reduce the MJD to 4 decimal places base_name = source_name + "_" + MJD outdir = outdir + "/" + base_name print "Output will go to %s" % (outdir) if (os.path.isdir(base_name) is not True): os.system("mkdir %s" % (base_name)) basedir = os.getcwd() + "/" + base_name os.system("mv %s.hdr %s/" % (fname, basedir)) os.chdir(basedir) if (dorfi is True): kill_chans, kill_chan_range, kill_time_range, mask_file = rfi( fil_file, time, timesig, freqsig, chanfrac, intfrac, max_percent, mask, sp) else: kill_chans = [] kill_chan_range = [] kill_time_range = [] mask_file = "" if (nosearch is not True): # IF running heimdall then remove old candidates os.system("rm %s/*.cand" % (outdir)) if (nogpu is not True): heimdall_run(fil_file, lodm, hidm, outdir, boxcar_max, dorfi, kill_chan_range) #os.system("mv %s.* %s" % (base_name,base_name)) #if(os.path.isfile("*.cand") is True): if filter(os.path.isfile, glob.glob("*.cand")):
#print fname,hdr_file_name os.system( "header {0} -source_name -tstart -tsamp -nchans > {1}.hdr".format( fil_file, fname)) hdr_file = open(hdr_file_name, "r") hdr_data = hdr_file.readlines() source_name = hdr_data[0].strip("\n") source_name = source_name.replace(" ", "_") #source_name = "fake" #print source_name MJD = hdr_data[1].strip("\n").replace(".", "_") if (len(MJD) - MJD.index("_") - 1) > 4: #check to see if the MJD has more than 4 decimal places MJD = MJD[:MJD.index("_") + 5] #reduce the MJD to 4 decimal places base_name = source_name + "_" + MJD print base_name if (os.path.isdir(base_name) is not True): os.system("mkdir %s" % (base_name)) if (dorfi is True): rfi(fil_file, time, timesig, freqsig, chanfrac, intfrac, max_percent, mask, sp) if (nosearch is not True): # IF running heimdall then remove old candidates os.system("rm %s/*.cand" % (base_name)) heimdall_run(fil_file, lodm, hidm, base_name, boxcar_max) os.system("mv %s.* %s" % (base_name, base_name)) basedir = os.getcwd() + "/" + base_name candplots(basedir, fil_file, source_name, snr_cut, filter_cut, maxCandSec, noplot, maxMem)