Skip to content
Snippets Groups Projects
Commit 08077fdb authored by Branson Craig Stephens's avatar Branson Craig Stephens
Browse files

Fixed make_histogram command so that you get one histogram per pipeline,...

Fixed make_histogram command so that you get one histogram per pipeline, instead of one histogram per analysisType. This will mix HighMass and LowMass events, so we may want to split on search, where search is available. But I don't think it's that criticial since we aren't using these histograms much.
parent 2b67a890
No related branches found
No related tags found
No related merge requests found
...@@ -10,7 +10,7 @@ matplotlib.use("Agg") ...@@ -10,7 +10,7 @@ matplotlib.use("Agg")
import matplotlib.pyplot as pyplot import matplotlib.pyplot as pyplot
import numpy import numpy
from gracedb.models import Event from gracedb.models import Event, Pipeline
import os import os
from datetime import datetime, timedelta from datetime import datetime, timedelta
...@@ -40,13 +40,15 @@ class Command(NoArgsCommand): ...@@ -40,13 +40,15 @@ class Command(NoArgsCommand):
annotations = {} annotations = {}
# Make the histograms, save as png's. # Make the histograms, save as png's.
for atype, atype_name in Event.ANALYSIS_TYPE_CHOICES: for pipeline in Pipeline.objects.all():
annotations[atype] = {} # for atype, atype_name in Event.ANALYSIS_TYPE_CHOICES:
pname = pipeline.name
annotations[pname] = {}
for start_time, time_range in time_ranges: for start_time, time_range in time_ranges:
note = {} note = {}
fname = os.path.join(DEST_DIR, "%s-%s.png" % (atype, time_range)) fname = os.path.join(DEST_DIR, "%s-%s.png" % (pname, time_range))
note['fname'] = fname note['fname'] = fname
data = Event.objects.filter(analysisType=atype, data = Event.objects.filter(pipeline=pipeline,
created__range=[start_time, now], created__range=[start_time, now],
gpstime__gt=0) \ gpstime__gt=0) \
.exclude(group__name="Test") .exclude(group__name="Test")
...@@ -62,8 +64,8 @@ class Command(NoArgsCommand): ...@@ -62,8 +64,8 @@ class Command(NoArgsCommand):
except OSError: except OSError:
pass pass
else: else:
makePlot(data, atype, maxx=MAX_X).savefig(fname) makePlot(data, pname, maxx=MAX_X).savefig(fname)
annotations[atype][time_range] = note annotations[pname][time_range] = note
writeIndex(annotations, WEB_PAGE_FILE_PATH) writeIndex(annotations, WEB_PAGE_FILE_PATH)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment