Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 1, 2023
1 parent 5970894 commit d45bfa3
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 52 deletions.
22 changes: 12 additions & 10 deletions src/probeinterface/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from .utils import combine_probes


def generate_dummy_probe(elec_shapes:str ="circle"):
def generate_dummy_probe(elec_shapes: str = "circle"):
"""
Generate a dummy probe with 3 columns and 32 contacts.
Mainly used for testing and examples.
Expand Down Expand Up @@ -72,7 +72,7 @@ def generate_dummy_probe_group():
return probegroup


def generate_tetrode(r:float=10):
def generate_tetrode(r: float = 10):
"""
Generate a tetrode Probe.
Parameters
Expand All @@ -92,13 +92,13 @@ def generate_tetrode(r:float=10):


def generate_multi_columns_probe(
num_columns:int=3,
num_contact_per_column:int =10,
xpitch:float=20,
ypitch:float=20,
num_columns: int = 3,
num_contact_per_column: int = 10,
xpitch: float = 20,
ypitch: float = 20,
y_shift_per_column=None,
contact_shapes:str="circle",
contact_shape_params:dict={"radius": 6},
contact_shapes: str = "circle",
contact_shape_params: dict = {"radius": 6},
):
"""Generate a Probe with several columns.
Expand Down Expand Up @@ -150,7 +150,9 @@ def generate_multi_columns_probe(
return probe


def generate_linear_probe(num_elec: int =16, ypitch:float=20, contact_shapes:str="circle", contact_shape_params:dict={"radius": 6}):
def generate_linear_probe(
num_elec: int = 16, ypitch: float = 20, contact_shapes: str = "circle", contact_shape_params: dict = {"radius": 6}
):
"""Generate a one-column linear probe.
Parameters
Expand Down Expand Up @@ -184,7 +186,7 @@ def generate_linear_probe(num_elec: int =16, ypitch:float=20, contact_shapes:str
return probe


def generate_multi_shank(num_shank:int=2, shank_pitch:list=[150, 0], **kargs):
def generate_multi_shank(num_shank: int = 2, shank_pitch: list = [150, 0], **kargs):
"""Generate a multi-shank probe.
Internally, calls generate_multi_columns_probe and combine_probes.
Expand Down
22 changes: 16 additions & 6 deletions src/probeinterface/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def _probeinterface_format_check_version(d):
pass


def read_probeinterface(file:Union[str, Path])-> ProbeGroup:
def read_probeinterface(file: Union[str, Path]) -> ProbeGroup:
"""
Read probeinterface JSON-based format.
Expand Down Expand Up @@ -175,7 +175,10 @@ def read_BIDS_probe(folder: Union[str, Path], prefix: Optional[str] = None) -> P
if "contact_shapes" not in df_probe:
df_probe["contact_shapes"] = "circle"
df_probe["radius"] = 1
print(f"There is no contact shape provided for probe {probe_id}, a " f"dummy circle with 1um radius will be used.")
print(
f"There is no contact shape provided for probe {probe_id}, a "
f"dummy circle with 1um radius will be used."
)

if "x" not in df_probe:
df_probe["x"] = np.arange(len(df_probe.index), dtype=float)
Expand All @@ -186,7 +189,8 @@ def read_BIDS_probe(folder: Union[str, Path], prefix: Optional[str] = None) -> P
if "y" not in df_probe:
df_probe["y"] = 0.0
print(
f"There is no y coordinate provided for probe {probe_id}, a " f"dummy constant y coordinate will be used."
f"There is no y coordinate provided for probe {probe_id}, a "
f"dummy constant y coordinate will be used."
)

if "si_units" not in df_probe:
Expand Down Expand Up @@ -290,7 +294,7 @@ def read_BIDS_probe(folder: Union[str, Path], prefix: Optional[str] = None) -> P
return probegroup


def write_BIDS_probe(folder: Union[str, Path], probe_or_probegroup: Union[Probe, ProbeGroup], prefix:str=""):
def write_BIDS_probe(folder: Union[str, Path], probe_or_probegroup: Union[Probe, ProbeGroup], prefix: str = ""):
"""
Write to probe and contact formats as proposed
for ephy BIDS extension (tsv & json based).
Expand Down Expand Up @@ -577,7 +581,13 @@ def read_3brain(file: Union[str, Path], mea_pitch: float = 42, electrode_width:
return probe


def write_prb(file:str, probegroup:ProbeGroup, total_nb_channels:Optional[int]=None, radius:Optional[float]=None, group_mode:str="by_probe"):
def write_prb(
file: str,
probegroup: ProbeGroup,
total_nb_channels: Optional[int] = None,
radius: Optional[float] = None,
group_mode: str = "by_probe",
):
"""
Write ProbeGroup into a prb file.
Expand Down Expand Up @@ -656,7 +666,7 @@ def write_prb(file:str, probegroup:ProbeGroup, total_nb_channels:Optional[int]=N
f.write("}\n")


def read_csv(file:Union[str, Path]):
def read_csv(file: Union[str, Path]):
"""
Return a 2 or 3 columns csv file with contact positions
"""
Expand Down
6 changes: 3 additions & 3 deletions src/probeinterface/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
cache_folder = Path(os.path.expanduser("~")) / ".config" / "probeinterface" / "library"


def download_probeinterface_file(manufacturer:str, probe_name:str):
def download_probeinterface_file(manufacturer: str, probe_name: str):
"""Download the probeinterface file to the cache directory.
Note that the file is itself a ProbeGroup but on the repo each file
represents one probe.
Expand All @@ -45,7 +45,7 @@ def download_probeinterface_file(manufacturer:str, probe_name:str):
f.write(dist.read())


def get_from_cache(manufacturer:str, probe_name:str)-> Optional["Probe"]:
def get_from_cache(manufacturer: str, probe_name: str) -> Optional["Probe"]:
"""
Get Probe from local cache
Expand All @@ -72,7 +72,7 @@ def get_from_cache(manufacturer:str, probe_name:str)-> Optional["Probe"]:
return probe


def get_probe(manufacturer:str, probe_name:str)-> "Probe":
def get_probe(manufacturer: str, probe_name: str) -> "Probe":
"""
Get probe from ProbeInterface library
Expand Down
Loading

0 comments on commit d45bfa3

Please sign in to comment.