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

  yTicks = []
  correlationsArray = []
  for p in ambient.parameterBasenames [1:]:
    otherDays = ambient.Days (os.path.join (siteRange.path, p + ".orig"), args.start_date, args.stop_date)
    otherDays.setGoodness (allDays)
    yTicks.append (p)
    dayList = ambient.dayListFromRange (otherDays, siteRange.startDate, siteRange.stopDate)
    correlations = ambient.goodCorrelate (days, dayList, args.min_points)
    correlationsArray.append (correlations)

  ambient.plotSensorSeeingPC (os.path.join (args.outdir, "pc-seeing+all-{}.pdf").format (siteRange.name),
                              correlationsArray, yTicks, days,
                              args.indirs [which].name)
  #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]

  return correlations

#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
yTicks = []
correlationsArray = []
for p in ambient.parameterBasenames [1:]:
  otherDays = ambient.Days (os.path.join (args.indir, p + ".orig"), args.start_date, args.stop_date, allSeeingDays)
  yTicks.append (p)
  correlations = ambient.crossCorrelate (seeingDays, otherDays.days, args.start_minutes*60, args.stop_minutes*60, args.past_midnight, args.min_points)
  correlationsArray.append (correlations)

ambient.plotSensorSeeingPC (os.path.join (args.outdir, "pc-seeing+all.pdf"), correlationsArray, yTicks, seeingDays, os.path.basename (args.indir))

#make histogram of seeing for all seconds of days and
#seeing for start/stop seconds of all days
pdfPages = PdfPages (os.path.join (args.outdir, "seeing.histogram.pdf"))
fig = plt.figure ()
ax = fig.add_subplot (1, 1, 1)

allSeeing = []
periodSeeing = []
for day in seeingDays:
  values = [m [1] for m in day.measurements]
  allSeeing.extend (values)

  func = day.periodFilter (args.start_minutes * 60, args.stop_minutes * 60, args.past_midnight)
  filtered = filter (func, day.measurements)