Skip to content

Commit

Permalink
Format Python code with psf/black push (#374)
Browse files Browse the repository at this point in the history
There appear to be some python formatting errors in
380fbb3. This pull request
uses the [psf/black](https://github.com/psf/black) formatter to fix
these issues.
  • Loading branch information
mzouink authored Feb 26, 2025
2 parents 380fbb3 + dcea3cb commit 1179b4b
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 10 deletions.
4 changes: 3 additions & 1 deletion dacapo/apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ def apply(
raise ValueError(
"validation_dataset must be a dataset name or a Dataset object, or parameters must be provided explicitly."
)
logger.info(f"Finding best parameters for validation dataset {_validation_dataset}")
logger.info(
f"Finding best parameters for validation dataset {_validation_dataset}"
)
parameters = run.task.evaluator.get_overall_best_parameters(
_validation_dataset, criterion
)
Expand Down
1 change: 1 addition & 0 deletions dacapo/experiments/datasplits/datasplit.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

logger = logging.getLogger(__name__)


class DataSplit(ABC):
"""
A class for creating a simple train dataset and no validation dataset. It is derived from `DataSplit` class.
Expand Down
2 changes: 1 addition & 1 deletion dacapo/experiments/trainers/gp_augments/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
from .gamma_config import GammaAugmentConfig
from .intensity_config import IntensityAugmentConfig
from .intensity_scale_shift_config import IntensityScaleShiftAugmentConfig
from .noise_config import NoiseAugmentConfig
from .noise_config import NoiseAugmentConfig
1 change: 0 additions & 1 deletion dacapo/experiments/trainers/gunpowder_trainer_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ def load_batch(event):
input("Enter to quit!")



# ## Example
# config = GunpowderTrainerConfig(name="gunpowder")

Expand Down
5 changes: 4 additions & 1 deletion dacapo/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ def train_run(run: RunConfig, validate: bool = True, save_snapshots: bool = Fals
# purposes so you get snapshots quickly.
run.save_snapshot(i, batch, batch_out, snapshot_container)

if i % run.validation_interval == run.validation_interval - 1 or i == run.num_iterations - 1:
if (
i % run.validation_interval == run.validation_interval - 1
or i == run.num_iterations - 1
):
# run "end of epoch steps" such as stepping the learning rate
# scheduler, storing stats, and writing out weights.
try:
Expand Down
6 changes: 3 additions & 3 deletions dacapo/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ def validate_run(
]

for validation_dataset in datasets:
assert validation_dataset.gt is not None, (
"We do not yet support validating on datasets without ground truth"
)
assert (
validation_dataset.gt is not None
), "We do not yet support validating on datasets without ground truth"
logger.info(
"Validating run %s on dataset %s", run.name, validation_dataset.name
)
Expand Down
4 changes: 1 addition & 3 deletions tests/fixtures/trainers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@

@pytest.fixture()
def dummy_trainer():
yield DummyTrainerConfig(
name="dummy_trainer", dummy_attr=True
)
yield DummyTrainerConfig(name="dummy_trainer", dummy_attr=True)


@pytest.fixture()
Expand Down

0 comments on commit 1179b4b

Please sign in to comment.