Skip to content

Commit

Permalink
fix super() bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kjohnsen committed Dec 6, 2023
1 parent cef5e54 commit eb0ca6a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 30 deletions.
2 changes: 1 addition & 1 deletion cleo/ephys/lfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def get_state(self) -> np.ndarray:
return out

def reset(self, **kwargs) -> None:
super().reset(**kwargs)
super(TKLFPSignal, self).reset(**kwargs)
for i_mon in range(len(self._monitors)):
self._reset_buffer(i_mon)
self._init_saved_vars()
Expand Down
23 changes: 12 additions & 11 deletions cleo/ephys/spiking.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
"""Contains multi-unit and sorted spiking signals"""
from __future__ import annotations

from abc import abstractmethod
from typing import Any, Tuple
from datetime import datetime
from typing import Any, Tuple

from attrs import define, field, fields
from bidict import bidict
from brian2 import NeuronGroup, Quantity, SpikeMonitor, meter, ms, mm
import numpy as np
import neo
import numpy as np
import quantities as pq
from attrs import define, field, fields
from bidict import bidict
from brian2 import NeuronGroup, Quantity, SpikeMonitor, meter, mm, ms
from nptyping import NDArray

from cleo.base import NeoExportable
Expand Down Expand Up @@ -82,7 +83,7 @@ def connect_to_neuron_group(
num_neurons_to_consider x num_channels array of spike
detection probabilities, for use in subclasses
"""
super().connect_to_neuron_group(neuron_group, **kwparams)
super(Spiking, self).connect_to_neuron_group(neuron_group, **kwparams)
# could support separate detection probabilities per group using kwparams
# n_neurons X n_channels X 3
dist2 = np.zeros((len(neuron_group), self.probe.n))
Expand Down Expand Up @@ -204,9 +205,9 @@ def connect_to_neuron_group(self, neuron_group: NeuronGroup, **kwparams) -> None
neuron_group : NeuronGroup
group to record from
"""
neuron_channel_dtct_probs = super().connect_to_neuron_group(
neuron_group, **kwparams
)
neuron_channel_dtct_probs = super(
MultiUnitSpiking, self
).connect_to_neuron_group(neuron_group, **kwparams)
if self._dtct_prob_array is None:
self._dtct_prob_array = neuron_channel_dtct_probs
else:
Expand Down Expand Up @@ -236,7 +237,7 @@ def _noisily_detect_spikes_per_channel(
return i_c_detected, t_detected, y

def to_neo(self) -> neo.Group:
group = super().to_neo()
group = super(MultiUnitSpiking, self).to_neo()
for st in group.spiketrains:
i = int(st.annotations["i"])
st.annotate(
Expand Down Expand Up @@ -265,7 +266,7 @@ def connect_to_neuron_group(self, neuron_group: NeuronGroup, **kwparams) -> None
neuron_group : NeuronGroup
group to record from
"""
neuron_channel_dtct_probs = super().connect_to_neuron_group(
neuron_channel_dtct_probs = super(SortedSpiking, self).connect_to_neuron_group(
neuron_group, **kwparams
)
neuron_multi_channel_probs = self._combine_channel_probs(
Expand Down
37 changes: 19 additions & 18 deletions cleo/light/light.py
Original file line number Diff line number Diff line change
@@ -1,44 +1,45 @@
"""Contains Light device and propagation models"""
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import Tuple, Any, Union
import warnings

import datetime
import warnings
from abc import ABC, abstractmethod
from typing import Any, Tuple, Union

from attrs import define, field, asdict
import matplotlib as mpl
import matplotlib.pyplot as plt
import neo
import quantities as pq
from attrs import asdict, define, field
from brian2 import (
np,
NeuronGroup,
Subgroup,
np,
)
from nptyping import NDArray
from brian2.units import (
um,
Quantity,
mm,
mm2,
nmeter,
Quantity,
mwatt,
nmeter,
um,
)
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib import colors
from matplotlib.artist import Artist
from matplotlib.collections import PathCollection
import neo
import quantities as pq
from nptyping import NDArray

from cleo.base import CLSimulator
from cleo.coords import coords_from_ng, coords_from_xyz
from cleo.registry import registry_for_sim
from cleo.stimulators import Stimulator
from cleo.utilities import (
analog_signal,
normalize_coords,
uniform_cylinder_rθz,
wavelength_to_rgb,
xyz_from_rθz,
normalize_coords,
analog_signal,
)
from cleo.coords import coords_from_ng, coords_from_xyz
from cleo.stimulators import Stimulator


@define
Expand Down Expand Up @@ -460,7 +461,7 @@ def update(self, value: Union[float, np.ndarray]) -> None:
Irr0_mW_per_mm2[
Irr0_mW_per_mm2 > self.max_Irr0_mW_per_mm2
] = self.max_Irr0_mW_per_mm2
super().update(Irr0_mW_per_mm2)
super(Light, self).update(Irr0_mW_per_mm2)
self.source.Irr0 = Irr0_mW_per_mm2 * mwatt / mm2

def _alpha_cmap_for_wavelength(self, intensity):
Expand Down

0 comments on commit eb0ca6a

Please sign in to comment.