Skip to content

Commit 52bab85

Browse files
committed
update from_db function to use catalog kwarg instead of name to allow customizing
1 parent 67e0624 commit 52bab85

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/ti_plm/__init__.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def process_phase_map(self, phase_map, replicate_bits=True, enforce_shape=True):
176176

177177
@staticmethod
178178
def bitpack(bitmaps):
179-
"""Combine multiple binary CGHs into a single 8- or 24-bit image. See global `bitpack` function for usage details."""
179+
"""Combine multiple binary CGHs into a single 8- or 24-bit image. See [ti_plm.util.bitpack][] function for usage details."""
180180
return bitpack(bitmaps)
181181

182182
@staticmethod
@@ -186,20 +186,20 @@ def get_device_list():
186186
return get_device_list()
187187

188188
@classmethod
189-
def from_db(cls, name, **params):
190-
"""Create a PLM instance by searching the database for a given device name.
189+
def from_db(cls, catalog, **params):
190+
"""Create a PLM instance by searching the database for a given device identifier.
191191
192192
Args:
193-
name (str): Device name to search for in database
193+
catalog (str): Device identifier to search for in database
194194
**params: Custom param values to override deserialized or default values.
195195
"""
196196
from .db import get_db, get_device_list
197197
db = get_db()
198-
if name in db:
199-
db_params = cls.param.deserialize_parameters(db[name]) # get dict of params deserialized from json string
198+
if catalog in db:
199+
db_params = cls.param.deserialize_parameters(db[catalog]) # get dict of params deserialized from json string
200200
obj = cls(**db_params | params) # create new PLM object with param values
201201
for p in db_params.keys():
202202
obj.param[p].constant = True # set db params to constant
203203
return obj
204204
else:
205-
raise TIPLMException(f'Unrecognized device name. Please select from one of {get_device_list()}')
205+
raise TIPLMException(f'Unrecognized device identifier {catalog}. Please select from one of {get_device_list()}')

0 commit comments

Comments
 (0)