class Spike(BlockBasedPermissionsMixin, BaseInfo, DataObject): """ NEO Spike @ G-Node. """ # NEO attributes name = models.CharField(max_length=DEFAULTS['name_max_length'], blank=True, null=True) time = models.FloatField() time__unit = TimeUnitField('time__unit', default=DEFAULTS['default_time_unit']) sampling_rate = models.FloatField('sampling_rate', blank=True, null=True) sampling_rate__unit = SamplingUnitField('sampling_rate__unit', blank=True, null=True) left_sweep = models.FloatField('left_sweep', blank=True, null=True) left_sweep__unit = TimeUnitField('left_sweep__unit', blank=True, null=True) # NEO data arrays waveform = models.FileField(storage=fs, upload_to=make_upload_path, blank=True, null=True) waveform__unit = SignalUnitField('waveform__unit', default=DEFAULTS['default_data_unit']) # NEO relationships segment = VersionedForeignKey(Segment) unit = VersionedForeignKey(Unit, blank=True, null=True) def save(self, *args, **kwargs): self.block = self.segment.block super(Spike, self).save(*args, **kwargs)
class EpochArray(BlockBasedPermissionsMixin, BaseInfo, DataObject): """ NEO EpochArray @ G-Node. """ name = models.CharField(max_length=DEFAULTS['name_max_length'], blank=True, null=True) # NEO data arrays labels = models.FileField(storage=fs, upload_to=make_upload_path, blank=True, null=True) times = models.FileField(storage=fs, upload_to=make_upload_path, blank=True, null=True) times__unit = TimeUnitField('times__unit', default=DEFAULTS['default_time_unit']) durations = models.FileField(storage=fs, upload_to=make_upload_path, blank=True, null=True) durations__unit = TimeUnitField('durations__unit', default=DEFAULTS['default_time_unit']) # NEO relationships segment = VersionedForeignKey(Segment) def save(self, *args, **kwargs): self.block = self.segment.block super(EpochArray, self).save(*args, **kwargs)
class AnalogSignal(BlockBasedPermissionsMixin, BaseInfo, DataObject): """ NEO AnalogSignal @ G-Node. """ # NEO attributes name = models.CharField(max_length=DEFAULTS['name_max_length'], blank=True, null=True) sampling_rate = models.FloatField('sampling_rate') sampling_rate__unit = SamplingUnitField( 'sampling_rate__unit', default=DEFAULTS['default_samp_unit']) t_start = models.FloatField('t_start') t_start__unit = TimeUnitField('t_start__unit', default=DEFAULTS['default_time_unit']) # NEO relationships segment = VersionedForeignKey(Segment) recordingchannel = VersionedForeignKey(RecordingChannel, blank=True, null=True) # NEO data arrays signal = models.FileField(storage=fs, upload_to=make_upload_path, blank=True, null=True) signal__unit = SignalUnitField('signal__unit', default=DEFAULTS['default_data_unit']) def save(self, *args, **kwargs): self.block = self.segment.block super(AnalogSignal, self).save(*args, **kwargs)
class IrregularlySampledSignal(BlockBasedPermissionsMixin, BaseInfo, DataObject): """ NEO IrregularlySampledSignal @ G-Node. """ # NEO attributes name = models.CharField(max_length=DEFAULTS['name_max_length'], blank=True, null=True) t_start = models.FloatField('t_start') t_start__unit = TimeUnitField('t_start__unit', default=DEFAULTS['default_time_unit']) # NEO relationships segment = VersionedForeignKey(Segment) recordingchannel = VersionedForeignKey(RecordingChannel, blank=True, null=True) # NEO data arrays signal = models.FileField(storage=fs, upload_to=make_upload_path, blank=True, null=True) signal__unit = SignalUnitField('signal__unit', default=DEFAULTS['default_data_unit']) times = models.FileField(storage=fs, upload_to=make_upload_path, blank=True, null=True) times__unit = TimeUnitField('times__unit', default=DEFAULTS['default_time_unit']) def full_clean(self, *args, **kwargs): """ Add some validation to keep 'signal' and 'times' dimensions consistent. Currently switched off. """ super(IrregularlySampledSignal, self).full_clean(*args, **kwargs) def save(self, *args, **kwargs): self.block = self.segment.block super(IrregularlySampledSignal, self).save(*args, **kwargs)
class Epoch(BlockBasedPermissionsMixin, BaseInfo): """ NEO Epoch @ G-Node. """ # NEO attributes name = models.CharField(max_length=DEFAULTS['name_max_length'], blank=True, null=True) label = models.CharField('label', max_length=DEFAULTS['label_max_length']) time = models.FloatField('time') time__unit = TimeUnitField('time__unit', default=DEFAULTS['default_time_unit']) duration = models.FloatField('duration') duration__unit = TimeUnitField('duration__unit', default=DEFAULTS['default_time_unit']) # NEO relationships segment = VersionedForeignKey(Segment) def save(self, *args, **kwargs): self.block = self.segment.block super(Epoch, self).save(*args, **kwargs)
class SpikeTrain(BlockBasedPermissionsMixin, BaseInfo, DataObject): """ NEO SpikeTrain @ G-Node. """ # NEO attributes name = models.CharField(max_length=DEFAULTS['name_max_length'], blank=True, null=True) t_start = models.FloatField('t_start') t_start__unit = TimeUnitField('t_start__unit', default=DEFAULTS['default_time_unit']) t_stop = models.FloatField('t_stop') t_stop__unit = TimeUnitField('t_stop__unit', default=DEFAULTS['default_time_unit']) # NEO relationships segment = VersionedForeignKey(Segment) unit = VersionedForeignKey(Unit, blank=True, null=True) # NEO data arrays times = models.FileField(storage=fs, upload_to=make_upload_path, blank=True, null=True) times__unit = TimeUnitField('times__unit', default=DEFAULTS['default_time_unit']) waveforms = models.FileField(storage=fs, upload_to=make_upload_path, blank=True, null=True) waveforms__unit = SignalUnitField('waveforms__unit', blank=True, null=True) # rewrite the size property when waveforms are supported def compute_size(self): return self.times.size def save(self, *args, **kwargs): self.block = self.segment.block super(SpikeTrain, self).save(*args, **kwargs)