Skip to content

Commit 455b013

Browse files
authored
Fix tbt converter output flag (#433)
* fix for tbt_converter * test and dependency
1 parent 3aea40d commit 455b013

File tree

5 files changed

+26
-2
lines changed

5 files changed

+26
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# OMC3 Changelog
22

3+
#### 2023-11-29 - v0.12.1 - _jdilly_
4+
5+
- Fixed:
6+
- `tbt_converter` now also passes given output format to writer when running without noise.
7+
38
#### 2023-11-29 - v0.12.0 - _jdilly_
49

510
- Added to harmonic analysis:

omc3/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
__title__ = "omc3"
1212
__description__ = "An accelerator physics tools package for the OMC team at CERN."
1313
__url__ = "https://github.com/pylhc/omc3"
14-
__version__ = "0.12.0"
14+
__version__ = "0.12.1"
1515
__author__ = "pylhc"
1616
__author_email__ = "[email protected]"
1717
__license__ = "MIT"

omc3/tbt_converter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ def _read_and_write_files(opt):
126126
if opt.noise_levels is None:
127127
tbt.write(
128128
Path(opt.outputdir) / f"{_file_name_without_sdds(input_file)}{suffix}",
129+
datatype=opt.output_datatype,
129130
tbt_data=tbt_data,
130131
)
131132
else:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"tables>=3.6.0",
3131
"uncertainties>=3.1.4",
3232
"optics-functions>=0.1.0",
33-
"turn_by_turn>=0.4.0",
33+
"turn_by_turn>=0.6.0",
3434
"requests>=2.27.0",
3535
]
3636

tests/unit/test_tbt_converter.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,24 @@ def test_converter_more_files_with_noise(_sdds_file, _test_file):
8181
_compare_tbt(origin, new, True, noiselevel * 10)
8282

8383

84+
@pytest.mark.basic
85+
def test_change_output_format(_sdds_file, _test_file):
86+
with pytest.raises(UnicodeError):
87+
_sdds_file.read_text() # making sure this is binary
88+
89+
# convert ---
90+
origin = tbt.read_tbt(_sdds_file, datatype="lhc")
91+
converter_entrypoint(files=[_sdds_file], outputdir=_test_file.parent, output_datatype="ascii")
92+
93+
# test output ---
94+
_test_file.read_text() # making sure this is ascii
95+
new = tbt.read_tbt(_test_file, datatype="ascii")
96+
_compare_tbt(origin, new, True)
97+
98+
99+
# Test Helper ------------------------------------------------------------------
100+
101+
84102
def _compare_tbt(
85103
origin: tbt.TbtData, new: tbt.TbtData, no_binary: bool, max_deviation=ASCII_PRECISION
86104
) -> None:

0 commit comments

Comments
 (0)