Skip to content

Commit de7e4a7

Browse files
nischitkumarnischitkumar
and
nischitkumar
authored
Standardize .yml and .yaml Extensions for Consistency (#488)
* Changed .yml to .yaml files * Reverted changes in the main directories of the cellfinder repository * Fixed the dependency errors in the Code * Fixed the train_yml issue * Modified train_yml to train_yaml in the train.py file on both lines 10 and 29 * Modified train_yml to train_yaml in the train.py file on both lines 10 and 29 --------- Co-authored-by: nischitkumar <[email protected]>
1 parent eba4819 commit de7e4a7

File tree

12 files changed

+17
-17
lines changed

12 files changed

+17
-17
lines changed

cellfinder/core/classify/classify.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from cellfinder.core import logger, types
1212
from cellfinder.core.classify.cube_generator import CubeGeneratorFromFile
1313
from cellfinder.core.classify.tools import get_model
14-
from cellfinder.core.train.train_yml import depth_type, models
14+
from cellfinder.core.train.train_yaml import depth_type, models
1515

1616

1717
def main(

cellfinder/core/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from cellfinder.core import logger
88
from cellfinder.core.download.download import model_type
9-
from cellfinder.core.train.train_yml import depth_type
9+
from cellfinder.core.train.train_yaml import depth_type
1010

1111

1212
def main(
File renamed without changes.

cellfinder/napari/curation.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ def save_training_data(
406406
self.update_status_label("Ready")
407407

408408
def __prep_directories_for_save(self):
409-
self.yaml_filename = self.output_directory / "training.yml"
409+
self.yaml_filename = self.output_directory / "training.yaml"
410410
self.cell_cube_dir = self.output_directory / "cells"
411411
self.no_cell_cube_dir = self.output_directory / "non_cells"
412412

cellfinder/napari/train/train.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from napari.utils.notifications import show_info
88
from qtpy.QtWidgets import QScrollArea
99

10-
from cellfinder.core.train.train_yml import run as train_yml
10+
from cellfinder.core.train.train_yaml import run as train_yaml
1111
from cellfinder.napari.utils import cellfinder_header, html_label_widget
1212

1313
from .train_containers import (
@@ -26,7 +26,7 @@ def run_training(
2626
misc_training_inputs: MiscTrainingInputs,
2727
):
2828
print("Running training")
29-
train_yml(
29+
train_yaml(
3030
**training_data_inputs.as_core_arguments(),
3131
**optional_network_inputs.as_core_arguments(),
3232
**optional_training_inputs.as_core_arguments(),

cellfinder/napari/train/train_containers.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from magicgui.types import FileDialogMode
66

77
from cellfinder.core.download.download import model_filenames
8-
from cellfinder.core.train.train_yml import models
8+
from cellfinder.core.train.train_yaml import models
99
from cellfinder.napari.input_container import InputContainer
1010
from cellfinder.napari.utils import html_label_widget
1111

@@ -31,7 +31,7 @@ def widget_representation(cls) -> dict:
3131
"yaml_files",
3232
custom_label="YAML files",
3333
mode=FileDialogMode.EXISTING_FILES,
34-
filter="*.yml",
34+
filter="*.yaml",
3535
),
3636
output_directory=cls._custom_widget(
3737
"output_directory", mode=FileDialogMode.EXISTING_DIRECTORY

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ napari = [
6666

6767
[project.scripts]
6868
cellfinder_download = "cellfinder.core.download.cli:main"
69-
cellfinder_train = "cellfinder.core.train.train_yml:cli"
69+
cellfinder_train = "cellfinder.core.train.train_yaml:cli"
7070
cellfinder = "cellfinder.cli_migration_warning:cli_catch"
7171

7272
[project.urls]

tests/core/test_integration/test_train.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33

44
import pytest
55

6-
from cellfinder.core.train.train_yml import cli as train_run
6+
from cellfinder.core.train.train_yaml import cli as train_run
77

88
data_dir = os.path.join(
99
os.getcwd(), "tests", "data", "integration", "training"
1010
)
1111
cell_cubes = os.path.join(data_dir, "cells")
1212
non_cell_cubes = os.path.join(data_dir, "non_cells")
13-
training_yml_file = os.path.join(data_dir, "training.yml")
13+
training_yaml_file = os.path.join(data_dir, "training.yaml")
1414

1515

1616
EPOCHS = "2"
@@ -26,7 +26,7 @@ def test_train(tmpdir):
2626
train_args = [
2727
"cellfinder_train",
2828
"-y",
29-
training_yml_file,
29+
training_yaml_file,
3030
"-o",
3131
tmpdir,
3232
"--epochs",

tests/napari/test_curation.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def test_cell_marking(curation_widget, tmp_path):
8585
widget.output_directory = tmp_path
8686
widget.save_training_data(prompt_for_directory=False, block=True)
8787

88-
assert (tmp_path / "training.yml").exists()
88+
assert (tmp_path / "training.yaml").exists()
8989
# Check that two .tif files are saved for both cells and non_cells
9090
assert len(list((tmp_path / "non_cells").glob("*.tif"))) == 2
9191
assert len(list((tmp_path / "cells").glob("*.tif"))) == 2

tests/napari/test_train_containers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import pytest
44

5-
from cellfinder.core.train.train_yml import run
5+
from cellfinder.core.train.train_yaml import run
66
from cellfinder.napari.train.train_containers import (
77
MiscTrainingInputs,
88
OptionalNetworkInputs,

tests/napari/test_training.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def test_reset_to_defaults(get_training_widget):
3030
Checks widgets of a few different types are reset as expected.
3131
"""
3232
# change a few widgets to non-default values
33-
get_training_widget.yaml_files.value = ["file_1.yml", "file_2.yml"]
33+
get_training_widget.yaml_files.value = ["file_1.yaml", "file_2.yaml"]
3434
get_training_widget.continue_training.value = True
3535
get_training_widget.epochs.value = 50
3636
get_training_widget.test_fraction.value = 0.20
@@ -65,11 +65,11 @@ def test_run_with_virtual_yaml_files(get_training_widget):
6565
Checks that training is run with expected set of parameters.
6666
"""
6767
with patch("cellfinder.napari.train.train.run_training") as run_training:
68-
# make default input valid - need yml files (they don't technically
68+
# make default input valid - need yaml files (they don't technically
6969
# have to exist)
7070
virtual_yaml_files = (
71-
Path.home() / "file_1.yml",
72-
Path.home() / "file_2.yml",
71+
Path.home() / "file_1.yaml",
72+
Path.home() / "file_2.yaml",
7373
)
7474
get_training_widget.yaml_files.value = virtual_yaml_files
7575
get_training_widget.call_button.clicked()

0 commit comments

Comments
 (0)