utils.dumpList (os.path.join (args.outdir, "SxS.corr"), correlations,
               lambda out, item: out.write ("{:%m/%d/%y} {:%m/%d/%y} {:.5f} ({:d}, {:d}, {:d})\n".format (item[0].datetime, item[1].datetime, item [2],
                                                                                        item[3][0],
                                                                                        item[3][1],
                                                                                        item[3][2])))

#remove rows with nonsense pc values
#leave them in and they'll be colored white
#correlations = [t for t in correlations if t[2] <= 1.0]

#make a matrix instead of a list so we can do a matrix plot of everything
corrMatrix = ambient.makeCorrelationMatrix (seeingDays, correlations)
pdfPages = PdfPages (os.path.join (args.outdir, "SxS.pdf"))

utils.plot2dArray (corrMatrix, pdfPages,
                  "self correlation of \"seeing\" at {}\n{:%m/%d/%Y} - {:%m/%d/%Y}".
                  format (os.path.basename (args.indir), seeingDays[0].datetime, seeingDays[-1].datetime),
                  "day", "day", "pearson coefficient")
pdfPages.close ()


#filter just pcs in the range we want
correlations = [t for t in correlations if t [2] >= args.start_pc and t [2] <= args.stop_pc]

#take subset of best (or worst) pcs
if args.best_count > 0 and args.best_count < len (correlations):
  correlations = correlations [0:args.best_count + 1]

#add a rank column
correlations = [(index, t[0], t[1], t[2]) for index, t in enumerate (correlations)]

예제 #2
0
    out.write ("{:%m/%d/%y} {:%m/%d/%y} {:.5f} \
    ({} {}) ({} {}))\n".format (day0.datetime,
                            day1.datetime,
                            c[2],
                            day0.firstGoodMeasurement[0],
                            day1.lastGoodMeasurement[0],
                            day1.firstGoodMeasurement[0],
                            day1.lastGoodMeasurement[0]))


utils.dumpList (os.path.join (args.outdir, "{}-{}.corr").format (args.indirs [0].name, args.indirs [1].name), correlations, writeCorr)

pdfPages = PdfPages (os.path.join (args.outdir, "seeing-{}x{}.pdf").format (args.indirs [0].name, args.indirs [1].name))
matrix = ambient.goodSquareCorrelate (seeing [0], seeing [1], args.min_points)
utils.plot2dArray (matrix, pdfPages,
                  "correlation of \"seeing\" {} &\n {}".format (args.indirs [0], args.indirs [1]),
                  "day", "day", "pearson coefficient")
pdfPages.close ()



# p1. plot days across X axis, and 5 sensors ‘X’ on Y axis, like pc-seeing+all.pdf., except color
#missing data points white to distinguish no data from zero correlation data
#make a 2d color plot of days on the x axis and sensors names on the Y axis and each
#grid point (x,y) is pc seeing vs y at day x

def plotSensorSeeingPC (which):
  days = seeing [which]
  allDays = allSeeing [which]
  siteRange = args.indirs [which]