Skip to content

Commit

Permalink
changed warnings to not interrupt
Browse files Browse the repository at this point in the history
  • Loading branch information
fishingguy456 committed Jun 13, 2022
1 parent 3ac4016 commit 154819e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions examples/autotest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import struct
import numpy as np
import sys
import warnings

from argparse import ArgumentParser
import SimpleITK as sitk
Expand Down Expand Up @@ -60,11 +61,14 @@ def __init__(self,
self.train_size = train_size
self.random_state = random_state

if self.train_size == 1 or self.train_size == 0:
raise Warning("No train/test split")
if self.train_size == 1.0:
warnings.warn("Train size is 1, all data will be used for training")

if self.train_size == 0.0:
warnings.warn("Train size is 0, all data will be used for testing")

if self.train_size != 1 and not self.nnUnet_info:
raise Warning("Cannot run train/test split without nnUnet, ignoring train_size")
warnings.warn("Cannot run train/test split without nnUnet, ignoring train_size")

if self.train_size > 1 or self.train_size < 0 and self.nnUnet_info:
raise ValueError("train_size must be between 0 and 1")
Expand Down

0 comments on commit 154819e

Please sign in to comment.