diff --git a/model_management/mm_run_minimal/emodels_dir/singlecell-optimization/setup/__init__.py b/model_management/mm_run_minimal/emodels_dir/singlecell-optimization/setup/__init__.py index 63286bda..8a636ee1 100644 --- a/model_management/mm_run_minimal/emodels_dir/singlecell-optimization/setup/__init__.py +++ b/model_management/mm_run_minimal/emodels_dir/singlecell-optimization/setup/__init__.py @@ -17,8 +17,10 @@ To view a copy of this license, visit https://creativecommons.org/licenses/by/4.0/legalcode or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. """ + from neuron import h -if hasattr(h, 'nrnunit_use_legacy'): + +if hasattr(h, "nrnunit_use_legacy"): h.nrnunit_use_legacy(True) from . import evaluator from . import template diff --git a/model_management/mm_run_minimal/emodels_dir/singlecell-optimization/setup/evaluator.py b/model_management/mm_run_minimal/emodels_dir/singlecell-optimization/setup/evaluator.py index ce88d15a..335a2918 100644 --- a/model_management/mm_run_minimal/emodels_dir/singlecell-optimization/setup/evaluator.py +++ b/model_management/mm_run_minimal/emodels_dir/singlecell-optimization/setup/evaluator.py @@ -405,14 +405,16 @@ def define_protocols( "type" in protocol_definition and protocol_definition["type"] == "RatSSCxThresholdDetectionProtocol" ): - protocols_dict[ - "ThresholdDetection" - ] = protocols.RatSSCxThresholdDetectionProtocol( - "IDRest", - step_protocol_template=read_step_protocol( - "Threshold", protocol_definition["step_template"], recordings - ), - prefix=prefix, + protocols_dict["ThresholdDetection"] = ( + protocols.RatSSCxThresholdDetectionProtocol( + "IDRest", + step_protocol_template=read_step_protocol( + "Threshold", + protocol_definition["step_template"], + recordings, + ), + prefix=prefix, + ) ) else: stimuli = [] @@ -488,7 +490,6 @@ def calculate_score(self, responses, trace_check=False): class eFELFeatureExtra(eFELFeature): - """eFEL feature extra""" SERIALIZED_FIELDS = ( @@ -647,7 +648,6 @@ def calculate_score(self, responses, trace_check=False): class SingletonWeightObjective(EFeatureObjective): - """Single EPhys feature""" def __init__(self, name, feature, weight): @@ -775,7 +775,6 @@ def define_fitness_calculator( class MultiEvaluator(bpopt.evaluators.Evaluator): - """Multiple cell evaluator""" def __init__( diff --git a/model_management/mm_run_minimal/emodels_dir/singlecell-optimization/setup/protocols.py b/model_management/mm_run_minimal/emodels_dir/singlecell-optimization/setup/protocols.py index 81d19d3a..02e39092 100644 --- a/model_management/mm_run_minimal/emodels_dir/singlecell-optimization/setup/protocols.py +++ b/model_management/mm_run_minimal/emodels_dir/singlecell-optimization/setup/protocols.py @@ -38,7 +38,6 @@ class RatSSCxMainProtocol(ephys.protocols.Protocol): - """Main protocol to fit RatSSCx neuron ephys parameters. Pseudo code: @@ -193,7 +192,6 @@ def run(self, cell_model, param_values, sim=None, isolate=None): class RatSSCxRinHoldcurrentProtocol(ephys.protocols.Protocol): - """IDRest protocol to fit RatSSCx neuron ephys parameters""" def __init__( @@ -385,7 +383,6 @@ def voltage_base(self, current, cell_model, param_values, sim=None, short=False) class RatSSCxThresholdDetectionProtocol(ephys.protocols.Protocol): - """IDRest protocol to fit RatSSCx neuron ephys parameters""" def __init__( @@ -641,7 +638,6 @@ def search_spike_threshold( class StepProtocol(ephys.protocols.SweepProtocol): - """Protocol consisting of step and holding current""" def __init__( @@ -665,9 +661,11 @@ def __init__( super(StepProtocol, self).__init__( name, - stimuli=step_stimuli + [holding_stimulus] - if holding_stimulus is not None - else step_stimuli, + stimuli=( + step_stimuli + [holding_stimulus] + if holding_stimulus is not None + else step_stimuli + ), recordings=recordings, cvode_active=cvode_active, ) @@ -752,7 +750,6 @@ def step_amplitude(self): class StepThresholdProtocol(StepProtocol): - """Step protocol based on threshold""" def __init__( diff --git a/model_management/mm_run_minimal/emodels_dir/singlecell-optimization/setup/template.py b/model_management/mm_run_minimal/emodels_dir/singlecell-optimization/setup/template.py index c1370c4e..8c7044c7 100644 --- a/model_management/mm_run_minimal/emodels_dir/singlecell-optimization/setup/template.py +++ b/model_management/mm_run_minimal/emodels_dir/singlecell-optimization/setup/template.py @@ -122,12 +122,12 @@ def define_parameters(params_filename, stage=None, past_params=None): dist_param_names = definition["parameters"] else: dist_param_names = None - distributions[ - distribution - ] = ephys.parameterscalers.NrnSegmentSomaDistanceScaler( - name=distribution, - distribution=definition["fun"], - dist_param_names=dist_param_names, + distributions[distribution] = ( + ephys.parameterscalers.NrnSegmentSomaDistanceScaler( + name=distribution, + distribution=definition["fun"], + dist_param_names=dist_param_names, + ) ) params_definitions = definitions["parameters"] diff --git a/model_management/mm_run_minimal/tests/test_model_management.py b/model_management/mm_run_minimal/tests/test_model_management.py index 406cebfc..518a5418 100644 --- a/model_management/mm_run_minimal/tests/test_model_management.py +++ b/model_management/mm_run_minimal/tests/test_model_management.py @@ -18,7 +18,6 @@ Second Street, Suite 300, San Francisco, California, 94105, USA. """ - """Test to validate the model management output.""" from pathlib import Path diff --git a/optimization/opt_module/setup/__init__.py b/optimization/opt_module/setup/__init__.py index 05c85a71..346cda02 100644 --- a/optimization/opt_module/setup/__init__.py +++ b/optimization/opt_module/setup/__init__.py @@ -17,8 +17,10 @@ To view a copy of this license, visit https://creativecommons.org/licenses/by/4.0/legalcode or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. """ + from neuron import h -if hasattr(h, 'nrnunit_use_legacy'): + +if hasattr(h, "nrnunit_use_legacy"): h.nrnunit_use_legacy(True) from . import evaluator diff --git a/optimization/opt_module/setup/evaluator.py b/optimization/opt_module/setup/evaluator.py index bef7449c..53bc6155 100644 --- a/optimization/opt_module/setup/evaluator.py +++ b/optimization/opt_module/setup/evaluator.py @@ -408,14 +408,16 @@ def define_protocols( "type" in protocol_definition and protocol_definition["type"] == "RatSSCxThresholdDetectionProtocol" ): - protocols_dict[ - "ThresholdDetection" - ] = protocols.RatSSCxThresholdDetectionProtocol( - "IDRest", - step_protocol_template=read_step_protocol( - "Threshold", protocol_definition["step_template"], recordings - ), - prefix=prefix, + protocols_dict["ThresholdDetection"] = ( + protocols.RatSSCxThresholdDetectionProtocol( + "IDRest", + step_protocol_template=read_step_protocol( + "Threshold", + protocol_definition["step_template"], + recordings, + ), + prefix=prefix, + ) ) else: stimuli = [] @@ -491,7 +493,6 @@ def calculate_score(self, responses, trace_check=False): class eFELFeatureExtra(eFELFeature): - """eFEL feature extra""" SERIALIZED_FIELDS = ( @@ -666,7 +667,6 @@ def calculate_score(self, responses, trace_check=False): class SingletonWeightObjective(EFeatureObjective): - """Single EPhys feature""" def __init__(self, name, feature, weight): @@ -794,7 +794,6 @@ def define_fitness_calculator( class MultiEvaluator(bpopt.evaluators.Evaluator): - """Multiple cell evaluator""" def __init__( diff --git a/optimization/opt_module/setup/protocols.py b/optimization/opt_module/setup/protocols.py index 2111553a..540dc5e2 100644 --- a/optimization/opt_module/setup/protocols.py +++ b/optimization/opt_module/setup/protocols.py @@ -18,7 +18,6 @@ Second Street, Suite 300, San Francisco, California, 94105, USA. """ - """Protocols involved in fitting of RatSSCx neuron ephys parameters""" import numpy @@ -45,7 +44,6 @@ class RatSSCxMainProtocol(ephys.protocols.Protocol): - """Main protocol to fit RatSSCx neuron ephys parameters. Pseudo code: @@ -220,7 +218,6 @@ def run(self, cell_model, param_values, sim=None, isolate=None): class RatSSCxRinHoldcurrentProtocol(ephys.protocols.Protocol): - """IDRest protocol to fit RatSSCx neuron ephys parameters""" def __init__( @@ -424,7 +421,6 @@ def voltage_base(self, current, cell_model, param_values, sim=None, short=False) class RatSSCxThresholdDetectionProtocol(ephys.protocols.Protocol): - """IDRest protocol to fit RatSSCx neuron ephys parameters""" def __init__( @@ -704,7 +700,6 @@ def search_spike_threshold( class StepProtocol(ephys.protocols.SweepProtocol): - """Protocol consisting of step and holding current""" def __init__( @@ -728,9 +723,11 @@ def __init__( super(StepProtocol, self).__init__( name, - stimuli=step_stimuli + [holding_stimulus] - if holding_stimulus is not None - else step_stimuli, + stimuli=( + step_stimuli + [holding_stimulus] + if holding_stimulus is not None + else step_stimuli + ), recordings=recordings, cvode_active=cvode_active, ) @@ -815,7 +812,6 @@ def step_amplitude(self): class StepThresholdProtocol(StepProtocol): - """Step protocol based on threshold""" def __init__( diff --git a/optimization/opt_module/setup/template.py b/optimization/opt_module/setup/template.py index 36da1505..d23a86d0 100644 --- a/optimization/opt_module/setup/template.py +++ b/optimization/opt_module/setup/template.py @@ -130,12 +130,12 @@ def define_parameters(params_filename, stage=None, past_params=None): dist_param_names = definition["parameters"] else: dist_param_names = None - distributions[ - distribution - ] = ephys.parameterscalers.NrnSegmentSomaDistanceScaler( - name=distribution, - distribution=definition["fun"], - dist_param_names=dist_param_names, + distributions[distribution] = ( + ephys.parameterscalers.NrnSegmentSomaDistanceScaler( + name=distribution, + distribution=definition["fun"], + dist_param_names=dist_param_names, + ) ) params_definitions = definitions["parameters"] diff --git a/optimization/opt_module/tools/plot.py b/optimization/opt_module/tools/plot.py index d967981e..344bde21 100644 --- a/optimization/opt_module/tools/plot.py +++ b/optimization/opt_module/tools/plot.py @@ -18,7 +18,6 @@ Second Street, Suite 300, San Francisco, California, 94105, USA. """ - import numpy import seaborn as sns import pandas as pd diff --git a/optimization/opt_module/tools/plottools.py b/optimization/opt_module/tools/plottools.py index b1d8b81e..05d2de3a 100644 --- a/optimization/opt_module/tools/plottools.py +++ b/optimization/opt_module/tools/plottools.py @@ -18,7 +18,6 @@ Second Street, Suite 300, San Francisco, California, 94105, USA. """ - import matplotlib import matplotlib.pyplot as plt diff --git a/somatic_validation/model.py b/somatic_validation/model.py index 5d341d62..e462953d 100644 --- a/somatic_validation/model.py +++ b/somatic_validation/model.py @@ -18,7 +18,6 @@ Second Street, Suite 300, San Francisco, California, 94105, USA. """ - import os import collections import json @@ -110,12 +109,12 @@ def define_parameters(path_params): dist_param_names = definition["parameters"] else: dist_param_names = None - distributions[ - distribution - ] = ephys.parameterscalers.NrnSegmentSomaDistanceScaler( - name=distribution, - distribution=definition["fun"], - dist_param_names=dist_param_names, + distributions[distribution] = ( + ephys.parameterscalers.NrnSegmentSomaDistanceScaler( + name=distribution, + distribution=definition["fun"], + dist_param_names=dist_param_names, + ) ) params_definitions = definitions["parameters"] diff --git a/somatic_validation/stimuli.py b/somatic_validation/stimuli.py index f3854e93..28b00788 100644 --- a/somatic_validation/stimuli.py +++ b/somatic_validation/stimuli.py @@ -28,14 +28,12 @@ class Stimulus(object): - """Stimulus protocol""" pass class NrnHDPulse(Stimulus): - """Square pulse current clamp injection""" def __init__( diff --git a/validation/lib/attenuation.py b/validation/lib/attenuation.py index 6cb86d64..d75b5285 100644 --- a/validation/lib/attenuation.py +++ b/validation/lib/attenuation.py @@ -826,7 +826,6 @@ def EPSP(evaluator, emodels_path, points): class NrnSynStim(ephys.stimuli.Stimulus): - """Square pulse current clamp injection""" def __init__( diff --git a/validation/lib/plottools.py b/validation/lib/plottools.py index b338da0a..0ebedb48 100644 --- a/validation/lib/plottools.py +++ b/validation/lib/plottools.py @@ -18,7 +18,6 @@ Second Street, Suite 300, San Francisco, California, 94105, USA. """ - import matplotlib import matplotlib.pyplot as plt diff --git a/validation/lib/setup/__init__.py b/validation/lib/setup/__init__.py index 749071d3..5fa4349b 100644 --- a/validation/lib/setup/__init__.py +++ b/validation/lib/setup/__init__.py @@ -17,4 +17,5 @@ To view a copy of this license, visit https://creativecommons.org/licenses/by/4.0/legalcode or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. """ + from . import evaluator diff --git a/validation/lib/setup/evaluator.py b/validation/lib/setup/evaluator.py index dba8e4f1..b4733d27 100644 --- a/validation/lib/setup/evaluator.py +++ b/validation/lib/setup/evaluator.py @@ -260,14 +260,16 @@ def define_protocols( "type" in protocol_definition and protocol_definition["type"] == "RatSSCxThresholdDetectionProtocol" ): - protocols_dict[ - "ThresholdDetection" - ] = protocols.RatSSCxThresholdDetectionProtocol( - "IDRest", - step_protocol_template=read_step_protocol( - "Threshold", protocol_definition["step_template"], recordings - ), - prefix=prefix, + protocols_dict["ThresholdDetection"] = ( + protocols.RatSSCxThresholdDetectionProtocol( + "IDRest", + step_protocol_template=read_step_protocol( + "Threshold", + protocol_definition["step_template"], + recordings, + ), + prefix=prefix, + ) ) else: stimuli = [] @@ -331,7 +333,6 @@ def define_protocols( class eFELFeatureExtra(eFELFeature): - """eFEL feature extra""" SERIALIZED_FIELDS = ( @@ -419,7 +420,6 @@ def __init__( class SingletonWeightObjective(EFeatureObjective): - """Single EPhys feature""" def __init__(self, name, feature, weight): @@ -547,7 +547,6 @@ def define_fitness_calculator( class MultiEvaluator(bpopt.evaluators.Evaluator): - """Multiple cell evaluator""" def __init__( diff --git a/validation/lib/setup/protocols.py b/validation/lib/setup/protocols.py index bc8ac74c..d0c8f6b8 100644 --- a/validation/lib/setup/protocols.py +++ b/validation/lib/setup/protocols.py @@ -18,7 +18,6 @@ Second Street, Suite 300, San Francisco, California, 94105, USA. """ - """Protocols involved in fitting of RatSSCx neuron ephys parameters""" import numpy @@ -34,7 +33,6 @@ class RatSSCxMainProtocol(ephys.protocols.Protocol): - """Main protocol to fit RatSSCx neuron ephys parameters. Pseudo code: @@ -115,7 +113,6 @@ def rin_efeature(self, value): class RatSSCxRinHoldcurrentProtocol(ephys.protocols.Protocol): - """IDRest protocol to fit RatSSCx neuron ephys parameters""" def __init__( @@ -156,7 +153,6 @@ def subprotocols(self): class RatSSCxThresholdDetectionProtocol(ephys.protocols.Protocol): - """IDRest protocol to fit RatSSCx neuron ephys parameters""" def __init__( @@ -387,7 +383,6 @@ def search_spike_threshold( class StepProtocol(ephys.protocols.SweepProtocol): - """Protocol consisting of step and holding current""" def __init__( @@ -411,9 +406,11 @@ def __init__( super(StepProtocol, self).__init__( name, - stimuli=step_stimuli + [holding_stimulus] - if holding_stimulus is not None - else step_stimuli, + stimuli=( + step_stimuli + [holding_stimulus] + if holding_stimulus is not None + else step_stimuli + ), recordings=recordings, cvode_active=cvode_active, ) @@ -479,7 +476,6 @@ def step_amplitude(self): class StepThresholdProtocol(StepProtocol): - """Step protocol based on threshold""" def __init__( diff --git a/validation/lib/setup/template.py b/validation/lib/setup/template.py index 41ed85b4..027f5fab 100644 --- a/validation/lib/setup/template.py +++ b/validation/lib/setup/template.py @@ -122,12 +122,12 @@ def define_parameters(params_filename, stage=None, past_params=None): dist_param_names = definition["parameters"] else: dist_param_names = None - distributions[ - distribution - ] = ephys.parameterscalers.NrnSegmentSomaDistanceScaler( - name=distribution, - distribution=definition["fun"], - dist_param_names=dist_param_names, + distributions[distribution] = ( + ephys.parameterscalers.NrnSegmentSomaDistanceScaler( + name=distribution, + distribution=definition["fun"], + dist_param_names=dist_param_names, + ) ) params_definitions = definitions["parameters"] diff --git a/validation/lib/tools.py b/validation/lib/tools.py index d54c9282..6f5077db 100644 --- a/validation/lib/tools.py +++ b/validation/lib/tools.py @@ -18,7 +18,6 @@ Second Street, Suite 300, San Francisco, California, 94105, USA. """ - import contextlib import os diff --git a/validation/tests/test_validation.py b/validation/tests/test_validation.py index ec2ff558..ade1ff9e 100644 --- a/validation/tests/test_validation.py +++ b/validation/tests/test_validation.py @@ -18,7 +18,6 @@ Second Street, Suite 300, San Francisco, California, 94105, USA. """ - """Test the validation results on a single sample.""" import json