Skip to content
Snippets Groups Projects
Commit 36f179f9 authored by Brandon Piotrzkowski's avatar Brandon Piotrzkowski Committed by Alexander Pace
Browse files

Parse CHIME FRB ID and duration; partially fixes #255

parent b75544db
No related branches found
No related tags found
1 merge request!230Parse CHIME FRB ID and duration; partially fixes #255
Pipeline #646494 passed
......@@ -740,13 +740,20 @@ def populateGrbEventFromVOEventFile(filename, event):
# Also grab parameters from embedded group if there, needed for SVOM
Svom_ident = vp.convenience.get_grouped_params(v).get('Svom_Identifiers')
Svom_detect = vp.convenience.get_grouped_params(v).get('Detection_Info')
Chime_observe = vp.convenience.get_grouped_params(v).get('observatory parameters')
Chime_event = vp.convenience.get_grouped_params(v).get('event parameters')
if Svom_ident is not None:
VOEvent_params.update(Svom_ident)
if Svom_detect is not None:
VOEvent_params.update(Svom_detect)
if Chime_observe is not None:
VOEvent_params.update(Chime_observe)
if Chime_event is not None:
VOEvent_params.update(Chime_event)
trig_dur_params = ["Trig_Dur", "Trans_Duration", "Data_Integ",
"Integ_Time", "Trig_Timescale", "Timescale"]
"Integ_Time", "Trig_Timescale", "Timescale",
"sampling_time"]
trigger_duration = None
for param in trig_dur_params:
if (param in VOEvent_params):
......@@ -763,7 +770,7 @@ def populateGrbEventFromVOEventFile(filename, event):
# try to find a trigger_id value
trigger_id = None
trigger_id_params = ['TrigID', 'Trans_Num', 'EventID',
'Burst_Id']
'Burst_Id', 'event_no']
for param in trigger_id_params:
if (param in VOEvent_params):
trigger_id = VOEvent_params.get(param).get('value')
......
from __future__ import unicode_literals
from django.db import migrations
# Creates UserObjectPermission objects which allow specific users
# to add events for pipelines. Based on current production database
# content (27 October 2017)
# List of pipeline names and lists of usernames who should
# be allowed to add events for them
PP_LIST = [
{
'pipeline': 'PyGRB',
'usernames': [
'brandon.piotrzkowski@ligo.org',
'emfollow',
]
},
{
'pipeline': 'CHIME',
'usernames': [
'brandon.piotrzkowski@ligo.org',
'emfollow',
]
},
]
def add_permissions(apps, schema_editor):
User = apps.get_model('auth', 'User')
Permission = apps.get_model('auth', 'Permission')
UserObjectPermission = apps.get_model('guardian', 'UserObjectPermission')
Pipeline = apps.get_model('events', 'Pipeline')
ContentType = apps.get_model('contenttypes', 'ContentType')
perm = Permission.objects.get(codename='populate_pipeline')
ctype = ContentType.objects.get_for_model(Pipeline)
for pp_dict in PP_LIST:
pipeline, created = Pipeline.objects.get_or_create(name=pp_dict['pipeline'])
# Loop over users
for username in pp_dict['usernames']:
# Robot users should have been already created by ligoauth 0003,
# but we have to create human user accounts here
user, _ = User.objects.get_or_create(username=username)
# Create UserObjectPermission
uop, uop_created = UserObjectPermission.objects.get_or_create(
user=user, permission=perm, content_type=ctype,
object_pk=pipeline.id)
def remove_permissions(apps, schema_editor):
pass
class Migration(migrations.Migration):
dependencies = [
('guardian', '0023_populate_aframe_uploaders'),
]
operations = [
migrations.RunPython(add_permissions, remove_permissions),
]
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