-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
272 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"install_path": ".cellfinder_workflows", | ||
"data_url": "https://gin.g-node.org/BrainGlobe/test-data/raw/master/cellfinder/cellfinder-test-data.zip", | ||
"data_hash": "b0ef53b1530e4fa3128fcc0a752d0751909eab129d701f384fc0ea5f138c5914", | ||
"extract_dir_relative": "cellfinder_test_data", | ||
"signal_subdir": "signal", | ||
"background_subdir": "background", | ||
"output_path_basename_relative": "cellfinder_output_", | ||
"detected_cells_filename": "detected_cells.xml", | ||
"voxel_sizes": [ | ||
5, | ||
2, | ||
2 | ||
], | ||
"start_plane": 0, | ||
"end_plane": -1, | ||
"trained_model": null, | ||
"model_weights": null, | ||
"model": "resnet50_tv", | ||
"batch_size": 32, | ||
"n_free_cpus": 2, | ||
"network_voxel_sizes": [ | ||
5, | ||
1, | ||
1 | ||
], | ||
"soma_diameter": 16, | ||
"ball_xy_size": 6, | ||
"ball_z_size": 15, | ||
"ball_overlap_fraction": 0.6, | ||
"log_sigma_size": 0.2, | ||
"n_sds_above_mean_thresh": 10, | ||
"soma_spread_factor": 1.4, | ||
"max_cluster_size": 100000, | ||
"cube_width": 50, | ||
"cube_height": 50, | ||
"cube_depth": 20, | ||
"network_depth": "50" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"install_path": ".cellfinder_workflows", | ||
"data_url": "https://gin.g-node.org/BrainGlobe/test-data/raw/master/cellfinder/cellfinder-test-data.zip", | ||
"data_hash": "b0ef53b1530e4fa3128fcc0a752d0751909eab129d701f384fc0ea5f138c5914", | ||
"extract_dir_relative": "cellfinder_test_data", | ||
"signal_subdir": "signal", | ||
"background_subdir": "background", | ||
"output_path_basename_relative": "cellfinder_output_", | ||
"detected_cells_filename": "detected_cells.xml", | ||
"voxel_sizes": [ | ||
5, | ||
2, | ||
2 | ||
], | ||
"start_plane": 0, | ||
"end_plane": -1, | ||
"trained_model": null, | ||
"model_weights": null, | ||
"model": "resnet50_tv", | ||
"batch_size": 32, | ||
"n_free_cpus": 2, | ||
"network_voxel_sizes": [ | ||
5, | ||
1, | ||
1 | ||
], | ||
"soma_diameter": 16, | ||
"ball_xy_size": 6, | ||
"ball_z_size": 15, | ||
"ball_overlap_fraction": 0.6, | ||
"log_sigma_size": 0.2, | ||
"n_sds_above_mean_thresh": 10, | ||
"soma_spread_factor": 1.4, | ||
"max_cluster_size": 100000, | ||
"cube_width": 50, | ||
"cube_height": 50, | ||
"cube_depth": 20, | ||
"network_depth": "50" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"install_path": ".cellfinder_workflows", | ||
"data_url": "https://gin.g-node.org/BrainGlobe/test-data/raw/master/cellfinder/cellfinder-test-data.zip", | ||
"data_hash": "b0ef53b1530e4fa3128fcc0a752d0751909eab129d701f384fc0ea5f138c5914", | ||
"extract_dir_relative": "cellfinder_test_data", | ||
"signal_subdir": "signal", | ||
"background_subdir": "__", | ||
"output_path_basename_relative": "cellfinder_output_", | ||
"detected_cells_filename": "detected_cells.xml", | ||
"voxel_sizes": [ | ||
5, | ||
2, | ||
2 | ||
], | ||
"start_plane": 0, | ||
"end_plane": -1, | ||
"trained_model": null, | ||
"model_weights": null, | ||
"model": "resnet50_tv", | ||
"batch_size": 32, | ||
"n_free_cpus": 2, | ||
"network_voxel_sizes": [ | ||
5, | ||
1, | ||
1 | ||
], | ||
"soma_diameter": 16, | ||
"ball_xy_size": 6, | ||
"ball_z_size": 15, | ||
"ball_overlap_fraction": 0.6, | ||
"log_sigma_size": 0.2, | ||
"n_sds_above_mean_thresh": 10, | ||
"soma_spread_factor": 1.4, | ||
"max_cluster_size": 100000, | ||
"cube_width": 50, | ||
"cube_height": 50, | ||
"cube_depth": 20, | ||
"network_depth": "50" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"install_path": ".cellfinder_workflows", | ||
"data_url": "https://gin.g-node.org/BrainGlobe/test-data/raw/master/cellfinder/cellfinder-test-data.zip", | ||
"data_hash": "b0ef53b1530e4fa3128fcc0a752d0751909eab129d701f384fc0ea5f138c5914", | ||
"extract_dir_relative": "cellfinder_test_data", | ||
"signal_subdir": "__", | ||
"background_subdir": "background", | ||
"output_path_basename_relative": "cellfinder_output_", | ||
"detected_cells_filename": "detected_cells.xml", | ||
"voxel_sizes": [ | ||
5, | ||
2, | ||
2 | ||
], | ||
"start_plane": 0, | ||
"end_plane": -1, | ||
"trained_model": null, | ||
"model_weights": null, | ||
"model": "resnet50_tv", | ||
"batch_size": 32, | ||
"n_free_cpus": 2, | ||
"network_voxel_sizes": [ | ||
5, | ||
1, | ||
1 | ||
], | ||
"soma_diameter": 16, | ||
"ball_xy_size": 6, | ||
"ball_z_size": 15, | ||
"ball_overlap_fraction": 0.6, | ||
"log_sigma_size": 0.2, | ||
"n_sds_above_mean_thresh": 10, | ||
"soma_spread_factor": 1.4, | ||
"max_cluster_size": 100000, | ||
"cube_width": 50, | ||
"cube_height": 50, | ||
"cube_depth": 20, | ||
"network_depth": "50" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"install_path": ".cellfinder_workflows", | ||
"extract_dir_relative": "cellfinder_test_data", | ||
"signal_subdir": "signal", | ||
"background_subdir": "background", | ||
"output_path_basename_relative": "cellfinder_output_", | ||
"detected_cells_filename": "detected_cells.xml", | ||
"voxel_sizes": [ | ||
5, | ||
2, | ||
2 | ||
], | ||
"start_plane": 0, | ||
"end_plane": -1, | ||
"trained_model": null, | ||
"model_weights": null, | ||
"model": "resnet50_tv", | ||
"batch_size": 32, | ||
"n_free_cpus": 2, | ||
"network_voxel_sizes": [ | ||
5, | ||
1, | ||
1 | ||
], | ||
"soma_diameter": 16, | ||
"ball_xy_size": 6, | ||
"ball_z_size": 15, | ||
"ball_overlap_fraction": 0.6, | ||
"log_sigma_size": 0.2, | ||
"n_sds_above_mean_thresh": 10, | ||
"soma_spread_factor": 1.4, | ||
"max_cluster_size": 100000, | ||
"cube_width": 50, | ||
"cube_height": 50, | ||
"cube_depth": 20, | ||
"network_depth": "50" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,75 @@ | ||
# cellfinder-specific unit tests | ||
import json | ||
import logging | ||
|
||
from workflows.cellfinder import read_cellfinder_config, retrieve_input_data | ||
from workflows.utils import DEFAULT_JSON_CONFIG_PATH_CELLFINDER | ||
|
||
# @pytest.fixture() --- for where configs are | ||
# def | ||
|
||
|
||
def test_read_cellfinder_config( | ||
input_config_path=DEFAULT_JSON_CONFIG_PATH_CELLFINDER, | ||
): | ||
# read json as Cellfinder config | ||
config = read_cellfinder_config(input_config_path) | ||
|
||
# read json as dict | ||
with open(input_config_path) as cfg: | ||
config_dict = json.load(cfg) | ||
|
||
# check keys of dict are a subset of Cellfinder config attributes | ||
assert all( | ||
[ky in config.__dataclass_fields__.keys() for ky in config_dict.keys()] | ||
) | ||
|
||
|
||
# define different configs | ||
# @pytest.mark.parametrize( | ||
# "input_config_path, message", | ||
# [ | ||
# (DEFAULT_JSON_CONFIG_PATH_CELLFINDER, | ||
# "Fetching input data from the local directories"), | ||
# (, "The directory does not exist"), | ||
# (, "The directory does not exist"), | ||
# (,"Input data not found locally, | ||
# and URL/hash to GIN repository not provided"), | ||
# (,"Fetching input data from the provided GIN repository") | ||
# ] | ||
# ) | ||
def test_retrieve_input_data(caplog, input_config_path, message): | ||
# set logger to capture | ||
caplog.set_level( | ||
logging.DEBUG, logger="root" | ||
) # --- why root? :( "workflows.utils") | ||
|
||
# read json as Cellfinder config | ||
config = read_cellfinder_config(input_config_path) | ||
|
||
# retrieve data | ||
retrieve_input_data(config) | ||
|
||
assert message in caplog.messages | ||
|
||
# if ( | ||
# Path(config.signal_dir_path).exists() | ||
# and Path(config.background_dir_path).exists() | ||
# ): | ||
|
||
# # with caplog.at_level( | ||
# # logging.DEBUG, | ||
# # logger="root" # why root? | ||
# # ): | ||
# updated_config = retrieve_input_data(config) | ||
|
||
# assert message in caplog.messages | ||
|
||
# # If exactly one of the input data directories is missing, print error | ||
# elif ( | ||
# Path(config.signal_dir_path).resolve().exists() | ||
# or Path(config.background_dir_path).resolve().exists() | ||
# ): | ||
|
||
|
||
# def test_setup_workflow(): | ||
# pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters