added default name for ROI, repaired test suite
This commit is contained in:
@@ -7,3 +7,6 @@ build-backend = "setuptools.build_meta"
|
||||
# For smarter version schemes and other configuration options,
|
||||
# check out https://github.com/pypa/setuptools_scm
|
||||
version_scheme = "no-guess-dev"
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
addopts = "--no-cov"
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import yaml
|
||||
import os
|
||||
import logging
|
||||
logger = logging.getLogger()
|
||||
|
||||
import numpy as np
|
||||
from sfdata import SFDataFiles, sfdatafile, SFScanInfo, SFProcFile
|
||||
from xraydb import material_mu
|
||||
@@ -152,11 +155,12 @@ class ROI:
|
||||
else:
|
||||
raise ValueError("No valid ROI definition.")
|
||||
|
||||
# Check that ROI has a name and assign it
|
||||
if name:
|
||||
self.name = name
|
||||
else:
|
||||
raise ValueError('ROI must have a name. Please provide with name=... as a parameter')
|
||||
# Check that ROI has a name or generate default
|
||||
if name is None:
|
||||
logger.warning(f"No ROI name given, generating: {self.__repr__()}")
|
||||
name = self.__repr__()
|
||||
|
||||
self.name = name
|
||||
|
||||
def from_centers_widths(self, center_x, center_y, width, height):
|
||||
self.left = center_x - width // 2
|
||||
|
||||
Reference in New Issue
Block a user