From 7222448b04b0253fb4da427e14a213f4960549c4 Mon Sep 17 00:00:00 2001 From: luiz Date: Fri, 22 Nov 2024 14:07:06 +0100 Subject: [PATCH] formatting --- examples/example_1.py | 31 +++++++++++-------------------- voluseg/VolusegProcessor.py | 11 ++++++----- voluseg/context.py | 14 ++++++++------ voluseg/main.py | 9 +++------ 4 files changed, 28 insertions(+), 37 deletions(-) diff --git a/examples/example_1.py b/examples/example_1.py index e735506..531ca19 100644 --- a/examples/example_1.py +++ b/examples/example_1.py @@ -9,7 +9,7 @@ ) -service_name = os.getenv('DENDRO_SERVICE_NAME', 'luiz-dandihub-service') +service_name = os.getenv("DENDRO_SERVICE_NAME", "luiz-dandihub-service") # Using this file: https://dandiarchive.org/dandiset/000350/0.240822.1759/files?location=sub-20161022-1&page=1 @@ -21,41 +21,32 @@ def main(): "timepoints": 1000, } job_def = DendroJobDefinition( - appName='voluseg', - processorName='voluseg_processor', + appName="voluseg", + processorName="voluseg_processor", inputFiles=[ DendroJobInputFile( - name='input', - fileBaseName='sub-20161022-1', + name="input", + fileBaseName="sub-20161022-1", url="https://dandiarchive.s3.amazonaws.com/blobs/057/ecb/057ecbef-e732-4e94-8d99-40ebb74d346e", ) ], - outputFiles=[ - DendroJobOutputFile( - name='output', - fileBaseName='output.txt' - ) - ], + outputFiles=[DendroJobOutputFile(name="output", fileBaseName="output.txt")], parameters=[ - DendroJobParameter(name=k, value=v) - for k, v in parameters_dict.items() - ] + DendroJobParameter(name=k, value=v) for k, v in parameters_dict.items() + ], ) required_resources = DendroJobRequiredResources( - numCpus=24, - numGpus=0, - memoryGb=120, - timeSec=6*3600 + numCpus=24, numGpus=0, memoryGb=120, timeSec=6 * 3600 ) job = submit_job( service_name=service_name, job_definition=job_def, required_resources=required_resources, target_compute_client_ids=["*"], - tags=['example'], + tags=["example"], ) print(job.job_url, job.status) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/voluseg/VolusegProcessor.py b/voluseg/VolusegProcessor.py index f70cc1e..1e4ebc2 100644 --- a/voluseg/VolusegProcessor.py +++ b/voluseg/VolusegProcessor.py @@ -3,16 +3,17 @@ class VolusegProcessor(ProcessorBase): - name = 'voluseg_processor' - description = 'Run Voluseg for volumetric segmentation.' - label = 'voluseg_processor' - image = 'ghcr.io/catalystneuro/dendro-voluseg:latest' - executable = '/app/main.py' + name = "voluseg_processor" + description = "Run Voluseg for volumetric segmentation." + label = "voluseg_processor" + image = "ghcr.io/catalystneuro/dendro-voluseg:latest" + executable = "/app/main.py" attributes = {} @staticmethod def run(context: VolusegContext): import os + # import lindi import voluseg diff --git a/voluseg/context.py b/voluseg/context.py index 2738f9b..06dab11 100644 --- a/voluseg/context.py +++ b/voluseg/context.py @@ -2,17 +2,19 @@ class VolusegContext(BaseModel): - input: InputFile = Field(description='Input NWB file in .nwb or .nwb.lindi.tar format') - output: OutputFile = Field(description='Output embedding in .lindi.tar format') + input: InputFile = Field( + description="Input NWB file in .nwb or .nwb.lindi.tar format" + ) + output: OutputFile = Field(description="Output embedding in .lindi.tar format") detrending: str = Field( default="standard", description="Type of detrending: 'standard', 'robust', or 'none'", - json_schema_extra={'options': ["standard", "robust", "none"]}, + json_schema_extra={"options": ["standard", "robust", "none"]}, ) registration: str = Field( default="medium", description="Quality of registration: 'high', 'medium', 'low' or 'none'", - json_schema_extra={'options': ["high", "medium", "low", "none"]}, + json_schema_extra={"options": ["high", "medium", "low", "none"]}, ) registration_restrict: str = Field( default="", @@ -49,12 +51,12 @@ class VolusegContext(BaseModel): type_timepoints: str = Field( default="dff", description="Type of timepoints to use for cell detection: 'dff', 'periodic' or 'custom'", - json_schema_extra={'options': ["dff", "periodic", "custom"]}, + json_schema_extra={"options": ["dff", "periodic", "custom"]}, ) type_mask: str = Field( default="geomean", description="Type of volume averaging for mask: 'mean', 'geomean' or 'max'", - json_schema_extra={'options': ["mean", "geomean", "max"]}, + json_schema_extra={"options": ["mean", "geomean", "max"]}, ) timepoints: int = Field( default=1000, diff --git a/voluseg/main.py b/voluseg/main.py index 0826f95..f7fd874 100755 --- a/voluseg/main.py +++ b/voluseg/main.py @@ -2,13 +2,10 @@ from VolusegProcessor import VolusegProcessor -app = App( - app_name='voluseg', - description='Voluseg processors' -) +app = App(app_name="voluseg", description="Voluseg processors") app.add_processor(VolusegProcessor) -if __name__ == '__main__': - app.run() \ No newline at end of file +if __name__ == "__main__": + app.run()