Skip to content

Commit

Permalink
txt converter update
Browse files Browse the repository at this point in the history
  • Loading branch information
grzanka committed Dec 12, 2024
1 parent 5363a02 commit d8dd92b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pymchelper/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ def main(args=None):
default=ImageWriter.default_colormap,
type=str)

parser_plotdata = subparsers.add_parser(Converters.plotdata.name, help='converts to plot data')
add_default_options(parser_plotdata)

parser_excel = subparsers.add_parser(Converters.excel.name, help='converts to MS Excel file')
add_default_options(parser_excel)

Expand All @@ -79,9 +82,6 @@ def main(args=None):
parser_json = subparsers.add_parser(Converters.json.name, help='converts to JSON file')
add_default_options(parser_json)

parser_plotdata = subparsers.add_parser(Converters.plotdata.name, help='converts to plot data')
add_default_options(parser_plotdata)

parser_inspect = subparsers.add_parser(Converters.inspect.name, help='prints metadata')
add_default_options(parser_inspect)
parser_inspect.add_argument('-d', '--details',
Expand Down
9 changes: 8 additions & 1 deletion pymchelper/writers/shieldhit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import numpy as np

from pymchelper.estimator import Estimator
from pymchelper.shieldhit.detector.detector_type import SHDetType
from pymchelper.shieldhit.detector.estimator_type import SHGeoType

Expand Down Expand Up @@ -111,8 +112,14 @@ def _header_no_of_bins_and_prim(self, estimator):

return header

def write(self, estimator):
def write(self, estimator: Estimator):
"""TODO"""

if estimator.file_format not in {'bdo2016', 'bdo2019'}:
logger.error("Unsupported file format: %s", estimator.file_format)
logger.error("This converter is designed for SHIELD-HIT12A output files only.")
logger.error("Please use convertmc plotdata converter instead to generate text files.")

# save to single page to a file without number (i.e. output.dat)
if len(estimator.pages) == 1:
self.write_single_page(estimator.pages[0], self.filename)
Expand Down

0 comments on commit d8dd92b

Please sign in to comment.