Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3eed3e1058 | |||
| b1188fcaab | |||
| 3cd2d1a0a9 | |||
| 927a18e64b | |||
| ffd296ef99 |
@@ -2,5 +2,5 @@
|
|||||||
Package to handle data redction at AMOR instrument to be used by __main__.py script.
|
Package to handle data redction at AMOR instrument to be used by __main__.py script.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__version__ = '3.2.4'
|
__version__ = '3.2.5'
|
||||||
__date__ = '2026-03-02'
|
__date__ = '2026-03-10'
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import logging
|
|||||||
# need to do absolute import here as pyinstaller requires it
|
# need to do absolute import here as pyinstaller requires it
|
||||||
from eos.options import ReflectivityConfig, ReaderConfig, ExperimentConfig, ReflectivityReductionConfig, ReflectivityOutputConfig
|
from eos.options import ReflectivityConfig, ReaderConfig, ExperimentConfig, ReflectivityReductionConfig, ReflectivityOutputConfig
|
||||||
from eos.command_line import commandLineArgs
|
from eos.command_line import commandLineArgs
|
||||||
from eos.logconfig import setup_logging, update_loglevel
|
from eos.logconfig import setup_logging, update_loglevel, setup_logfile
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@@ -27,6 +27,8 @@ def main():
|
|||||||
output_config = ReflectivityOutputConfig.from_args(clas)
|
output_config = ReflectivityOutputConfig.from_args(clas)
|
||||||
config = ReflectivityConfig(reader_config, experiment_config, reduction_config, output_config)
|
config = ReflectivityConfig(reader_config, experiment_config, reduction_config, output_config)
|
||||||
|
|
||||||
|
if output_config.logFile:
|
||||||
|
setup_logfile()
|
||||||
logging.warning('######## eos - data reduction for Amor ########')
|
logging.warning('######## eos - data reduction for Amor ########')
|
||||||
|
|
||||||
# only import heavy module if sufficient command line parameters were provided
|
# only import heavy module if sufficient command line parameters were provided
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import logging
|
|||||||
import logging.handlers
|
import logging.handlers
|
||||||
|
|
||||||
def setup_logging():
|
def setup_logging():
|
||||||
logger = logging.getLogger() # logging.getLogger('quicknxs')
|
logger = logging.getLogger()
|
||||||
logger.setLevel(logging.DEBUG)
|
logger.setLevel(logging.DEBUG)
|
||||||
# rename levels to make clear warning is can be a normal message
|
# rename levels to make clear warning is can be a normal message
|
||||||
logging.addLevelName(logging.INFO, 'VERB')
|
logging.addLevelName(logging.INFO, 'VERB')
|
||||||
@@ -19,18 +19,22 @@ def setup_logging():
|
|||||||
console.setLevel(logging.WARNING)
|
console.setLevel(logging.WARNING)
|
||||||
logger.addHandler(console)
|
logger.addHandler(console)
|
||||||
|
|
||||||
# if os.path.exists('amor_eos.log'):
|
|
||||||
# rollover = True
|
def setup_logfile():
|
||||||
# else:
|
logfile = logging.handlers.RotatingFileHandler(
|
||||||
# rollover = False
|
'amor_eos.log',
|
||||||
logfile = logging.handlers.RotatingFileHandler('amor_eos.log', encoding='utf8', mode='w',
|
encoding='utf8',
|
||||||
maxBytes=200*1024**2, backupCount=20)
|
mode='w',
|
||||||
# if rollover: logfile.doRollover()
|
maxBytes=200*1024**2,
|
||||||
|
backupCount=20,
|
||||||
|
)
|
||||||
formatter = logging.Formatter(
|
formatter = logging.Formatter(
|
||||||
'[%(levelname).4s] - %(asctime)s - %(filename)s:%(lineno)i:%(funcName)s %(message)s',
|
'[%(levelname).4s] - %(asctime)s - %(filename)s:%(lineno)i:%(funcName)s %(message)s',
|
||||||
'')
|
'',
|
||||||
|
)
|
||||||
logfile.setFormatter(formatter)
|
logfile.setFormatter(formatter)
|
||||||
logfile.setLevel(logging.DEBUG)
|
logfile.setLevel(logging.DEBUG)
|
||||||
|
logger = logging.getLogger()
|
||||||
logger.addHandler(logfile)
|
logger.addHandler(logfile)
|
||||||
|
|
||||||
def update_loglevel(verbose=0):
|
def update_loglevel(verbose=0):
|
||||||
|
|||||||
@@ -526,6 +526,13 @@ class ReflectivityOutputConfig(ArgParsable):
|
|||||||
'help': '?',
|
'help': '?',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
logFile: bool = field(
|
||||||
|
default = False,
|
||||||
|
metadata = {
|
||||||
|
'group': 'output',
|
||||||
|
'help': 'write log file "amor_eos.log"',
|
||||||
|
}
|
||||||
|
)
|
||||||
plot: bool = field(
|
plot: bool = field(
|
||||||
default=False,
|
default=False,
|
||||||
metadata={
|
metadata={
|
||||||
|
|||||||
Reference in New Issue
Block a user