Skip to content

Commit

Permalink
Update paramset_id to paramset_idx
Browse files Browse the repository at this point in the history
  • Loading branch information
kushalbakshi committed Jan 4, 2024
1 parent 8880453 commit 11d9e71
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions element_miniscope/miniscope.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ class ProcessingParamSet(dj.Lookup):
"""Parameters of the processing method.
Attributes:
paramset_id (foreign key, smallint): Unique parameter set ID.
paramset_idx (foreign key, smallint): Unique parameter set ID.
ProcessingMethod (varchar(16) ): ProcessingMethod from the lookup table.
paramset_desc (varchar(128) ): Description of the parameter set.
paramset_set_hash (uuid): UUID hash for parameter set.
Expand All @@ -375,7 +375,7 @@ class ProcessingParamSet(dj.Lookup):

definition = """
# Parameter set used for processing of miniscope data
paramset_id: smallint
paramset_idx: smallint
---
-> ProcessingMethod
paramset_desc: varchar(128)
Expand All @@ -388,7 +388,7 @@ class ProcessingParamSet(dj.Lookup):
def insert_new_params(
cls,
processing_method: str,
paramset_id: int,
paramset_idx: int,
paramset_desc: str,
params: dict,
processing_method_desc: str = "",
Expand All @@ -397,7 +397,7 @@ def insert_new_params(
Args:
processing_method (str): Name of the processing method or software.
paramset_id (int): Unique number for the set of processing parameters.
paramset_idx (int): Unique number for the set of processing parameters.
paramset_desc (str): Description of the processing parameter set.
params (dict): Dictionary of processing parameters for the selected processing_method.
processing_method_desc (str, optional): Description of the processing method. Defaults to "".
Expand All @@ -411,16 +411,16 @@ def insert_new_params(
)
param_dict = {
"processing_method": processing_method,
"paramset_id": paramset_id,
"paramset_idx": paramset_idx,
"paramset_desc": paramset_desc,
"params": params,
"param_set_hash": dict_to_uuid(params),
}
q_param = cls & {"param_set_hash": param_dict["param_set_hash"]}

if q_param: # If the specified param-set already exists
pname = q_param.fetch1("paramset_id")
if pname == paramset_id: # If the existed set has the same name: job done
pname = q_param.fetch1("paramset_idx")
if pname == paramset_idx: # If the existed set has the same name: job done
return
else: # If not same name: human error, try adding with different name
raise dj.DataJointError(
Expand Down

0 comments on commit 11d9e71

Please sign in to comment.