How to use the csbdeep.models.Config function in csbdeep

To help you get started, we’ve selected a few csbdeep examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CSBDeep / CSBDeep / tests / test_models.py View on Github external
(_with_channel('YX'),_with_channel('YX')),
        (_with_channel('XYZ'),_with_channel('XYZ')),
        (_with_channel('XTY'),_with_channel('XTY')),
        (_with_channel('SYX'),_with_channel('YX')),
        (_with_channel('STYX'),_with_channel('TYX')),
        (_with_channel('SXYZ'),_with_channel('XYZ')),
    ]

    for (axes,axes_ref) in axes_list:
        assert Config(axes).axes == axes_ref

    with pytest.raises(ValueError):
        Config('XYC')
        Config('CXY')
    with pytest.raises(ValueError):
        Config('XYZC')
        Config('CXYZ')
    with pytest.raises(ValueError):
        Config('XTYC')
        Config('CXTY')
    with pytest.raises(ValueError): Config('XYZT')
    with pytest.raises(ValueError): Config('tXYZ')
    with pytest.raises(ValueError): Config('XYS')
    with pytest.raises(ValueError): Config('XSYZ')
github CSBDeep / CSBDeep / tests / test_models.py View on Github external
for (axes,axes_ref) in axes_list:
        assert Config(axes).axes == axes_ref

    with pytest.raises(ValueError):
        Config('XYC')
        Config('CXY')
    with pytest.raises(ValueError):
        Config('XYZC')
        Config('CXYZ')
    with pytest.raises(ValueError):
        Config('XTYC')
        Config('CXTY')
    with pytest.raises(ValueError): Config('XYZT')
    with pytest.raises(ValueError): Config('tXYZ')
    with pytest.raises(ValueError): Config('XYS')
    with pytest.raises(ValueError): Config('XSYZ')
github CSBDeep / CSBDeep / tests / test_models.py View on Github external
(_with_channel('SXYZ'),_with_channel('XYZ')),
    ]

    for (axes,axes_ref) in axes_list:
        assert Config(axes).axes == axes_ref

    with pytest.raises(ValueError):
        Config('XYC')
        Config('CXY')
    with pytest.raises(ValueError):
        Config('XYZC')
        Config('CXYZ')
    with pytest.raises(ValueError):
        Config('XTYC')
        Config('CXTY')
    with pytest.raises(ValueError): Config('XYZT')
    with pytest.raises(ValueError): Config('tXYZ')
    with pytest.raises(ValueError): Config('XYS')
    with pytest.raises(ValueError): Config('XSYZ')
github CSBDeep / CSBDeep / tests / test_models.py View on Github external
for (axes,axes_ref) in axes_list:
        assert Config(axes).axes == axes_ref

    with pytest.raises(ValueError):
        Config('XYC')
        Config('CXY')
    with pytest.raises(ValueError):
        Config('XYZC')
        Config('CXYZ')
    with pytest.raises(ValueError):
        Config('XTYC')
        Config('CXTY')
    with pytest.raises(ValueError): Config('XYZT')
    with pytest.raises(ValueError): Config('tXYZ')
    with pytest.raises(ValueError): Config('XYS')
    with pytest.raises(ValueError): Config('XSYZ')
github CSBDeep / CSBDeep / tests / test_models.py View on Github external
('SYX',_with_channel('YX')),
        ('SXYZ',_with_channel('XYZ')),
        ('SXTY',_with_channel('XTY')),
        (_with_channel('YX'),_with_channel('YX')),
        (_with_channel('XYZ'),_with_channel('XYZ')),
        (_with_channel('XTY'),_with_channel('XTY')),
        (_with_channel('SYX'),_with_channel('YX')),
        (_with_channel('STYX'),_with_channel('TYX')),
        (_with_channel('SXYZ'),_with_channel('XYZ')),
    ]

    for (axes,axes_ref) in axes_list:
        assert Config(axes).axes == axes_ref

    with pytest.raises(ValueError):
        Config('XYC')
        Config('CXY')
    with pytest.raises(ValueError):
        Config('XYZC')
        Config('CXYZ')
    with pytest.raises(ValueError):
        Config('XTYC')
        Config('CXTY')
    with pytest.raises(ValueError): Config('XYZT')
    with pytest.raises(ValueError): Config('tXYZ')
    with pytest.raises(ValueError): Config('XYS')
    with pytest.raises(ValueError): Config('XSYZ')
github CSBDeep / CSBDeep / tests / test_models.py View on Github external
('YX',_with_channel('YX')),
        ('XYZ',_with_channel('XYZ')),
        ('XYT',_with_channel('XYT')),
        ('SYX',_with_channel('YX')),
        ('SXYZ',_with_channel('XYZ')),
        ('SXTY',_with_channel('XTY')),
        (_with_channel('YX'),_with_channel('YX')),
        (_with_channel('XYZ'),_with_channel('XYZ')),
        (_with_channel('XTY'),_with_channel('XTY')),
        (_with_channel('SYX'),_with_channel('YX')),
        (_with_channel('STYX'),_with_channel('TYX')),
        (_with_channel('SXYZ'),_with_channel('XYZ')),
    ]

    for (axes,axes_ref) in axes_list:
        assert Config(axes).axes == axes_ref

    with pytest.raises(ValueError):
        Config('XYC')
        Config('CXY')
    with pytest.raises(ValueError):
        Config('XYZC')
        Config('CXYZ')
    with pytest.raises(ValueError):
        Config('XTYC')
        Config('CXTY')
    with pytest.raises(ValueError): Config('XYZT')
    with pytest.raises(ValueError): Config('tXYZ')
    with pytest.raises(ValueError): Config('XYS')
    with pytest.raises(ValueError): Config('XSYZ')
github CSBDeep / CSBDeep / tests / test_models.py View on Github external
]

    for (axes,axes_ref) in axes_list:
        assert Config(axes).axes == axes_ref

    with pytest.raises(ValueError):
        Config('XYC')
        Config('CXY')
    with pytest.raises(ValueError):
        Config('XYZC')
        Config('CXYZ')
    with pytest.raises(ValueError):
        Config('XTYC')
        Config('CXTY')
    with pytest.raises(ValueError): Config('XYZT')
    with pytest.raises(ValueError): Config('tXYZ')
    with pytest.raises(ValueError): Config('XYS')
    with pytest.raises(ValueError): Config('XSYZ')
github CSBDeep / CSBDeep / tests / test_models.py View on Github external
(_with_channel('XYZ'),_with_channel('XYZ')),
        (_with_channel('XTY'),_with_channel('XTY')),
        (_with_channel('SYX'),_with_channel('YX')),
        (_with_channel('STYX'),_with_channel('TYX')),
        (_with_channel('SXYZ'),_with_channel('XYZ')),
    ]

    for (axes,axes_ref) in axes_list:
        assert Config(axes).axes == axes_ref

    with pytest.raises(ValueError):
        Config('XYC')
        Config('CXY')
    with pytest.raises(ValueError):
        Config('XYZC')
        Config('CXYZ')
    with pytest.raises(ValueError):
        Config('XTYC')
        Config('CXTY')
    with pytest.raises(ValueError): Config('XYZT')
    with pytest.raises(ValueError): Config('tXYZ')
    with pytest.raises(ValueError): Config('XYS')
    with pytest.raises(ValueError): Config('XSYZ')
github CSBDeep / CSBDeep / csbdeep / models.py View on Github external
def _set_logdir(self):
        if self.name is None:
            self.name = datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S.%f")
        self.logdir = self.basedir / self.name

        config_file =  self.logdir / 'config.json'
        if self.config is None:
            if config_file.exists():
                config_dict = load_json(str(config_file))
                self.config = Config(**config_dict)
                if not self.config.is_valid():
                    invalid_attr = self.config.is_valid(True)[1]
                    raise ValueError('Invalid attributes in loaded config: ' + ', '.join(invalid_attr))
            else:
                raise FileNotFoundError("config file doesn't exist: %s" % str(config_file.resolve()))
        else:
            if self.logdir.exists():
                warnings.warn('output path for model already exists, files may be overwritten: %s' % str(self.logdir.resolve()))
            self.logdir.mkdir(parents=True, exist_ok=True)
            save_json(vars(self.config), str(config_file))