webanalysis package

webanalysis is the main package for TAPAS - included here is most of the code related to the website. The views module is the one most worth looking at as this is where all pages on the site are defined.

Submodules

webanalysis.forms module

class webanalysis.forms.ChangeEmailForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None)[source]

Bases: django.forms.models.ModelForm

ChangeEmailForm is a ModelForm used to change a users email. This uses the User class to change the email field. Only email is specified in fields, as we only want the user to be able to change their email with this form.

Parameters:email – The users email address
class Meta[source]

Bases: object

fields = ('email',)
model

alias of User

ChangeEmailForm.base_fields = OrderedDict([('email', <django.forms.fields.EmailField object>)])
ChangeEmailForm.declared_fields = OrderedDict()
ChangeEmailForm.media
class webanalysis.forms.ChangeInstForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]

Bases: django.forms.forms.Form

ChangeInstForm is used to change the institution that a user is a member of

Parameters:institution – The choice that the user selects from the dropdown of choices, provided by ‘institutions’
base_fields = OrderedDict([('institution', <django.forms.models.ModelChoiceField object>)])
declared_fields = OrderedDict([('institution', <django.forms.models.ModelChoiceField object>)])
media
class webanalysis.forms.ChooseUserForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]

Bases: django.forms.forms.Form

Select a user from all users on the system

Parameters:user – The user to select
base_fields = OrderedDict([('user', <django.forms.models.ModelChoiceField object>)])
declared_fields = OrderedDict([('user', <django.forms.models.ModelChoiceField object>)])
media
class webanalysis.forms.EditInstitutionForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None)[source]

Bases: django.forms.models.ModelForm

The EditInstitutionForm is used to edit institutions already added to the system.

class Meta[source]

Bases: object

fields = ('name', 'latitude', 'longitude', 'manager', 'description')
model

alias of Institution

widgets = {'description': <class 'django.forms.widgets.Textarea'>}
EditInstitutionForm.base_fields = OrderedDict([('name', <django.forms.fields.CharField object>), ('latitude', <django.forms.fields.FloatField object>), ('longitude', <django.forms.fields.FloatField object>), ('manager', <django.forms.models.ModelChoiceField object>), ('description', <django.forms.fields.CharField object>)])
EditInstitutionForm.declared_fields = OrderedDict()
EditInstitutionForm.media
class webanalysis.forms.EditProjectForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None)[source]

Bases: django.forms.models.ModelForm

The EditProjectForm is used to edit projects that already exist.

class Meta[source]

Bases: object

fields = ('name', 'manager', 'description', 'require_dsc', 'confidential_data', 'require_login')
model

alias of Project

EditProjectForm.base_fields = OrderedDict([('name', <django.forms.fields.CharField object>), ('manager', <django.forms.models.ModelChoiceField object>), ('description', <django.forms.fields.CharField object>), ('require_dsc', <django.forms.fields.BooleanField object>), ('confidential_data', <django.forms.fields.BooleanField object>), ('require_login', <django.forms.fields.BooleanField object>)])
EditProjectForm.declared_fields = OrderedDict()
EditProjectForm.media
class webanalysis.forms.EditUploadForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None)[source]

Bases: django.forms.models.ModelForm

The EditUploadForm is used to edit some of the attributes of an Upload, the form is created based on the fields specified.

Parameters:
  • name – The name of the upload
  • latitude – The latitude of where the capture for the upload was taken
  • longitude – The longitude of where the capture for the upload was taken
  • latitude_end – The end latitude of the capture, only used for ISS
  • longitude_end – The end longitude of the capture, only used for ISS
  • project – The project that the capture/upload is a part of
  • notes – Any notes the user has about the upload
class Meta[source]

Bases: object

fields = ('name', 'latitude', 'longitude', 'latitude_end', 'longitude_end', 'project', 'notes')
model

alias of Upload

EditUploadForm.base_fields = OrderedDict([('name', <django.forms.fields.CharField object>), ('latitude', <django.forms.fields.FloatField object>), ('longitude', <django.forms.fields.FloatField object>), ('latitude_end', <django.forms.fields.FloatField object>), ('longitude_end', <django.forms.fields.FloatField object>), ('project', <django.forms.models.ModelChoiceField object>), ('notes', <django.forms.fields.CharField object>)])
EditUploadForm.declared_fields = OrderedDict()
EditUploadForm.media
class webanalysis.forms.NewInstitutionForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]

Bases: django.forms.forms.Form

The InstitutionForm is used to add a new institution to the system

Parameters:
  • name – The name of the institution
  • latitude – The latitude of the institution
  • longitude – The longitude of the institution
  • manager – The manager of the institution
  • description – A short description of the institution
base_fields = OrderedDict([('name', <django.forms.fields.CharField object>), ('latitude', <django.forms.fields.FloatField object>), ('longitude', <django.forms.fields.FloatField object>), ('manager', <django.forms.models.ModelChoiceField object>), ('description', <django.forms.fields.CharField object>)])
declared_fields = OrderedDict([('name', <django.forms.fields.CharField object>), ('latitude', <django.forms.fields.FloatField object>), ('longitude', <django.forms.fields.FloatField object>), ('manager', <django.forms.models.ModelChoiceField object>), ('description', <django.forms.fields.CharField object>)])
media
class webanalysis.forms.NewProjectForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]

Bases: django.forms.forms.Form

The NewProjectForm is used to add a new project to the system.

Parameters:
  • name – The name of the project
  • manager – A user who can manage the project
  • description – A short description of the project
  • require_dsc – Whether the project requires DSC files or not
  • confidential_data – Whether uploads should be classified as confidential
  • require_login – Whether users need to be logged in to see uploads
base_fields = OrderedDict([('name', <django.forms.fields.CharField object>), ('manager', <django.forms.models.ModelChoiceField object>), ('description', <django.forms.fields.CharField object>), ('require_dsc', <django.forms.fields.BooleanField object>), ('confidential_data', <django.forms.fields.BooleanField object>), ('require_login', <django.forms.fields.BooleanField object>)])
declared_fields = OrderedDict([('name', <django.forms.fields.CharField object>), ('manager', <django.forms.models.ModelChoiceField object>), ('description', <django.forms.fields.CharField object>), ('require_dsc', <django.forms.fields.BooleanField object>), ('confidential_data', <django.forms.fields.BooleanField object>), ('require_login', <django.forms.fields.BooleanField object>)])
media
class webanalysis.forms.PermissionsForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None)[source]

Bases: django.forms.models.ModelForm

The PermissionsForm is used to edit the permissions of a user.

Parameters:
  • verified – Whether the user has chosen their institution or not
  • can_upload – Whether the user is allowed to upload files or not
  • api_can_write_lucid – Whether the user has permission to write data on the LUCID API
class Meta[source]

Bases: object

fields = ('verified', 'can_upload', 'api_can_write_lucid')
model

alias of UserProfile

PermissionsForm.base_fields = OrderedDict([('verified', <django.forms.fields.BooleanField object>), ('can_upload', <django.forms.fields.BooleanField object>), ('api_can_write_lucid', <django.forms.fields.BooleanField object>)])
PermissionsForm.declared_fields = OrderedDict()
PermissionsForm.media
class webanalysis.forms.UploadForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None)[source]

Bases: django.forms.forms.Form

The UploadForm is used to generate a form for the user to enter a data for an upload

Parameters:
  • name – The name of the upload
  • project – Using PROJECT_CHOICES (see Upload model) the project that the upload is a part of
  • latitude – The latiude of the detector when the capture was made (not required)
  • longitude – The longitude of the detector when the capture was made (not required)
  • latitude_end – The final latitude of the detector when the capture was made (ISS only)
  • longitude_end – The final longitude of the detector when the capture was made (ISS only)
  • notes – Any notes the user enters about the upload (not required)
base_fields = OrderedDict([('name', <django.forms.fields.CharField object>), ('project', <django.forms.models.ModelChoiceField object>), ('latitude', <django.forms.fields.FloatField object>), ('longitude', <django.forms.fields.FloatField object>), ('latitude_end', <django.forms.fields.FloatField object>), ('longitude_end', <django.forms.fields.FloatField object>), ('notes', <django.forms.fields.CharField object>)])
declared_fields = OrderedDict([('name', <django.forms.fields.CharField object>), ('project', <django.forms.models.ModelChoiceField object>), ('latitude', <django.forms.fields.FloatField object>), ('longitude', <django.forms.fields.FloatField object>), ('latitude_end', <django.forms.fields.FloatField object>), ('longitude_end', <django.forms.fields.FloatField object>), ('notes', <django.forms.fields.CharField object>)])
media
class webanalysis.forms.WarningMessageForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None)[source]

Bases: django.forms.models.ModelForm

The WarningMessageForm is used to edit the warning message.

Parameters:
  • global_message – The global warning message
  • global_message_enabled – Check whether the message is actually enabled or not
class Meta[source]

Bases: object

fields = ('global_message', 'global_message_enabled')
model

alias of Settings

WarningMessageForm.base_fields = OrderedDict([('global_message', <django.forms.fields.CharField object>), ('global_message_enabled', <django.forms.fields.BooleanField object>)])
WarningMessageForm.declared_fields = OrderedDict()
WarningMessageForm.media

webanalysis.models module

class webanalysis.models.Frame(*args, **kwargs)[source]

Bases: django.db.models.base.Model

The Frame model contains information about a frame that is part of an upload.

Parameters:
  • name – The name of the frame - at the moment the same name as the upload
  • upload_id – A foreign key link to the upload associated with the frame
  • detector – The detector ID that was used to capture the frame
  • capture_time – The UNIX timestamp of when the frame was captured
  • file_location – The location relative to the OUTPUT_DIRECTORY (see settings) where the XYC file is stored
  • dsc_location – The location relative to the OUTPUT_DIRECTORY (see settings) where the DSC file is stored
  • project – The project that the frame is associated with (see PROJECT_CHOICES)
  • alpha – The total of alpha particles detected in the frame
  • beta – The total of beta particles detected in the frame
  • gamma – The total of gamma rays detected in the frame
  • proton – The total of protons detected in the frame
  • muon – The total of muons detected in the frame
  • other – The total of unknown/other unclassifyable particles in the frame
  • processed – Boolean for whether the frame has been processed or not
  • flagged – Boolean whether the frame has been flagged (eg for being unprocessable) or not
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Frame.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Frame.alpha

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Frame.beta

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Frame.capture_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Frame.detector

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Frame.dsc_location

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Frame.file_location

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Frame.flagged

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Frame.gamma

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Frame.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Frame.muon

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Frame.name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Frame.objects = <django.db.models.manager.Manager object>
Frame.other

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Frame.processed

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Frame.project

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Frame.project_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Frame.proton

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Frame.upload_id

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Frame.upload_id_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class webanalysis.models.Institution(*args, **kwargs)[source]

Bases: django.db.models.base.Model

The Institution model is used as a representation for an institution.

Parameters:
  • name – Name of the institution
  • latitude – Latitude of institution
  • longitude – Longitude of institution
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Institution.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Institution.description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Institution.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Institution.latitude

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Institution.longitude

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Institution.manager

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Institution.manager_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Institution.name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Institution.objects = <django.db.models.manager.Manager object>
Institution.userprofile_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class webanalysis.models.LUCIDFile(*args, **kwargs)[source]

Bases: django.db.models.base.Model

The LUCIDFile model is used for every single file generated by LUCID that has been analysed. Similar to an Upload, but relevant to LUCID. Content will be created by the analysis program.

Parameters:
  • id – An integer primary key ID of the file
  • run – Foreign key link to the run that the file was generated in
  • start_time – UNIX timestamp of the time the capture started for this file
  • end_time – UNIX timestamp of the time the capture ended for this file
  • config – The ID of the config that was used to generate the data in this file
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception LUCIDFile.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

LUCIDFile.config

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

LUCIDFile.end_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

LUCIDFile.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

LUCIDFile.lucidframe_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

LUCIDFile.objects = <django.db.models.manager.Manager object>
LUCIDFile.run

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

LUCIDFile.run_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

LUCIDFile.start_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class webanalysis.models.LUCIDFrame(*args, **kwargs)[source]

Bases: django.db.models.base.Model

The LUCIDFrame model describes a frame that was captured by LUCID - very similar to the Frame model, but linked to a LUCIDFile rather than an Upload.

Parameters:
  • file – The foreign key link to the LUCIDFile that the frame is a part of
  • capture_time – UNIX timestamp of when the frame was taken
  • latitude – Latitude of LUCID at the time of capture
  • longitude – Longitude of LUCID at the time of capture
  • detector – Either 0,1,2,3,4 - which detector took the frame
  • alpha – The total of alpha particles detected in the frame
  • beta – The total of beta particles detected in the frame
  • gamma – The total of gamma rays detected in the frame
  • proton – The total of protons detected in the frame
  • muon – The total of muons detected in the frame
  • other – The total of unknown/other unclassifyable particles in the frame
  • processed – Boolean for whether the frame has been processed or not
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception LUCIDFrame.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

LUCIDFrame.alpha

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

LUCIDFrame.beta

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

LUCIDFrame.capture_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

LUCIDFrame.detector

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

LUCIDFrame.file

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

LUCIDFrame.file_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

LUCIDFrame.gamma

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

LUCIDFrame.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

LUCIDFrame.latitude

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

LUCIDFrame.longitude

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

LUCIDFrame.muon

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

LUCIDFrame.objects = <django.db.models.manager.Manager object>
LUCIDFrame.other

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

LUCIDFrame.processed

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

LUCIDFrame.proton

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class webanalysis.models.LUCIDRun(*args, **kwargs)[source]

Bases: django.db.models.base.Model

The LUCIDRun model describes a run if the LUCID payload. Content will be created by the analysis program.

Parameters:
  • id – An integer primary key ID (set by the application) of the run (SSTL created)
  • run_start – A ISO date of when the run started (2016-01-01)
  • ptr – A reference to the file name of the PTR fiel that was used for this run
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception LUCIDRun.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

LUCIDRun.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

LUCIDRun.lucidfile_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

LUCIDRun.objects = <django.db.models.manager.Manager object>
LUCIDRun.ptr

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

LUCIDRun.run_start

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class webanalysis.models.Project(*args, **kwargs)[source]

Bases: django.db.models.base.Model

The Project model is used as a representation of a project (classification of data uploaded).

Parameters:
  • name – The name of the project
  • manager – The user who is in charge of the project
  • description – A short description of what the project is
  • image_location – The location on the fileysystem where the logo for the project is
  • require_dsc – A flag to require DSC files to be uploaded if the project is selected
  • confidential_data – If set, any uploads made via this project will not be publicly accessible
  • require_login – Require users to be logged in to view uploads - effectively the same as confidential_data but will have a different warning message.
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Project.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Project.confidential_data

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Project.description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Project.frame_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Project.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Project.image_location

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Project.manager

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Project.manager_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Project.name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Project.objects = <django.db.models.manager.Manager object>
Project.require_dsc

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Project.require_login

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Project.upload_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

class webanalysis.models.Settings(*args, **kwargs)[source]

Bases: django.db.models.base.Model

The Settings model is for administrators of the site to control specific functions that are necessary to run the web platform. These can be set via the (non-django) admin panel.

Parameters:global_message – A global message shown to all logged in and logged out users on the front page.
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Settings.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Settings.global_message

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Settings.global_message_enabled

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Settings.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Settings.objects = <django.db.models.manager.Manager object>
class webanalysis.models.Upload(*args, **kwargs)[source]

Bases: django.db.models.base.Model

The Upload model stores information about an upload that a user has made to the system

Parameters:
  • PROJECT_CHOICES – Possible projects to choose from when uploading
  • name – The name that the user provides of the upload
  • uploaded_by – Foreign Key link to the user that uploaded the dataset
  • uploaded_time – UNIX timestamp of when the upload was made
  • latitude – The latitude of the upload, should the user enter it
  • longitude – The longitude of the upload, should the user enter it
  • latitude_end – Used for ISS data - end latitude of the capture
  • longitude_end – Used for ISS data - end longitude of the capture
  • project – Using PROJECT_CHOICES, the project that the upload belongs to
  • notes – Any notes the user enters about the upload
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Upload.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Upload.frame_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Upload.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Upload.latitude

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Upload.latitude_end

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Upload.longitude

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Upload.longitude_end

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Upload.name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Upload.notes

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Upload.objects = <django.db.models.manager.Manager object>
Upload.project

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Upload.project_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Upload.uploaded_by

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Upload.uploaded_by_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Upload.uploaded_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class webanalysis.models.UserProfile(*args, **kwargs)[source]

Bases: django.db.models.base.Model

The UserProfile model allows you to add extra attributes to a user, as it is not possible to directly edit the user model to add more attributes

Parameters:
  • user – Foreign Key link to the actual User
  • institution – Foreign Key link to the institution the user is a part of
  • verified – Boolean for if the user has chosen an institution
  • can_upload – Boolean used to check if a user is allowed to upload files
  • can_edit_institutions – Boolean to check if a user is allowed to edit institutions
  • can_edit_permissions – Boolean to check whether a user is allowed to edit permissions
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception UserProfile.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

UserProfile.api_can_write_lucid

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

UserProfile.can_edit_institutions

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

UserProfile.can_edit_permissions

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

UserProfile.can_upload

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

UserProfile.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

UserProfile.institution

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

UserProfile.institution_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

UserProfile.objects = <django.db.models.manager.Manager object>
UserProfile.user

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

UserProfile.user_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

UserProfile.verified

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

webanalysis.views module

webanalysis.views.about(request)[source]

A static view that returns the about page of the website

webanalysis.views.accounts_email_change(request)[source]

This view allows the user to update their email address. Login is required to access.

webanalysis.views.accounts_generate_authtoken(request)[source]

Generate an API Key/AuthToken for a user if one does not already exist

webanalysis.views.accounts_institution_change(request)[source]

This view allows the user to update their institution. Login is required to access.

webanalysis.views.accounts_verify(request)[source]

This view lets a user ‘verify’ their account by setting their institution. This view is required to make sure that the users institution is known when they upload data and use the site. The user must have logged in and not already set their institution.

Parameters:request
Returns:Will show a page with an institution dropdown
webanalysis.views.download_csv_frames(request, upload_id)[source]

This view provides the functionality for a user to download the entire analysis results for an upload, giving them the particle counts per frame in a long CSV file. Information contained includes: ‘Frame ID’, ‘Frame Name’, ‘Capture Timestamp’, ‘Alpha’, ‘Beta’, ‘Gamma’, ‘Proton’, ‘Muon’, ‘Unknown’

Parameters:
  • request
  • upload_id – An integer primary key of the upload that the user wants to download results for
Returns:

A CSV file containing analysis results per frame

webanalysis.views.download_csv_frames_lucid(request, dl_type, id)[source]

This view allows a user to download a list of frames, with their associated analysis results. They can either download a list of frames for a run, or a list of frames for a file. Inlcuded in the CSV is not just results but also a large amount of metadata including location, times of runs, captures etc. and references to files & runs.

Parameters:
  • request
  • dl_type – The type of CSV they would like to download - either ‘run’ for a CSV of frames in a run or ‘file’

for a list of frames in a file. :param id: The integer primary key ID of the file or run they would like to download a CSV of frames for. :return: A CSV file with frame analysis results, or a 404 if they did not enter a correct ID or a correct ‘dl_type’.

webanalysis.views.download_csv_totals(request)[source]

This function creates total counts for every single upload on the system (excluding LUCID data) and presents them to the user in a CSV file that they are able to download. Information contained includes: ‘Upload ID’, ‘Upload Name’, ‘Latitude’, ‘Longitude’, ‘Alpha’, ‘Beta’, ‘Gamma’, ‘Proton’, ‘Muon’, ‘Unknown’

Parameters:request
Returns:A CSV file containing total particle counts on a per upload basis
webanalysis.views.download_csv_totals_lucid(request, id)[source]

This view allows a user to download the total counts for a all frames relating to either all files, or a specific run (which will contain a set of files, which in turn has a set of frames to be totaled). A CSV is generated containing a row for every file and its totals, and other metadata such as run and start & end time.

Parameters:
  • request
  • id – Either ‘all’ or an ID of a specific run to download the totals for a set of files for.
Returns:

A CSV file with the totals for the files and other metadata, or a 404 if the ID is invalid.

webanalysis.views.download_zip(request, upload_id)[source]

Allows the user to download a zip file of all the data in a specified upload I’ve decided to do this dynamically to save some space on the server (as not everyone will want to download the original data for every single upload). This also retains backwards compatibility for uploads where no zip file has been originally saved.

Parameters:
  • request
  • upload_id – An integer primary key of the upload the user wants to generate and download a ZIP file for.
Returns:

The ZIP file of the data, or a 404 if the upload_id is invalid.

webanalysis.views.main(request)[source]

A static view that returns the main page of the website

webanalysis.views.panel(request)[source]

The TAPAS administrator panel, used to manage settings, projects & institutions on the site

Parameters:request
Returns:Admin panel page
webanalysis.views.panel_addinstitution(request)[source]

This view has a limited scope for administrators only to add a new institution to TAPAS using a form.

Parameters:request
Returns:Either a form to add the institution or a form and messages with error or success depending on the user

input.

webanalysis.views.panel_addproject(request)[source]

This view lets an admin add a new project to the system.

Parameters:request
Returns:Either a form to add the project or a form and messages with error or success depending on the user

input.

webanalysis.views.panel_editinstitution(request, id)[source]

This view lets an admin/project manager edit an institution

Parameters:
  • request
  • id – Institution ID
Returns:

Either a form to edit the institution or a form and messages with error or success depending on the user

input.

webanalysis.views.panel_editpermissions(request, user_id)[source]

Edit the permissions of a specific user

Parameters:
  • request
  • user_id
Returns:

webanalysis.views.panel_editproject(request, id)[source]

This view lets an admin/project manager edit a project.

Parameters:
  • request
  • id – Project ID
Returns:

Either a form to edit the project or a form and messages with error or success depending on the user

input.

webanalysis.views.panel_warningmessage(request)[source]

This view lets an admin add a new project to the system.

Parameters:request
Returns:Either a form to add the project or a form and messages with error or success depending on the user

input.

webanalysis.views.upload(request)[source]

Where the magic happens - this is where the user will upload their data The upload_handler is in a separate file to save space here, making things neater.

Parameters:request
Returns:Dependent on the content that the user has uploaded - either an error or success page
webanalysis.views.upload_complete(request)[source]

A static view showing a success page to the user when they have uploaded a file

webanalysis.views.upload_edit(request, id)[source]

Allows a user to edit the contents of some fields pertaining to the upload that they have made previously

Parameters:
  • request
  • id – The integer primary key of the upload
Returns:

The fields to be edited, rendered. Or a 404/permission denied if the id was incorrect

webanalysis.views.view(request)[source]

A static view to show a page with links, taking the user to different pages to view different things on the TAPAS system.

webanalysis.views.view_frame(request, id)[source]

This view allows the user to view a single frame that has been uploaded, and view specific information about it such as the particles detected just for that frame.

TODO: extend this function to show metadata or images

Parameters:
  • request
  • id – The integer primary key of a single frame to be viewed
Returns:

Shows a rendered page of information about the frame

webanalysis.views.view_frame_image(request, id)[source]

This view outputs a PNG image of a frame, that is generated each time using its XYC file, using lucid-utils xycreader and frameplot functions. It creates a NumPy array based on the XYC and then passes this to the frame plotter, in RGB rather than BW (black & white). If there are any performance issues, this function could be the problem. It’s not very efficient - no caching on disk takes place. It has been done this way because it retains some backwards compatability with uploaded files, and it doesn’t require lots of images to be generated that might never be viewed. For now I’ve decided this is a worthwhile tradeoff - but please change this if there is a problem!

Parameters:
  • request
  • id – The integer primary key ID of the frame to generate an image of
Returns:

The PNG image of the frame - or a 404 page (rather than image) if the frame does not exist

webanalysis.views.view_institution(request, id)[source]

View information on an institution.

Parameters:
  • request
  • id – Institution ID
Returns:

Information on project

webanalysis.views.view_lucid_file(request, file_id)[source]

This view is used to looking at information that is relevant to a single LUCID file. This view is similar to that of viewing a single upload, but contains more information specific to LUCID and it’s class layout in TAPAS.

Parameters:
  • request
  • file_id – The integer primary key of the ID of the file
Returns:

Rendered page of file information (eg counts) or 404 depending on ID

webanalysis.views.view_lucid_run(request, run_id)[source]

This view is used to list files that are part of a LUCID run, based on a foreign key relationship to the Run ID.

Parameters:
  • request
  • run_id – The integer primary key of the run that the user wants to view files for
Returns:

A list of files relating to the run the user requested, or a 404 for an invalid ID

webanalysis.views.view_lucid_run_all(request)[source]

This view simply lists all the runs that are in the database, allowing the user to see which runs have been analysed and to click through to specific pages to view more information.

Parameters:request
Returns:Rendered page of runs
webanalysis.views.view_project(request, id)[source]

View information on a specific project.

Parameters:
  • request
  • id – Project ID
Returns:

Information on project

webanalysis.views.view_upload(request, id)[source]

This view lists a variety of information about an upload, such as metadata, particle counts (totals) and a map (if latitude and longitude were specified in the upload process)

Parameters:
  • request
  • id – The integer primary key of the upload
Returns:

The rendered page of the upload information (or a 404 if id was incorrect)

webanalysis.views.view_upload_all(request)[source]

This view shows a list of all the uploads that have been made on the system, by any user and for any project - except LUCID, which uses a different system. Each upload can be clicked on to take the user to more detailed information. There are a maximum of 50 uploads on a page, set using pagination.

Parameters:request
Returns:List of uploads on the system rendered in a page
webanalysis.views.view_upload_by_project(request, project_id)[source]

This view is extremely similar to viewing all uploads, but it filters by project.

Parameters:request
Returns:List of uploads on the system rendered in a page
webanalysis.views.view_upload_framelist(request, id)[source]

Produces a paginated list of frames to the user for a specific upload - 50 frames to a page. Each frame can be clicked on to produce more information on it.

Parameters:
  • request
  • id – The integer primary key of the upload that the user is trying to view the framelist of
Returns:

The list of frames, or a 404 if the id is incorrect

webanalysis.views.view_user(request, user_id)[source]

A page that shows information about an individual user such as username and their institution. The page also shows a list of all the uploads that the user has made, which can be clicked on, taking you to the upload information page.

Parameters:
  • request
  • user_id – The ID of the user to be viewed (not the username as previous, as some usernames could not be valid

URLs :return: Rendered page of user information, or 404 if the username was incorrect

webanalysis.views.view_user_all(request)[source]

Outputs a list of all the users on the system, using pagination with 50 to a page.

webanalysis.search_indexes module

class webanalysis.search_indexes.UploadIndex[source]

Bases: haystack.indexes.SearchIndex, haystack.constants.Indexable

fields = {'project': <haystack.fields.CharField object>, 'text': <haystack.fields.CharField object>, 'uploaded_by': <haystack.fields.CharField object>}
get_model()[source]
objects = <haystack.manager.SearchIndexManager object>
project = <haystack.fields.CharField object>
text = <haystack.fields.CharField object>
uploaded_by = <haystack.fields.CharField object>