Skip to content

Commit

Permalink
Fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
alejoe91 committed Oct 16, 2023
2 parents 4b4b906 + cc9eee1 commit c7a83de
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
8 changes: 4 additions & 4 deletions src/probeinterface/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, name: Optional[str] = None) -> "Probe":
"""
Get probe from ProbeInterface library
Expand All @@ -96,9 +96,9 @@ def get_probe(manufacturer: str, probe_name: str) -> "Probe":
if probe is None:
download_probeinterface_file(manufacturer, probe_name)
probe = get_from_cache(manufacturer, probe_name)
if probe.annotations["manufacturer"] == "":
probe.annotations["manufacturer"] = manufacturer
if probe.manufacturer == "":
probe.manufacturer = manufacturer
if name is not None:
probe.annotations["name"] = name
probe.name = name

return probe
33 changes: 27 additions & 6 deletions src/probeinterface/probe.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,13 @@ def __init__(
# annotation: a dict that contains all meta information about
# the probe (name, manufacturor, date of production, ...)
self.annotations = dict()
self.annotate(
name=name if name is not None else "",
serial_number=serial_number if serial_number is not None else "",
model_name=model_name if model_name is not None else "",
manufacturer=manufacturer if manufacturer is not None else "",
)

# set key properties
self.name = name
self.serial_number = serial_number
self.model_name = model_name
self.manufacturer = manufacturer

# same idea but handle in vector way for contacts
self.contact_annotations = dict()

Expand Down Expand Up @@ -122,18 +123,38 @@ def shank_ids(self):
def name(self):
return self.annotations.get("name", "")

@name.setter
def name(self, value):
if value is not None:
self.annotate(name=value)

@property
def serial_number(self):
return self.annotations.get("serial_number", "")

@serial_number.setter
def serial_number(self, value):
if value is not None:
self.annotate(serial_number=value)

@property
def model_name(self):
return self.annotations.get("model_name", "")

@model_name.setter
def model_name(self, value):
if value is not None:
self.annotate(model_name=value)

@property
def manufacturer(self):
return self.annotations.get("manufacturer", "")

@manufacturer.setter
def manufacturer(self, value):
if value is not None:
self.annotate(manufacturer=value)

def get_title(self) -> str:
if self.contact_positions is None:
txt = "Undefined probe"
Expand Down

0 comments on commit c7a83de

Please sign in to comment.