Skip to content

Commit

Permalink
Pin versions before moving to region-grower >= 0.2
Browse files Browse the repository at this point in the history
Change-Id: If9b5778cf125e7816868943d219773a33c4ae9b0
  • Loading branch information
adrien-berchet committed May 6, 2021
1 parent f6c43b3 commit a2529e1
Show file tree
Hide file tree
Showing 13 changed files with 105 additions and 104 deletions.
15 changes: 7 additions & 8 deletions requirements/base.pip
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
atlas_analysis>0.0.1
brainbuilder>=0.14
bluepyefe
bluepyopt
bluepy>=2.3,<3
bluepymm
diameter_synthesis>=0.1.8
diameter_synthesis<=0.2
gitpython
jinja2
joblib
luigi
luigi-tools>=0.0.10
matplotlib
morph_tool>=2.3.1
morphio>=2.7
morphio>=3,<4
neuroc
neurom>=2.0.1
neurom>=2.0.1,<2.1
pandas
placement_algorithm>=2.1.3
PyYAML
region_grower
region_grower<0.2
scipy
seaborn
tns>=2.3.3
tns>=2.3.3,<2.4
tmd
tqdm
voxcell>=3
voxcell>=3,<4
3 changes: 2 additions & 1 deletion src/morphval/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
from copy import deepcopy

from neurom import viewer, geom, NeuriteType
from neurom.core import Population, iter_neurites
from neurom.core import iter_neurites
from neurom.core.dataformat import COLS
from neurom.core.population import Population
from neurom.core.types import tree_type_checker as is_type
from region_grower.utils import NumpyEncoder

Expand Down
22 changes: 11 additions & 11 deletions src/synthesis_workflow/tasks/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class CreateAtlasLayerAnnotations(WorkflowTask):
)

def run(self):
""""""
""" """
annotation, layer_mapping = get_layer_tags(CircuitConfig().atlas_path)

if self.use_half:
Expand All @@ -70,7 +70,7 @@ def run(self):
)

def output(self):
""""""
""" """
annotation_path = Path(self.layer_annotations_path)
annotation_base_name = annotation_path.with_suffix("").name
layer_mapping_path = annotation_path.with_name(
Expand Down Expand Up @@ -124,11 +124,11 @@ class CreateAtlasPlanes(WorkflowTask):
)

def requires(self):
""""""
""" """
return CreateAtlasLayerAnnotations()

def run(self):
""""""
""" """
layer_annotation = VoxelData.load_nrrd(self.input()["annotations"].path)
planes, centerline = create_planes(
layer_annotation,
Expand All @@ -143,7 +143,7 @@ def run(self):
save_planes_centerline(self.output().path, planes, centerline)

def output(self):
""""""
""" """
return AtlasLocalTarget(self.atlas_planes_path + ".npz")


Expand Down Expand Up @@ -172,11 +172,11 @@ class BuildCircuit(WorkflowTask):
seed = luigi.IntParameter(default=None, description=":int: Pseudo-random generator seed.")

def requires(self):
""""""
""" """
return GetSynthesisInputs()

def run(self):
""""""
""" """
cell_composition_path = self.input().pathlib_path / self.cell_composition_path
mtype_taxonomy_path = self.input().pathlib_path / self.mtype_taxonomy_path

Expand All @@ -197,7 +197,7 @@ def run(self):
cells.save(self.output().path)

def output(self):
""""""
""" """
return CircuitLocalTarget(CircuitConfig().circuit_somata_path)


Expand Down Expand Up @@ -225,14 +225,14 @@ class SliceCircuit(WorkflowTask):
)

def requires(self):
""""""
""" """
return {
"atlas_planes": CreateAtlasPlanes(),
"circuit": BuildCircuit(),
}

def run(self):
""""""
""" """
planes = load_planes_centerline(self.input()["atlas_planes"].path)["planes"]

_slicer = partial(
Expand All @@ -249,5 +249,5 @@ def run(self):
raise Exception("No cells will be synthtesized, better stop here.")

def output(self):
""""""
""" """
return CircuitLocalTarget(self.sliced_circuit_path)
10 changes: 5 additions & 5 deletions src/synthesis_workflow/tasks/diametrizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class BuildDiameterModels(WorkflowTask):
plot_models = BoolParameter()

def run(self):
""""""
""" """
raise DeprecationWarning("This task must be updated to be used")
# pylint: disable=unreachable

Expand Down Expand Up @@ -117,7 +117,7 @@ def run(self):
_plot_models(models_params, models_data, fig_folder="figures", ext=".png")

def output(self):
""""""
""" """
return OutputLocalTarget(self.diameter_models_path)


Expand Down Expand Up @@ -160,11 +160,11 @@ class Diametrize(WorkflowTask):
new_morphs_df_path = luigi.Parameter(default="diametrized_morphs_df.csv")

def requires(self):
""""""
""" """
return BuildDiameterModels()

def run(self):
""""""
""" """
raise DeprecationWarning("This task must be updated to be used")
# pylint: disable=unreachable

Expand Down Expand Up @@ -197,5 +197,5 @@ def run(self):
update_morphs_df(self.morphs_df_path, morphs_df).to_csv(self.output().path, index=False)

def output(self):
""""""
""" """
return OutputLocalTarget(self.new_morphs_df_path)
50 changes: 25 additions & 25 deletions src/synthesis_workflow/tasks/synthesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ class BuildMorphsDF(WorkflowTask):
)

def requires(self):
""""""
""" """
return GetSynthesisInputs()

def run(self):
""""""
""" """

neurondb_path = find_case_insensitive_file(self.neurondb_path)

Expand All @@ -89,7 +89,7 @@ def run(self):
morphs_df.to_csv(self.output().path)

def output(self):
""""""
""" """
return MorphsDfLocalTarget(PathConfig().morphs_df_path)


Expand All @@ -105,14 +105,14 @@ class ApplySubstitutionRules(WorkflowTask):
)

def requires(self):
""""""
""" """
return {
"synthesis_input": GetSynthesisInputs(),
"morphs_df": BuildMorphsDF(),
}

def run(self):
""""""
""" """
substitution_rules_path = (
self.input()["synthesis_input"].pathlib_path / self.substitution_rules_path
)
Expand All @@ -125,7 +125,7 @@ def run(self):
substituted_morphs_df.to_csv(self.output().path, index=False)

def output(self):
""""""
""" """
return MorphsDfLocalTarget(PathConfig().substituted_morphs_df_path)


Expand All @@ -148,14 +148,14 @@ class BuildSynthesisParameters(WorkflowTask):
)

def requires(self):
""""""
""" """
return {
"synthesis_input": GetSynthesisInputs(),
"morphologies": ApplySubstitutionRules(),
}

def run(self):
""""""
""" """
morphs_df = pd.read_csv(self.input()["morphologies"].path)
mtypes = sorted(morphs_df.mtype.unique())
neurite_types = get_neurite_types(morphs_df, mtypes)
Expand Down Expand Up @@ -188,7 +188,7 @@ def run(self):
json.dump(tmd_parameters, f, cls=NumpyEncoder, indent=4, sort_keys=True)

def output(self):
""""""
""" """
return SynthesisLocalTarget(self.tmd_parameters_path)


Expand All @@ -205,11 +205,11 @@ class BuildSynthesisDistributions(WorkflowTask):
"""

def requires(self):
""""""
""" """
return ApplySubstitutionRules()

def run(self):
""""""
""" """
L.debug("reading morphs df from: %s", self.input().path)
morphs_df = pd.read_csv(self.input().path)

Expand Down Expand Up @@ -237,7 +237,7 @@ def run(self):
json.dump(tmd_distributions, f, cls=NumpyEncoder, indent=4, sort_keys=True)

def output(self):
""""""
""" """
return SynthesisLocalTarget(SynthesisConfig().tmd_distributions_path)


Expand All @@ -250,7 +250,7 @@ class BuildAxonMorphsDF(BuildMorphsDF):
)

def output(self):
""""""
""" """
return MorphsDfLocalTarget(self.axon_morphs_df_path)


Expand Down Expand Up @@ -319,7 +319,7 @@ def get_neuron_db_path(self, ext):
return (Path(self.axon_cells_path) / self.neurondb_basename).with_suffix("." + ext)

def requires(self):
""""""
""" """
tasks = {"circuit": SliceCircuit()}

neurondb_path = self.get_neuron_db_path("xml")
Expand All @@ -331,7 +331,7 @@ def requires(self):
return tasks

def run(self):
""""""
""" """
if self.annotations_path is None:
annotations_file = None
neurondb_path = None
Expand Down Expand Up @@ -394,7 +394,7 @@ def run(self):
)

def output(self):
""""""
""" """
targets = {
"morphs": MorphsDfLocalTarget(self.axon_morphs_path),
}
Expand Down Expand Up @@ -447,7 +447,7 @@ class Synthesize(WorkflowTask):
seed = luigi.IntParameter(default=0, description=":int: Pseudo-random generator seed.")

def requires(self):
""""""
""" """

return {
"substituted_cells": ApplySubstitutionRules(),
Expand All @@ -458,7 +458,7 @@ def requires(self):
}

def run(self):
""""""
""" """

axon_morphs_path = self.input()["axons"]["morphs"].path
out_mvd3 = self.output()["out_mvd3"]
Expand Down Expand Up @@ -506,7 +506,7 @@ def run(self):
)

def output(self):
""""""
""" """
outputs = {
"out_mvd3": SynthesisLocalTarget(self.out_circuit_path),
"out_morphologies": SynthesisLocalTarget(PathConfig().synth_output_path),
Expand Down Expand Up @@ -540,15 +540,15 @@ class AddScalingRulesToParameters(WorkflowTask):
)

def requires(self):
""""""
""" """
return {
"synthesis_input": GetSynthesisInputs(),
"morphologies": ApplySubstitutionRules(),
"tmd_parameters": BuildSynthesisParameters(),
}

def run(self):
""""""
""" """
tmd_parameters = json.load(self.input()["tmd_parameters"].open("r"))

if self.scaling_rules_path is not None:
Expand All @@ -572,7 +572,7 @@ def run(self):
json.dump(tmd_parameters, f, cls=NumpyEncoder, indent=4, sort_keys=True)

def output(self):
""""""
""" """
return SynthesisLocalTarget(self.tmd_parameters_path)


Expand Down Expand Up @@ -619,11 +619,11 @@ class RescaleMorphologies(WorkflowTask):
)

def requires(self):
""""""
""" """
return ApplySubstitutionRules()

def run(self):
""""""
""" """
morphs_df = pd.read_csv(self.input().path)
scaling_rules = yaml.full_load(open(self.scaling_rules_path, "r"))
rescaled_morphs_df = rescale_morphologies(
Expand All @@ -640,5 +640,5 @@ def run(self):
rescaled_morphs_df.to_csv(self.output().path, index=False)

def output(self):
""""""
""" """
return MorphsDfLocalTarget(self.rescaled_morphs_df_path)
Loading

0 comments on commit a2529e1

Please sign in to comment.