List of models

These models generally correspond one-to-one with tables in the database.

Coordinate transforms

class misc.models.OrderedUser(id, password, last_login, is_superuser, username, first_name, last_name, email, is_staff, is_active, date_joined)[source]

Bases: django.contrib.auth.models.User

Parameters:
  • id (AutoField) – Id
  • password (CharField) – Password
  • last_login (DateTimeField) – Last login
  • is_superuser (BooleanField) – Designates that this user has all permissions without explicitly assigning them.
  • username (CharField) – Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.
  • first_name (CharField) – First name
  • last_name (CharField) – Last name
  • email (EmailField) – Email address
  • is_staff (BooleanField) – Designates whether the user can log into this admin site.
  • is_active (BooleanField) – Designates whether this user should be treated as active. Unselect this instead of deleting accounts.
  • date_joined (DateTimeField) – Date joined
  • groups (ManyToManyField to Group) – The groups this user belongs to. A user will get all permissions granted to each of their groups.
  • user_permissions (ManyToManyField to Permission) – Specific permissions for this user.
class misc.models.Note(id, json, user, date_time, text, content_type, object_id)[source]

Bases: alyx.base.BaseModel

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • user_id (ForeignKey to OrderedUser) – User
  • date_time (DateTimeField) – Date time
  • text (TextField) – Text
  • content_type_id (ForeignKey to ContentType) – Content type
  • object_id (UUIDField) – Object id
class misc.models.BrainLocation(*args, **kwargs)[source]

Bases: alyx.base.BaseModel

Gives a brain location in stereotaxic coordinates, plus other information about location.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • name (CharField) – Name
  • stereotaxic_coordinates (ArrayField) – Stereotaxic coordinates
  • description (TextField) – Description
  • allen_location_ontology (CharField) – Allen location ontology
class misc.models.CoordinateTransformation(*args, **kwargs)[source]

Bases: alyx.base.BaseModel

This defines how to convert from a local coordinate system (e.g. of a silicon probe) to stereotaxic coordinates. It is an affine transformation: stereotaxic_coordinates = origin + transformation_matrix*local_coordinates. The decription and allen_location_ontology apply to the coordinate origin (e.g. electrode tip).

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • name (CharField) – Name
  • description (TextField) – Description
  • allen_location_ontology (CharField) – Allen location ontology
  • origin (ArrayField) – Origin
  • transformation_matrix (ArrayField) – Transformation matrix

Subjects

class subjects.models.Subject(*args, **kwargs)[source]

Bases: alyx.base.BaseModel

Metadata about an experimental subject (animal or human).

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • nickname (CharField) – Easy-to-remember, unique name (e.g. ‘Hercules’).
  • species_id (ForeignKey to Species) – Species
  • litter_id (ForeignKey to Litter) – Litter
  • sex (CharField with choices: ((‘M’, ‘Male’), (‘F’, ‘Female’), (‘U’, ‘Unknown’))) – Sex
  • strain_id (ForeignKey to Strain) – Strain
  • source_id (ForeignKey to Source) – Source
  • line_id (ForeignKey to Line) – Line
  • birth_date (DateField) – Birth date
  • death_date (DateField) – Death date
  • wean_date (DateField) – Wean date
  • genotype_date (DateField) – Genotype date
  • responsible_user_id (ForeignKey to OrderedUser) – Who has primary or legal responsibility for the subject.
  • lamis_cage (IntegerField) – Lamis cage
  • request_id (ForeignKey to SubjectRequest) – Request
  • implant_weight (FloatField) – Implant weight in grams
  • ear_mark (CharField) – Ear mark
  • protocol_number (CharField with choices: ((‘1’, ‘1’), (‘2’, ‘2’), (‘3’, ‘3’), (‘4’, ‘4’))) – Protocol number
  • description (TextField) – Description
  • cull_method (TextField) – Cull method
  • adverse_effects (TextField) – Adverse effects
  • actual_severity (IntegerField with choices: ((None, ‘’), (1, ‘Sub-threshold’), (2, ‘Mild’), (3, ‘Moderate’), (4, ‘Severe’), (5, ‘Non-recovery’))) – Actual severity
  • to_be_genotyped (BooleanField) – To be genotyped
  • to_be_culled (BooleanField) – To be culled
  • reduced (BooleanField) – Reduced
  • reduced_date (DateField) – Reduced date
  • genotype (ManyToManyField to Allele) – Genotype
  • genotype_test (ManyToManyField to Sequence) – Genotype test
class subjects.models.SubjectRequest(id, json, user, line, count, date_time, due_date, description)[source]

Bases: alyx.base.BaseModel

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • user_id (ForeignKey to OrderedUser) – Who requested this subject.
  • line_id (ForeignKey to Line) – Line
  • count (IntegerField) – Count
  • date_time (DateField) – Date time
  • due_date (DateField) – Due date
  • description (TextField) – Description
subjects.models.send_subject_request_mail_new(sender, instance=None, **kwargs)[source]

Send en email when a subject request is created.

subjects.models.send_subject_request_mail_change(sender, instance=None, **kwargs)[source]

Send en email when a subject’s request changes.

subjects.models.send_subject_responsible_user_mail_change(sender, instance=None, **kwargs)[source]

Send en email when a subject’s responsible user changes.

class subjects.models.Litter(*args, **kwargs)[source]

Bases: alyx.base.BaseModel

A litter, containing a mother, father, and children with a shared date of birth.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • descriptive_name (CharField) – Descriptive name
  • line_id (ForeignKey to Line) – Line
  • breeding_pair_id (ForeignKey to BreedingPair) – Breeding pair
  • description (TextField) – Description
  • birth_date (DateField) – Birth date
class subjects.models.BreedingPair(id, json, name, line, start_date, end_date, father, mother1, mother2, description)[source]

Bases: alyx.base.BaseModel

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • name (CharField) – Leave to “-” to autofill.
  • line_id (ForeignKey to Line) – Line
  • start_date (DateField) – Start date
  • end_date (DateField) – End date
  • father_id (ForeignKey to Subject) – Father
  • mother1_id (ForeignKey to Subject) – Mother1
  • mother2_id (ForeignKey to Subject) – Mother2
  • description (TextField) – Description
class subjects.models.Line(id, json, name, description, target_phenotype, auto_name, strain, species, subject_autoname_index, breeding_pair_autoname_index, litter_autoname_index, is_active)[source]

Bases: alyx.base.BaseModel

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • name (CharField) – Name
  • description (TextField) – Description
  • target_phenotype (CharField) – Target phenotype
  • auto_name (CharField) – Auto name
  • strain_id (ForeignKey to Strain) – Strain
  • species_id (ForeignKey to Species) – Species
  • subject_autoname_index (IntegerField) – Subject autoname index
  • breeding_pair_autoname_index (IntegerField) – Breeding pair autoname index
  • litter_autoname_index (IntegerField) – Litter autoname index
  • is_active (BooleanField) – Is active
  • sequences (ManyToManyField to Sequence) – Sequences
class subjects.models.Species(*args, **kwargs)[source]

Bases: alyx.base.BaseModel

A single species, identified uniquely by its binomial name.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • binomial (CharField) – Binomial name, e.g. “mus musculus”
  • display_name (CharField) – common name, e.g. “mouse”
class subjects.models.Strain(*args, **kwargs)[source]

Bases: alyx.base.BaseModel

A strain with a standardised name.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • descriptive_name (CharField) – Standard descriptive name E.g. “C57BL/6J”, http://www.informatics.jax.org/mgihome/nomen/
  • description (TextField) – Description
class subjects.models.Source(*args, **kwargs)[source]

Bases: alyx.base.BaseModel

A supplier / source of subjects.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • name (CharField) – Name
  • description (TextField) – Description
class subjects.models.StockManager(id, json, user)[source]

Bases: alyx.base.BaseModel

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • user_id (OneToOneField to User) – User
class subjects.models.Allele(*args, **kwargs)[source]

Bases: alyx.base.BaseModel

A single allele.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • standard_name (CharField) – MGNC-standard genotype name e.g. Pvalb, http://www.informatics.jax.org/mgihome/nomen/
  • informal_name (CharField) – informal name in lab, e.g. Pvalb-Cre
class subjects.models.Zygosity(*args, **kwargs)[source]

Bases: alyx.base.BaseModel

A junction table between Subject and Allele.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • subject_id (ForeignKey to Subject) – Subject
  • allele_id (ForeignKey to Allele) – Allele
  • zygosity (IntegerField with choices: ((0, ‘Absent’), (1, ‘Heterozygous’), (2, ‘Homozygous’), (3, ‘Present’))) – Zygosity
class subjects.models.Sequence(*args, **kwargs)[source]

Bases: alyx.base.BaseModel

A genetic sequence that you run a genotyping test for.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • base_pairs (TextField) – the actual sequence of base pairs in the test
  • description (CharField) – any other relevant information about this test
  • informal_name (CharField) – informal name in lab, e.g. ROSA-WT
class subjects.models.GenotypeTest(id, json, subject, sequence, test_result)[source]

Bases: alyx.base.BaseModel

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • subject_id (ForeignKey to Subject) – Subject
  • sequence_id (ForeignKey to Sequence) – Sequence
  • test_result (IntegerField with choices: ((0, ‘Absent’), (1, ‘Present’))) – Test result
TEST_RESULTS = ((0, 'Absent'), (1, 'Present'))

A junction table between Subject and Sequence.

Actions

class actions.models.ProcedureType(*args, **kwargs)[source]

Bases: alyx.base.BaseModel

A procedure to be performed on a subject.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • name (CharField) – Short procedure name
  • description (TextField) – Detailed description of the procedure
class actions.models.Weighing(*args, **kwargs)[source]

Bases: alyx.base.BaseModel

A weighing of a subject.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • user_id (ForeignKey to OrderedUser) – The user who weighed the subject
  • subject_id (ForeignKey to Subject) – The subject which was weighed
  • date_time (DateTimeField) – Date time
  • weight (FloatField) – Weight in grams
  • weighing_scale_id (ForeignKey to WeighingScale) – The scale record that was used to weigh the subject
expected()[source]

Expected weighing.

class actions.models.WaterAdministration(*args, **kwargs)[source]

Bases: alyx.base.BaseModel

For keeping track of water for subjects not on free water.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • user_id (ForeignKey to OrderedUser) – The user who administered water
  • subject_id (ForeignKey to Subject) – The subject to which water was administered
  • date_time (DateTimeField) – Date time
  • water_administered (FloatField) – Water administered, in millilitres
  • hydrogel (NullBooleanField) – Hydrogel
class actions.models.BaseAction(*args, **kwargs)[source]

Bases: alyx.base.BaseModel

Base class for an action performed on a subject, such as a recording; surgery; etc. This should always be accessed through one of its subclasses.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • subject_id (ForeignKey to Subject) – The subject on which this action was performed
  • location_id (ForeignKey to LabLocation) – The physical location at which the action was performed
  • narrative (TextField) – Narrative
  • start_time (DateTimeField) – Start time
  • end_time (DateTimeField) – End time
  • users (ManyToManyField to OrderedUser) – The user(s) involved in this action
  • procedures (ManyToManyField to ProcedureType) – The procedure(s) performed
class actions.models.VirusInjection(*args, **kwargs)[source]

Bases: actions.models.BaseAction

A virus injection.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • subject_id (ForeignKey to Subject) – The subject on which this action was performed
  • location_id (ForeignKey to LabLocation) – The physical location at which the action was performed
  • narrative (TextField) – Narrative
  • start_time (DateTimeField) – Start time
  • end_time (DateTimeField) – End time
  • virus_batch_id (ForeignKey to VirusBatch) – Virus batch
  • injection_volume (FloatField) – Volume in nanoliters
  • rate_of_injection (FloatField) – TODO: Nanoliters per second / per minute?
  • injection_type (CharField with choices: ((‘I’, ‘Iontophoresis’), (‘P’, ‘Pressure’))) – Whether the injection was through iontophoresis or pressure
  • users (ManyToManyField to OrderedUser) – The user(s) involved in this action
  • procedures (ManyToManyField to ProcedureType) – The procedure(s) performed
class actions.models.Surgery(*args, **kwargs)[source]

Bases: actions.models.BaseAction

Surgery performed on a subject.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • subject_id (ForeignKey to Subject) – The subject on which this action was performed
  • narrative (TextField) – Narrative
  • start_time (DateTimeField) – Start time
  • end_time (DateTimeField) – End time
  • brain_location_id (ForeignKey to BrainLocation) – Brain location
  • outcome_type (CharField with choices: ((‘a’, ‘Acute’), (‘r’, ‘Recovery’))) – Outcome type
  • location_id (ForeignKey to LabLocation) – The physical location at which the surgery was performed
  • users (ManyToManyField to OrderedUser) – The user(s) involved in this action
  • procedures (ManyToManyField to ProcedureType) – The procedure(s) performed
class actions.models.Session(*args, **kwargs)[source]

Bases: actions.models.BaseAction

An session or training session performed on a subject.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • subject_id (ForeignKey to Subject) – The subject on which this action was performed
  • location_id (ForeignKey to LabLocation) – The physical location at which the action was performed
  • narrative (TextField) – Narrative
  • start_time (DateTimeField) – Start time
  • end_time (DateTimeField) – End time
  • users (ManyToManyField to OrderedUser) – The user(s) involved in this action
  • procedures (ManyToManyField to ProcedureType) – The procedure(s) performed
class actions.models.WaterRestriction(*args, **kwargs)[source]

Bases: actions.models.BaseAction

Another type of action.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • subject_id (ForeignKey to Subject) – The subject on which this action was performed
  • location_id (ForeignKey to LabLocation) – The physical location at which the action was performed
  • narrative (TextField) – Narrative
  • start_time (DateTimeField) – Start time
  • end_time (DateTimeField) – End time
  • users (ManyToManyField to OrderedUser) – The user(s) involved in this action
  • procedures (ManyToManyField to ProcedureType) – The procedure(s) performed
class actions.models.OtherAction(*args, **kwargs)[source]

Bases: actions.models.BaseAction

Another type of action.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • subject_id (ForeignKey to Subject) – The subject on which this action was performed
  • location_id (ForeignKey to LabLocation) – The physical location at which the action was performed
  • narrative (TextField) – Narrative
  • start_time (DateTimeField) – Start time
  • end_time (DateTimeField) – End time
  • users (ManyToManyField to OrderedUser) – The user(s) involved in this action
  • procedures (ManyToManyField to ProcedureType) – The procedure(s) performed

Equipment

class equipment.models.LabLocation(*args, **kwargs)[source]

Bases: alyx.base.BaseModel

The physical location at which an session is performed or appliances are located. This could be a room, a bench, a rig, etc.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • name (CharField) – Name
class equipment.models.Supplier(*args, **kwargs)[source]

Bases: alyx.base.BasePolymorphicModel

A company or individual that provides lab equipment or supplies. This is a base class, to be accessed by subclasses

Parameters:
  • polymorphic_ctype_id (ForeignKey to ContentType) – Polymorphic ctype
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • name (CharField) – i.e. ‘NeuroNexus’
  • description (TextField) – Description
class equipment.models.EquipmentManufacturer(*args, **kwargs)[source]

Bases: equipment.models.Supplier

An equipment manufacturer, i.e. “NeuroNexus”

Parameters:supplier_ptr_id (OneToOneField to Supplier) – Supplier ptr
class equipment.models.VirusSource(*args, **kwargs)[source]

Bases: equipment.models.Supplier

An equipment manufacturer, i.e. “NeuroNexus”

Parameters:supplier_ptr_id (OneToOneField to Supplier) – Supplier ptr
class equipment.models.EquipmentModel(*args, **kwargs)[source]

Bases: alyx.base.BaseModel

An equipment model. i.e. “BrainScanner 4X”

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • manufacturer_id (ForeignKey to EquipmentManufacturer) – Manufacturer
  • model_name (CharField) – e.g. ‘BrainScanner 4X’
  • description (CharField) – Description
class equipment.models.VirusBatch(*args, **kwargs)[source]

Bases: alyx.base.BaseModel

A virus batch

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • virus_type (CharField) – UPenn ID or equivalent
  • description (CharField) – Description
  • virus_source_id (ForeignKey to VirusSource) – Who supplied the virus
  • date_time_made (DateTimeField) – Date time made
  • nominal_titer (FloatField) – TODO: What unit?
class equipment.models.Appliance(*args, **kwargs)[source]

Bases: alyx.base.BasePolymorphicModel

An appliance, provided by a specific manufacturer. This class is only accessed through its subclasses.

Parameters:
  • polymorphic_ctype_id (ForeignKey to ContentType) – Polymorphic ctype
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • location_id (ForeignKey to LabLocation) – The physical location of the appliance.
  • equipment_model_id (ForeignKey to EquipmentModel) – Equipment model
  • serial (CharField) – The serial number of the appliance.
  • description (TextField) – Description
  • descriptive_name (CharField) – Descriptive name
class equipment.models.WeighingScale(*args, **kwargs)[source]

Bases: equipment.models.Appliance

A weighing scale.

Parameters:appliance_ptr_id (OneToOneField to Appliance) – Appliance ptr
class equipment.models.LightSource(*args, **kwargs)[source]

Bases: equipment.models.Appliance

A light source (e.g. for use in optogenetics.

Parameters:appliance_ptr_id (OneToOneField to Appliance) – Appliance ptr
class equipment.models.Amplifier(*args, **kwargs)[source]

Bases: equipment.models.Appliance

An amplifier used in electrophysiology sessions.

Parameters:appliance_ptr_id (OneToOneField to Appliance) – Appliance ptr
class equipment.models.PipettePuller(*args, **kwargs)[source]

Bases: equipment.models.Appliance

A pipette puller for intracellular electrophysiology.

Parameters:appliance_ptr_id (OneToOneField to Appliance) – Appliance ptr
class equipment.models.DAQ(*args, **kwargs)[source]

Bases: equipment.models.Appliance

A DAQ for extracellular electrophysiology.

Parameters:appliance_ptr_id (OneToOneField to Appliance) – Appliance ptr
class equipment.models.ExtracellularProbe(*args, **kwargs)[source]

Bases: equipment.models.Appliance

An extracellular probe used in extracellular electrophysiology.

Parameters:

Data

class data.models.DataRepositoryType(id, json, name)[source]

Bases: alyx.base.BaseModel

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • name (CharField) – Name
class data.models.DataRepository(*args, **kwargs)[source]

Bases: alyx.base.BaseModel

Base class for a file storage device; this could be a local hard-drive on a laptop, a network file location, or an offline archive tape / Blu-Ray disc / hard-drive.

Information about the repository is stored in JSON in a type-specific manner

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • name (CharField) – Name
  • repository_type_id (ForeignKey to DataRepositoryType) – Repository type
  • path (CharField) – absolute path to the repository
class data.models.FileRecord(*args, **kwargs)[source]

Bases: alyx.base.BaseModel

A single file on disk or tape. Normally specified by a path within an archive. In some cases (like for a single array split over multiple binary files) more details can be in the JSON

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • dataset_id (ForeignKey to Dataset) – Dataset
  • data_repository_id (ForeignKey to DataRepository) – Data repository
  • relative_path (CharField) – path name within repository
class data.models.BaseExperimentalData(*args, **kwargs)[source]

Bases: alyx.base.BaseModel

Abstract base class for all data acquisition models. Never used directly.

Contains a session link, which will provide information about who did the experiment etc. Information about experiment #, series, etc. can go in the JSON

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • session_id (ForeignKey to Session) – The Session to which this data belongs
  • created_by_id (ForeignKey to User) – The creator of the data.
  • created_date (DateTimeField) – The creation date.
class data.models.DatasetType(*args, **kwargs)[source]

Bases: alyx.base.BaseModel

A descriptor to accompany a dataset, saying what sort of information is contained in it E.g. “Neuropixels raw data” “eye camera movie”, etc.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • name (CharField) – description of data type
class data.models.Dataset(*args, **kwargs)[source]

Bases: data.models.BaseExperimentalData

A chunk of data that is stored outside the database, most often a rectangular binary array. There can be multiple FileRecords for one Dataset, if it is stored multiple places, which can have different types depending on how the file is stored

Note that by convention, binary arrays are stored as .npy and text arrays as .tsv

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • session_id (ForeignKey to Session) – The Session to which this data belongs
  • created_by_id (ForeignKey to User) – The creator of the data.
  • created_date (DateTimeField) – The creation date.
  • name (CharField) – Name
  • md5 (UUIDField) – MD5 hash of the data buffer
  • dataset_type_id (ForeignKey to DatasetType) – Dataset type
class data.models.Timescale(*args, **kwargs)[source]

Bases: data.models.BaseExperimentalData

A timescale that is used to align recordings on multiple devices. There can be multiple timescales for a single experiment, which could be used for example if some information could only be aligned with poor temporal resolution.

However there can only be one timescale with the flag “final” set to True at any moment. This should reflect a final, accurate time alignement, that can be used by data analysts who do not need to understand how time alignment was performed. It should have a sample rate of 1.

When users search for data, they will normally search for a timescale that is linked to timeseries of the appropriate kind.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • session_id (ForeignKey to Session) – The Session to which this data belongs
  • created_by_id (ForeignKey to User) – The creator of the data.
  • created_date (DateTimeField) – The creation date.
  • name (CharField) – informal name describing this field
  • nominal_start (DateTimeField) – Approximate date and time corresponding to 0 samples
  • nominal_time_unit (FloatField) – Nominal time unit for this timescale (in seconds)
  • final (BooleanField) – set to true for the final results of time alignment, in seconds
  • info (CharField) – any information, e.g. length of break around 300s inferred approximately from computer clock
class data.models.TimeSeries(*args, **kwargs)[source]

Bases: data.models.BaseExperimentalData

A special type of Dataset with associated timestamps, relative to specified timescale.

If a recording has been aligned to more than one Timescale, there will be multiple TimeSeries objects, that with the same primary data file but different timestamp files

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • session_id (ForeignKey to Session) – The Session to which this data belongs
  • created_by_id (ForeignKey to User) – The creator of the data.
  • created_date (DateTimeField) – The creation date.
  • data_id (ForeignKey to Dataset) – N*2 array containing sample numbers and their associated timestamps
  • timestamps_id (ForeignKey to Dataset) – N*2 array containing sample numbers and their associated timestamps
  • timescale_id (ForeignKey to Timescale) – Timescale
class data.models.EventSeries(*args, **kwargs)[source]

Bases: data.models.BaseExperimentalData

Links to a file containing a set of event times and descriptions, such as behavioral events or sensory stimuli.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • session_id (ForeignKey to Session) – The Session to which this data belongs
  • created_by_id (ForeignKey to User) – The creator of the data.
  • created_date (DateTimeField) – The creation date.
  • timescale_id (ForeignKey to Timescale) – which timescale this is on
  • event_times_id (ForeignKey to Dataset) – n*1 array of times
  • event_types_id (ForeignKey to Dataset) – n*1 array listing the type of each event, numbers or strings
  • type_descriptions_id (ForeignKey to Dataset) – nTypes*2 text array (.tsv) describing event types
  • description (TextField) – misc. narrative e.g. ‘drifting gratings of different orientations’, ‘ChoiceWorld behavior events’
  • generating_software (CharField) – e.g. ‘ChoiceWorld 0.8.3’
  • provenance_directory_id (ForeignKey to Dataset) – link to directory containing intermediate results
class data.models.IntervalSeries(*args, **kwargs)[source]

Bases: data.models.BaseExperimentalData

Links to a file containing a set of start/end pairs and descriptions, such as behavioral intervals or extended sensory stimuli.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • session_id (ForeignKey to Session) – The Session to which this data belongs
  • created_by_id (ForeignKey to User) – The creator of the data.
  • created_date (DateTimeField) – The creation date.
  • timescale_id (ForeignKey to Timescale) – which timescale this is on
  • interval_times_id (ForeignKey to Dataset) – n*2 array of start and end times
  • interval_types_id (ForeignKey to Dataset) – n*1 array listing the type of each interval
  • type_descriptions_id (ForeignKey to Dataset) – interval series type descriptions
  • description (TextField) – misc. narrative e.g. ‘drifting gratings of different orientations’, ‘ChoiceWorld behavior intervals’
  • generating_software (CharField) – e.g. ‘ChoiceWorld 0.8.3’
  • provenance_directory_id (ForeignKey to Dataset) – link to directory containing intermediate results

Behavior

class behavior.models.PupilTracking(*args, **kwargs)[source]

Bases: data.models.BaseExperimentalData

Describes the results of a pupil tracking algorithm.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • session_id (ForeignKey to Session) – The Session to which this data belongs
  • created_by_id (ForeignKey to User) – The creator of the data.
  • created_date (DateTimeField) – The creation date.
  • x_y_d_id (ForeignKey to TimeSeries) – n*3 timeseries giving x and y coordinates of center plus diameter
  • movie_id (ForeignKey to TimeSeries) – Link to raw data
  • eye (CharField with choices: ((‘L’, ‘Left’), (‘R’, ‘Right’))) – Which eye was tracked; left or right
  • description (TextField) – misc. narrative e.g. (‘unit: mm’ or ‘unknown scale factor’)
  • generating_software (CharField) – e.g. ‘PupilTracka 0.8.3’
  • provenance_directory_id (ForeignKey to Dataset) – link to directory containing intermediate results
class behavior.models.HeadTracking(*args, **kwargs)[source]

Bases: data.models.BaseExperimentalData

Describes the results of a head tracking algorithm.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • session_id (ForeignKey to Session) – The Session to which this data belongs
  • created_by_id (ForeignKey to User) – The creator of the data.
  • created_date (DateTimeField) – The creation date.
  • x_y_theta_id (ForeignKey to TimeSeries) – 3*n timeseries giving x and y coordinates of head plus angle
  • movie_id (ForeignKey to TimeSeries) – Link to raw data
  • description (TextField) – misc. narrative e.g. (‘unit: cm’ or ‘unknown scale factor’)
  • generating_software (CharField) – e.g. ‘HeadTracka 0.8.3’
  • provenance_directory_id (ForeignKey to Dataset) – link to directory containing intermediate results
class behavior.models.EventSeries(*args, **kwargs)[source]

Bases: data.models.BaseExperimentalData

Links to a file containing a set of event times and descriptions, such as behavioral events or sensory stimuli.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • session_id (ForeignKey to Session) – The Session to which this data belongs
  • created_by_id (ForeignKey to User) – The creator of the data.
  • created_date (DateTimeField) – The creation date.
  • event_times_id (ForeignKey to Dataset) – n*1 array of times in seconds (universal timescale)
  • type_descriptions_id_id (ForeignKey to Dataset) – Type descriptions id
  • event_types_id_id (ForeignKey to Dataset) – n*1 array listing the type of each event
  • description (TextField) – misc. narrative e.g. ‘drifting gratings of different orientations’, ‘ChoiceWorld behavior events’
  • generating_software (CharField) – e.g. ‘ChoiceWorld 0.8.3’
  • provenance_directory_id (ForeignKey to Dataset) – link to directory containing intermediate results
class behavior.models.IntervalSeries(*args, **kwargs)[source]

Bases: data.models.BaseExperimentalData

Links to a file containing a set of start/end pairs and descriptions, such as behavioral intervals or extended sensory stimuli.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • session_id (ForeignKey to Session) – The Session to which this data belongs
  • created_by_id (ForeignKey to User) – The creator of the data.
  • created_date (DateTimeField) – The creation date.
  • interval_times_id (ForeignKey to Dataset) – n*2 array, with associated array of row labels.
  • interval_types_id (ForeignKey to Dataset) – n*1 array listing the type of each interval
  • type_descriptions_id (ForeignKey to Dataset) – Type descriptions
  • description (TextField) – misc. narrative e.g. ‘drifting gratings of different orientations’, ‘ChoiceWorld behavior intervals’
  • generating_software (CharField) – e.g. ‘ChoiceWorld 0.8.3’
  • provenance_directory_id (ForeignKey to Dataset) – link to directory containing intermediate results
class behavior.models.OptogeneticStimulus(*args, **kwargs)[source]

Bases: data.models.BaseExperimentalData

This is a special type of interval series, to deal with optogenetic stimuli.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • session_id (ForeignKey to Session) – The Session to which this data belongs
  • created_by_id (ForeignKey to User) – The creator of the data.
  • created_date (DateTimeField) – The creation date.
  • apparatus_id (ForeignKey to Appliance) – e.g. Laser that was used for stimulation.
  • light_delivery (CharField) – e.g. ‘fiber pointed at craniotomy’
  • description (CharField) – e.g. ‘square pulses’, ‘ramps’
  • wavelength (FloatField) – in nm
  • brain_location_id (ForeignKey to BrainLocation) – of fiber tip, craniotomy, etc.
  • stimulus_times_id (ForeignKey to Dataset) – link to an n*2 array of start and stop of each pulse (sec)
  • stimulus_positions_id (ForeignKey to Dataset) – link to an n*3 array of stimulus positions
  • power_id (ForeignKey to Dataset) – link to an n*1 array giving each pulse power
  • power_calculation_method (CharField) – TODO: normalize? measured, nominal
  • waveform_id (ForeignKey to Dataset) – link to a file giving the waveform of each stimulus.?
class behavior.models.Pharmacology(*args, **kwargs)[source]

Bases: data.models.BaseExperimentalData

Describes a drug application during the session.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • session_id (ForeignKey to Session) – The Session to which this data belongs
  • created_by_id (ForeignKey to User) – The creator of the data.
  • created_date (DateTimeField) – The creation date.
  • drug (CharField) – TODO: normalize? Also say what it is dissolved in (DMSO etc)
  • administration_route (CharField) – TODO: normalize? IP, IV, IM, surface etc…
  • start_time (FloatField) – in seconds relative to session start. TODO: not DateTimeField? / TimeDifference
  • end_time (FloatField) – equals start time if single application. TODO: should this be an offset? Or DateTimeField? Or TimeDifference?
  • concentration (CharField) – TODO: not FloatField? include unit (e.g. g/kg; mM; %)
  • volume (CharField) – TODO: not FloatField? include unit (e.g. µL)

Electrophysiology

class electrophysiology.models.ExtracellularRecording(*args, **kwargs)[source]

Bases: data.models.BaseExperimentalData

There is one document in this collection each time you make an extracellular recording. There will typically be one spike_sorting entry associated with it (although there could be more). The data files directly associated with this document are raw_data and lfp (raw_data downsampled). Note that we assume channels are recorded in the same order every time a probe is used. (TODO: do we? Where?)

TODO: sample rate? dead channels? Some linking of the same chronic implant location between multiple recordings/days?

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • session_id (ForeignKey to Session) – The Session to which this data belongs
  • created_by_id (ForeignKey to User) – The creator of the data.
  • created_date (DateTimeField) – The creation date.
  • raw_data_id (ForeignKey to TimeSeries) – Raw electrophysiology recording data in flat binary format
  • lowpass_data_id (ForeignKey to TimeSeries) – Extracellular low-passed data
  • highpass_data_id (ForeignKey to TimeSeries) – Extracellular high-passed data
  • filter_info (CharField) – Details of hardware corner frequencies, filter type, order. TODO: make this more structured?
  • nominal_start_time (FloatField) – in seconds relative to session start.
  • nominal_end_time (FloatField) – in seconds relative to session start
  • recording_type (CharField with choices: ((‘C’, ‘Chronic’), (‘A’, ‘Acute’))) – Whether the recording is chronic or acute
  • ground_electrode (CharField) – e.g. ‘screw above cerebellum’
  • reference_electrode (CharField) – e.g. ‘shorted to ground’
  • impedances_id (ForeignKey to Dataset) – binary array for measured impedance of each channel (ohms).
  • amplifier_id (ForeignKey to Amplifier) – The amplifier used in this recording.
  • daq_description_id (ForeignKey to DAQ) – The DAQ used.
  • electrode_depth (FloatField) – estimated depth of electrode tip from brain surface.
  • probe_location_id (ForeignKey to CoordinateTransformation) – from probe tip
  • extracellular_probe_id (ForeignKey to ExtracellularProbe) – Which probe model was used.
class electrophysiology.models.SpikeSorting(*args, **kwargs)[source]

Bases: data.models.BaseExperimentalData

An entry in the spike_sorting table contains metadata about a single spike sorting run of an extracellular recording. There will usually be only one of these per recording, but there could be several if you want to store multiple alternative clusterings. Note that the database only describes the final spike sorting results, not intermediate steps such as feature vectors, to allow flexibility if algorithms change later. However, it does contain a provenance_directory that can contain these intermediate steps, in a non-standardized format.

Finally, while multiple extracellular_recordings can be sorted together, they must all belong to the same session (i.e. the same action). This is required as time zero is defined separately for each session. When multiple sessions are clustered together (e.g. in a chronic recording over several days), you will need to create multiple spike_sorting documents, and link them together (to be determined exactly how).

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • session_id (ForeignKey to Session) – The Session to which this data belongs
  • created_by_id (ForeignKey to User) – The creator of the data.
  • created_date (DateTimeField) – The creation date.
  • spike_times_id (ForeignKey to Dataset) – time of each spike relative to session start in universal seconds.
  • extracellular_recording_id (ForeignKey to ExtracellularRecording) – Extracellular recording
  • cluster_assignments_id (ForeignKey to Dataset) – cluster assignment of each spike
  • mean_unfiltered_waveforms_id (ForeignKey to Dataset) – mean unfiltered waveforms of every spike on every channel
  • mean_filtered_waveforms_id (ForeignKey to Dataset) – mean filtered waveforms of every spike on every channel
  • generating_software (CharField) – e.g. ‘phy 0.8.3’
  • provenance_directory_id (ForeignKey to Dataset) – link to directory containing intermediate results
class electrophysiology.models.SpikeSortedUnit(*args, **kwargs)[source]

Bases: data.models.BaseExperimentalData

This is going to be the biggest table, containing information on every unit resulting from spike sorting. (There is a separate table for units resulting from 2-photon).

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • session_id (ForeignKey to Session) – The Session to which this data belongs
  • created_by_id (ForeignKey to User) – The creator of the data.
  • created_date (DateTimeField) – The creation date.
  • cluster_number (IntegerField) – Cluster number
  • spike_sorting_id (ForeignKey to SpikeSorting) – The spike sorting this unit came from
  • channel_group (IntegerField) – which shank this unit came from (an integer not a link)
  • trough_to_peak_width (FloatField) – ms, computed from unfiltered mean spike waveform.
  • half_width (FloatField) – ms, half width of negative peak in unfiltered spike waveform.
  • trough_to_peak_amplitude (FloatField) – µV, from filtered spike waveform.
  • refractory_violation_rate (FloatField) – fraction of spikes occurring < 2ms.
  • isolation_distance (FloatField) – A measure of isolation quality
  • l_ratio (FloatField) – A measure of isolation quality
  • mean_firing_rate (FloatField) – spikes/s
  • location_center_of_mass (FloatField) – 3x1 in estimated stereotaxic coordinates.
  • cluster_group (CharField with choices: ((‘0’, ‘Noise’), (‘1’, ‘Multi-unit activity’), (‘2’, ‘Single-unit activity’))) – Human decision on cluster group
  • spike_width_class (CharField with choices: ((‘N’, ‘Narrow’), (‘W’, ‘Wide’))) – Human decision on spike width
  • optogenetic_response (CharField) – e.g. ‘Short latency’ (only if applicable)
  • putative_cell_type (CharField) – e.g. ‘Sst interneuron’, ‘PT cell’.
  • estimated_layer (CharField) – e.g. ‘Layer 5b’.
class electrophysiology.models.IntracellularRecording(*args, **kwargs)[source]

Bases: data.models.BaseExperimentalData

This describes a single intracellular electrode used in one recording.

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • session_id (ForeignKey to Session) – The Session to which this data belongs
  • created_by_id (ForeignKey to User) – The creator of the data.
  • created_date (DateTimeField) – The creation date.
  • tip_location_id (ForeignKey to BrainLocation) – Estimated location of probe tip
  • electrode_type (CharField with choices: ((‘W’, ‘Whole-cell’), (‘S’, ‘Sharp’))) – Electrode type
  • pipette_puller_id (ForeignKey to PipettePuller) – Pipette puller
  • inner_diameter (FloatField) – mm – before pulling
  • outer_diameter (FloatField) – mm – before pulling
  • electrode_solution (TextField) – Solution details.
  • cp_fast (FloatField) – (pF)
  • cp_slow (FloatField) – (pF)
  • whole_cell_cap_comp (FloatField) – (pF)
  • whole_cell_series_resistance (FloatField) – (Mohm)
  • series_resistance_compensation_bandwidth (FloatField) – (kHz)
  • series_resistance_compensation_correction (FloatField) – (%)
  • series_resistance_compensation_prediction (FloatField) – (%)
  • recorded_current_id (ForeignKey to Dataset) – nA. TODO: time series? flat file? sample rate?
  • voltage_command_id (ForeignKey to Dataset) – mV
  • pipette_cap_comp (FloatField) – (pF)
  • bridge_balance (FloatField) – (M Ohm)
  • recorded_voltage_id (ForeignKey to Dataset) – mV
  • current_command_id (ForeignKey to Dataset) – nA
  • gain (FloatField) – (V/V) – for info only; not required to convert raw data to volts

Imaging

class imaging.models.SVDCompressedMovie(id, json, session, created_by, created_date, compressed_data_U, compressed_data_V)[source]

Bases: data.models.BaseExperimentalData

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • session_id (ForeignKey to Session) – The Session to which this data belongs
  • created_by_id (ForeignKey to User) – The creator of the data.
  • created_date (DateTimeField) – The creation date.
  • compressed_data_U_id (ForeignKey to Dataset) – nSVs*nY*nX binary array giving normalized eigenframesSVD-compression eigenframes
  • compressed_data_V_id (ForeignKey to TimeSeries) – nSamples*nSVs binary array SVD-compression timecourses
class imaging.models.WidefieldImaging(id, json, session, created_by, created_date, raw_data, compressed_data, nominal_start_time, nominal_end_time, imaging_indicator, preprocessing, description, image_position, excitation_nominal_wavelength, recording_nominal_wavelength, excitation_device, recording_device)[source]

Bases: data.models.BaseExperimentalData

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • session_id (ForeignKey to Session) – The Session to which this data belongs
  • created_by_id (ForeignKey to User) – The creator of the data.
  • created_date (DateTimeField) – The creation date.
  • raw_data_id (ForeignKey to TimeSeries) – pointer to nT by nX by nY by nC (colors) binary file
  • compressed_data_id (ForeignKey to SVDCompressedMovie) – Link to SVD compressed movie, if compression was run
  • nominal_start_time (DateTimeField) – in seconds relative to session start. TODO: not DateTimeField? / TimeDifference
  • nominal_end_time (DateTimeField) – Equals start time if single application. TODO: should this be an offset? Or DateTimeField? Or TimeDifference?
  • imaging_indicator (CharField) – . TODO: normalize!
  • preprocessing (CharField) – e.g. ‘computed (F-F0) / F0, estimating F0 as running min’
  • description (CharField) – e.g. ‘field of view includes V1, S1, retrosplenial’
  • image_position_id (ForeignKey to CoordinateTransformation) – Image position
  • excitation_nominal_wavelength (FloatField) – in nm. Can be array for multispectral
  • recording_nominal_wavelength (FloatField) – in nm. Can be array for multispectral
  • excitation_device_id (ForeignKey to LightSource) – Excitation device
  • recording_device (CharField) – e.g. camera manufacturer, plus filter description etc. TODO: Appliance subclass - what name?
class imaging.models.TwoPhotonImaging(id, json, session, created_by, created_date, raw_data, compressed_data, description, image_position, excitation_wavelength, recording_wavelength, reference_stack)[source]

Bases: data.models.BaseExperimentalData

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • session_id (ForeignKey to Session) – The Session to which this data belongs
  • created_by_id (ForeignKey to User) – The creator of the data.
  • created_date (DateTimeField) – The creation date.
  • raw_data_id (ForeignKey to TimeSeries) – array of size nT by nX by nY by nZ by nC
  • compressed_data_id (ForeignKey to SVDCompressedMovie) – to Compressed_movie, if compression was run
  • description (CharField) – e.g. ‘V1 layers 2-4’
  • image_position_id (ForeignKey to CoordinateTransformation) – Note if different planes have different alignment (e.g. flyback plane), this can’t be done in a single 3x3 transformation matrix, instead you would have an array of 3x2 matrices. TODO: how do we deal with this?
  • excitation_wavelength (FloatField) – in nm
  • recording_wavelength (FloatField) – in nm. Can be array for multispectral imaging. TODO: deal with arrays?
  • reference_stack_id (ForeignKey to Dataset) – TODO: reference stack / BrainImage
class imaging.models.ROIDetection(id, json, session, created_by, created_date, masks, plane, preprocessing, f, f0, two_photon_imaging_id)[source]

Bases: data.models.BaseExperimentalData

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • session_id (ForeignKey to Session) – The Session to which this data belongs
  • created_by_id (ForeignKey to User) – The creator of the data.
  • created_date (DateTimeField) – The creation date.
  • masks_id (ForeignKey to Dataset) – array of size nROIs by nY by nX
  • plane_id (ForeignKey to Dataset) – array saying which plane each roi is found in. TODO: is this an ArrayField? JSON?
  • preprocessing (CharField) – computed (F-F0) / F0, estimating F0 as running min’
  • f_id (ForeignKey to TimeSeries) – array of size nT by nROIs giving raw fluorescence
  • f0_id (ForeignKey to TimeSeries) – array of size nT by nROIs giving resting fluorescence
  • two_photon_imaging_id_id (ForeignKey to TwoPhotonImaging) – 2P imaging stack.
class imaging.models.ROI(id, json, session, created_by, created_date, roi_type, optogenetic_response, putative_cell_type, estimated_layer, roi_detection_id)[source]

Bases: data.models.BaseExperimentalData

Parameters:
  • id (UUIDField) – Id
  • json (JSONField) – Structured data, formatted in a user-defined way
  • session_id (ForeignKey to Session) – The Session to which this data belongs
  • created_by_id (ForeignKey to User) – The creator of the data.
  • created_date (DateTimeField) – The creation date.
  • roi_type (CharField) – soma, dendrite, neuropil, …> TODO: normalize?
  • optogenetic_response (CharField) – e.g. ‘Short latency’ (only if applicable)
  • putative_cell_type (CharField) – e.g. ‘Sst interneuron’, ‘PT cell’
  • estimated_layer (CharField) – e.g. ‘Layer 5b’
  • roi_detection_id_id (ForeignKey to ROIDetection) – link to detection entry