restage 0.7.1__tar.gz → 0.8.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. {restage-0.7.1/src/restage.egg-info → restage-0.8.0}/PKG-INFO +18 -2
  2. {restage-0.7.1 → restage-0.8.0}/README.md +16 -0
  3. {restage-0.7.1 → restage-0.8.0}/pyproject.toml +1 -1
  4. {restage-0.7.1 → restage-0.8.0}/src/restage/cache.py +9 -1
  5. {restage-0.7.1 → restage-0.8.0}/src/restage/instr.py +5 -3
  6. {restage-0.7.1 → restage-0.8.0}/src/restage/mcpl.py +0 -1
  7. {restage-0.7.1 → restage-0.8.0}/src/restage/splitrun.py +60 -42
  8. {restage-0.7.1 → restage-0.8.0/src/restage.egg-info}/PKG-INFO +18 -2
  9. {restage-0.7.1 → restage-0.8.0}/src/restage.egg-info/requires.txt +1 -1
  10. {restage-0.7.1 → restage-0.8.0}/test/test_env_vars.py +15 -0
  11. {restage-0.7.1 → restage-0.8.0}/test/test_single.py +22 -22
  12. {restage-0.7.1 → restage-0.8.0}/.github/workflows/pip.yml +0 -0
  13. {restage-0.7.1 → restage-0.8.0}/.github/workflows/wheels.yml +0 -0
  14. {restage-0.7.1 → restage-0.8.0}/.gitignore +0 -0
  15. {restage-0.7.1 → restage-0.8.0}/setup.cfg +0 -0
  16. {restage-0.7.1 → restage-0.8.0}/src/restage/__init__.py +0 -0
  17. {restage-0.7.1 → restage-0.8.0}/src/restage/bifrost_choppers.py +0 -0
  18. {restage-0.7.1 → restage-0.8.0}/src/restage/config/__init__.py +0 -0
  19. {restage-0.7.1 → restage-0.8.0}/src/restage/config/default.yaml +0 -0
  20. {restage-0.7.1 → restage-0.8.0}/src/restage/cspec_choppers.py +0 -0
  21. {restage-0.7.1 → restage-0.8.0}/src/restage/database.py +0 -0
  22. {restage-0.7.1 → restage-0.8.0}/src/restage/emulate.py +0 -0
  23. {restage-0.7.1 → restage-0.8.0}/src/restage/energy.py +0 -0
  24. {restage-0.7.1 → restage-0.8.0}/src/restage/range.py +0 -0
  25. {restage-0.7.1 → restage-0.8.0}/src/restage/run.py +0 -0
  26. {restage-0.7.1 → restage-0.8.0}/src/restage/scan.py +0 -0
  27. {restage-0.7.1 → restage-0.8.0}/src/restage/tables.py +0 -0
  28. {restage-0.7.1 → restage-0.8.0}/src/restage.egg-info/SOURCES.txt +0 -0
  29. {restage-0.7.1 → restage-0.8.0}/src/restage.egg-info/dependency_links.txt +0 -0
  30. {restage-0.7.1 → restage-0.8.0}/src/restage.egg-info/entry_points.txt +0 -0
  31. {restage-0.7.1 → restage-0.8.0}/src/restage.egg-info/top_level.txt +0 -0
  32. {restage-0.7.1 → restage-0.8.0}/test/test_cache.py +0 -0
  33. {restage-0.7.1 → restage-0.8.0}/test/test_cache_ro.py +0 -0
  34. {restage-0.7.1 → restage-0.8.0}/test/test_database.py +0 -0
  35. {restage-0.7.1 → restage-0.8.0}/test/test_energy.py +0 -0
  36. {restage-0.7.1 → restage-0.8.0}/test/test_range.py +0 -0
  37. {restage-0.7.1 → restage-0.8.0}/test/test_scan.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: restage
3
- Version: 0.7.1
3
+ Version: 0.8.0
4
4
  Author-email: Gregory Tucker <gregory.tucker@ess.eu>
5
5
  License: BSD-3-Clause
6
6
  Classifier: License :: OSI Approved :: BSD License
@@ -17,7 +17,7 @@ Requires-Dist: zenlog>=1.1
17
17
  Requires-Dist: platformdirs>=3.11
18
18
  Requires-Dist: confuse
19
19
  Requires-Dist: psutil>=5.9.6
20
- Requires-Dist: mccode-antlr[hdf5]>=0.14.0
20
+ Requires-Dist: mccode-antlr[hdf5]>=0.15.0
21
21
  Provides-Extra: test
22
22
  Requires-Dist: pytest; extra == "test"
23
23
  Requires-Dist: chopcal; extra == "test"
@@ -107,6 +107,22 @@ splitrun my_instrument.instr -n 1000000 --split-at split_at -d /data/output samp
107
107
  ```
108
108
 
109
109
 
110
+ ## MCPL components
111
+ There are a small collection of `MCPL` input and output components that are provided
112
+ along with the McStas and McXtrace distributions, and you may also decide to write your
113
+ own specialized variant of those provided.
114
+ By default `splitrun` will insert an `MCPL_output` component at the end of the first
115
+ stage, and an `MCPL_input` component at the start of the second stage.
116
+ Should you prefer to a different component, or need to provide parameter values for
117
+ the components, these can be specified in the command line call to `splitrun`.
118
+
119
+ Components are specified as their file name (minus the `.comp` extension) and
120
+ parameters as comma-separated `key:value` pairs, e.g.:
121
+
122
+ ```bash
123
+ splitrun -n 1M a3=0:179 --mcpl-input-component MCPL_input_once --mcpl-output-parameters weight_mode:1,double_prec:1 instr.h5
124
+ ```
125
+
110
126
 
111
127
  ## Cached data
112
128
  ### Default writable cache
@@ -83,6 +83,22 @@ splitrun my_instrument.instr -n 1000000 --split-at split_at -d /data/output samp
83
83
  ```
84
84
 
85
85
 
86
+ ## MCPL components
87
+ There are a small collection of `MCPL` input and output components that are provided
88
+ along with the McStas and McXtrace distributions, and you may also decide to write your
89
+ own specialized variant of those provided.
90
+ By default `splitrun` will insert an `MCPL_output` component at the end of the first
91
+ stage, and an `MCPL_input` component at the start of the second stage.
92
+ Should you prefer to a different component, or need to provide parameter values for
93
+ the components, these can be specified in the command line call to `splitrun`.
94
+
95
+ Components are specified as their file name (minus the `.comp` extension) and
96
+ parameters as comma-separated `key:value` pairs, e.g.:
97
+
98
+ ```bash
99
+ splitrun -n 1M a3=0:179 --mcpl-input-component MCPL_input_once --mcpl-output-parameters weight_mode:1,double_prec:1 instr.h5
100
+ ```
101
+
86
102
 
87
103
  ## Cached data
88
104
  ### Default writable cache
@@ -9,7 +9,7 @@ dependencies = [
9
9
  'platformdirs>=3.11',
10
10
  'confuse',
11
11
  'psutil>=5.9.6',
12
- 'mccode-antlr[hdf5]>=0.14.0',
12
+ 'mccode-antlr[hdf5]>=0.15.0',
13
13
  ]
14
14
  readme = "README.md"
15
15
  license = {text = "BSD-3-Clause"}
@@ -26,10 +26,18 @@ class FileSystem:
26
26
  path.mkdir(parents=True)
27
27
  db_write = Database(path / named)
28
28
  root = path
29
+
30
+ def exists_not_root(roc):
31
+ roc = Path(roc)
32
+ if not roc.exists() or not (roc / named).exists():
33
+ return False
34
+ return root.resolve() != roc.resolve() if root is not None else True
35
+
29
36
  if config['fixed'].exists() and config['fixed'].get() is not None:
30
- more = [Path(c) for c in config['fixed'].as_str_seq() if Path(c).exists()]
37
+ more = [Path(c) for c in config['fixed'].as_str_seq() if exists_not_root(c)]
31
38
  for m in more:
32
39
  db_fixed.append(Database(m / named, readonly=True))
40
+
33
41
  if db_write is not None and db_write.readonly:
34
42
  raise ValueError("Specified writable database location is readonly")
35
43
  if db_write is None:
@@ -10,17 +10,19 @@ from mccode_antlr.instr import Instr
10
10
 
11
11
  def load_instr(filepath: Union[str, Path]) -> Instr:
12
12
  """Loads an Instr object from a .instr file or a HDF5 file"""
13
- from mccode_antlr.io import load_hdf5
14
- from mccode_antlr.loader import load_mcstas_instr
15
-
16
13
  if not isinstance(filepath, Path):
17
14
  filepath = Path(filepath)
18
15
  if not filepath.exists() or not filepath.is_file():
19
16
  raise ValueError(f'The provided {filepath=} does not exist or is not a file')
20
17
 
21
18
  if filepath.suffix == '.instr':
19
+ from mccode_antlr.loader import load_mcstas_instr
22
20
  return load_mcstas_instr(filepath)
21
+ elif filepath.suffix.lower() == '.json':
22
+ from mccode_antlr.io.json import load_json
23
+ return load_json(filepath)
23
24
 
25
+ from mccode_antlr.io import load_hdf5
24
26
  return load_hdf5(filepath)
25
27
 
26
28
 
@@ -15,7 +15,6 @@ def mcpl_real_filename(filename: Path) -> Path:
15
15
  check = base.with_suffix(ext)
16
16
  if check.exists() and check.is_file():
17
17
  return check
18
- print(f'{base} -> {check} not found')
19
18
  raise FileNotFoundError(f'Could not find MCPL file {filename}')
20
19
 
21
20
 
@@ -3,31 +3,55 @@ from __future__ import annotations
3
3
  from pathlib import Path
4
4
  from .tables import SimulationEntry, InstrEntry
5
5
 
6
- def mcpl_parameter_split(s: str) -> tuple[str, str]:
7
- k, v = s.split(':', 1)
8
- return k, v
6
+ def mcpl_parameters_split(s: str) -> list[tuple[str, str]]:
7
+ return [(k, v) for k, v in [kv.split(':', maxsplit=1) for kv in s.split(',')]]
8
+
9
+ def si_int(s: str) -> int:
10
+ from loguru import logger
11
+ suffix_value = {
12
+ 'k': 1000, 'M': 10 ** 6, 'G': 10 ** 9, 'T': 10 ** 12, 'P': 10 ** 15,
13
+ 'Ki': 2 ** 10, 'Mi': 2 ** 20, 'Gi': 2 ** 30, 'Ti': 2 ** 40, 'Pi': 2 ** 50
14
+ }
15
+ def int_mult(x: str, mult: int = 1):
16
+ return int(x) * mult if x.isnumeric() else int(float(x) * mult)
17
+
18
+ def do_parse():
19
+ try:
20
+ if suffix := next(k for k in suffix_value if s.endswith(k)):
21
+ return int_mult(s[:-len(suffix)].strip(), suffix_value[suffix])
22
+ except StopIteration:
23
+ pass
24
+ return int_mult(s)
25
+ value = do_parse()
26
+ if value < 0:
27
+ logger.info('Negative value encountered')
28
+ elif value > 2**53:
29
+ logger.info(
30
+ 'McStas/McXtrace parse integer inputs as doubles,'
31
+ f' this requested {value=} will not be evaluated precisely'
32
+ ' since it is more than 2^53'
33
+ )
34
+ return value
9
35
 
10
36
  def make_splitrun_parser():
11
37
  from argparse import ArgumentParser
12
38
  parser = ArgumentParser('splitrun')
13
39
  aa = parser.add_argument
14
- parser = ArgumentParser('splitrun')
15
- aa = parser.add_argument
16
- aa('instrument', nargs=1, type=str, default=None,
17
- help='Instrument `.instr` file name or serialised HDF5 Instr object')
40
+ aa('instrument', type=str, default=None,
41
+ help='Instrument `.instr` file name or serialised HDF5 or JSON Instr object')
18
42
  aa('parameters', nargs='*', type=str, default=None)
19
- aa('-n', '--ncount', nargs=1, type=int, default=None, help='Number of neutrons to simulate')
43
+ aa('-n', '--ncount', type=si_int, default=None, help='Number of neutrons to simulate')
20
44
  aa('-m', '--mesh', action='store_true', default=False, help='N-dimensional mesh scan')
21
- aa('-d', '--dir', nargs=1, type=str, default=None, help='Output directory')
22
- aa('-s', '--seed', nargs=1, type=int, default=None, help='Random number generator seed')
45
+ aa('-d', '--dir', type=str, default=None, help='Output directory')
46
+ aa('-s', '--seed', type=int, default=None, help='Random number generator seed')
23
47
  aa('-t', '--trace', action='store_true', default=False, help='Enable tracing')
24
48
  aa('-g', '--gravitation', action='store_true', default=False,
25
49
  help='Enable gravitation for all trajectories')
26
- aa('--bufsiz', nargs=1, type=int, default=None, help='Monitor_nD list/buffer-size')
27
- aa('--format', nargs=1, type=str, default=None, help='Output data files using FORMAT')
28
- aa('--nmin', nargs=1, type=int, default=None,
50
+ aa('--bufsiz', type=si_int, default=None, help='Monitor_nD list/buffer-size')
51
+ aa('--format', type=str, default=None, help='Output data files using FORMAT')
52
+ aa('--nmin', type=int, default=None,
29
53
  help='Minimum number of particles to simulate during first instrument simulations')
30
- aa('--nmax', nargs=1, type=int, default=None,
54
+ aa('--nmax', type=int, default=None,
31
55
  help='Maximum number of particles to simulate during first instrument simulations')
32
56
  aa('--dryrun', action='store_true', default=False,
33
57
  help='Do not run any simulations, just print the commands')
@@ -35,17 +59,19 @@ def make_splitrun_parser():
35
59
  help='Use MPI multi-process parallelism (primary instrument only at the moment)')
36
60
  aa('--gpu', action='store_true', default=False,
37
61
  help='Use GPU OpenACC parallelism (primary instrument only at the moment)')
38
- aa('--process-count', nargs=1, type=int, default=0,
62
+ aa('--process-count', type=int, default=0,
39
63
  help='MPI process count, 0 == System Default')
40
64
  # splitrun controlling parameters
41
- aa('--split-at', nargs=1, type=str, default=['mcpl_split'],
65
+ aa('--split-at', type=str, default='mcpl_split',
42
66
  help='Component at which to split -- DEFAULT: mcpl_split')
43
- aa('--mcpl-output-component', nargs=1, type=str, default=None,
44
- help='Inserted MCPL file producing component, MCPL_output(.comp) if not provided')
45
- aa('--mcpl-input-component', nargs=1, type=str, default=None,
46
- help='Inserted MCPL file consuming component, MCPL_input(.comp) if not provided')
47
- aa('--mcpl-input-parameters', nargs='+', type=mcpl_parameter_split, metavar='key:value')
48
- aa('--mcpl-output-parameters', nargs='+', type=mcpl_parameter_split, metavar='key:value')
67
+ aa('--mcpl-output-component', type=str, default=None,
68
+ help='Inserted MCPL file producing component, "MCPL_output" if not provided')
69
+ aa('--mcpl-input-component', type=str, default=None,
70
+ help='Inserted MCPL file consuming component, "MCPL_input" if not provided')
71
+ aa('--mcpl-input-parameters', type=mcpl_parameters_split,
72
+ metavar='in_parameter1:value1,in_parameter2:value2,...')
73
+ aa('--mcpl-output-parameters',type=mcpl_parameters_split,
74
+ metavar='out_parameter1:value1,out_parameter2:value2,...')
49
75
  aa('-P', action='append', default=[], help='Cache parameter matching precision')
50
76
 
51
77
  # Other McCode runtime arguments exist, but are likely not used during a scan:
@@ -117,36 +143,28 @@ def entrypoint():
117
143
 
118
144
  def splitrun_from_file(args, parameters, precision):
119
145
  from .instr import load_instr
120
- instr = load_instr(args.instrument[0])
146
+ instr = load_instr(args.instrument)
121
147
  splitrun_args(instr, parameters, precision, args)
122
148
 
123
149
 
124
- def give_me_an_integer(something):
125
- if isinstance(something, (list, tuple)):
126
- return something[0]
127
- if isinstance(something, int):
128
- return something
129
- return 0
130
-
131
-
132
150
  def splitrun_args(instr, parameters, precision, args, **kwargs):
133
- splitrun(instr, parameters, precision, split_at=args.split_at[0], grid=args.mesh,
134
- seed=args.seed[0] if args.seed is not None else None,
135
- ncount=args.ncount[0] if args.ncount is not None else None,
136
- out_dir=args.dir[0] if args.dir is not None else None,
151
+ splitrun(instr, parameters, precision, split_at=args.split_at, grid=args.mesh,
152
+ seed=args.seed,
153
+ ncount=args.ncount,
154
+ out_dir=args.dir,
137
155
  trace=args.trace,
138
156
  gravitation=args.gravitation,
139
- bufsiz=args.bufsiz[0] if args.bufsiz is not None else None,
140
- format=args.format[0] if args.format is not None else None,
141
- minimum_particle_count=args.nmin[0] if args.nmin is not None else None,
142
- maximum_particle_count=args.nmax[0] if args.nmax is not None else None,
157
+ bufsiz=args.bufsiz,
158
+ format=args.format,
159
+ minimum_particle_count=args.nmin,
160
+ maximum_particle_count=args.nmax,
143
161
  dry_run=args.dryrun,
144
162
  parallel=args.parallel,
145
163
  gpu=args.gpu,
146
- process_count=give_me_an_integer(args.process_count),
147
- mcpl_output_component=args.mcpl_output_component[0] if args.mcpl_output_component is not None else None,
164
+ process_count=args.process_count,
165
+ mcpl_output_component=args.mcpl_output_component,
148
166
  mcpl_output_parameters=args.mcpl_output_parameters,
149
- mcpl_input_component=args.mcpl_input_component[0] if args.mcpl_input_component is not None else None,
167
+ mcpl_input_component=args.mcpl_input_component,
150
168
  mcpl_input_parameters=args.mcpl_input_parameters,
151
169
  **kwargs
152
170
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: restage
3
- Version: 0.7.1
3
+ Version: 0.8.0
4
4
  Author-email: Gregory Tucker <gregory.tucker@ess.eu>
5
5
  License: BSD-3-Clause
6
6
  Classifier: License :: OSI Approved :: BSD License
@@ -17,7 +17,7 @@ Requires-Dist: zenlog>=1.1
17
17
  Requires-Dist: platformdirs>=3.11
18
18
  Requires-Dist: confuse
19
19
  Requires-Dist: psutil>=5.9.6
20
- Requires-Dist: mccode-antlr[hdf5]>=0.14.0
20
+ Requires-Dist: mccode-antlr[hdf5]>=0.15.0
21
21
  Provides-Extra: test
22
22
  Requires-Dist: pytest; extra == "test"
23
23
  Requires-Dist: chopcal; extra == "test"
@@ -107,6 +107,22 @@ splitrun my_instrument.instr -n 1000000 --split-at split_at -d /data/output samp
107
107
  ```
108
108
 
109
109
 
110
+ ## MCPL components
111
+ There are a small collection of `MCPL` input and output components that are provided
112
+ along with the McStas and McXtrace distributions, and you may also decide to write your
113
+ own specialized variant of those provided.
114
+ By default `splitrun` will insert an `MCPL_output` component at the end of the first
115
+ stage, and an `MCPL_input` component at the start of the second stage.
116
+ Should you prefer to a different component, or need to provide parameter values for
117
+ the components, these can be specified in the command line call to `splitrun`.
118
+
119
+ Components are specified as their file name (minus the `.comp` extension) and
120
+ parameters as comma-separated `key:value` pairs, e.g.:
121
+
122
+ ```bash
123
+ splitrun -n 1M a3=0:179 --mcpl-input-component MCPL_input_once --mcpl-output-parameters weight_mode:1,double_prec:1 instr.h5
124
+ ```
125
+
110
126
 
111
127
  ## Cached data
112
128
  ### Default writable cache
@@ -2,7 +2,7 @@ zenlog>=1.1
2
2
  platformdirs>=3.11
3
3
  confuse
4
4
  psutil>=5.9.6
5
- mccode-antlr[hdf5]>=0.14.0
5
+ mccode-antlr[hdf5]>=0.15.0
6
6
 
7
7
  [test]
8
8
  pytest
@@ -1,3 +1,4 @@
1
+ import os
1
2
  from unittest import TestCase
2
3
  from unittest.mock import patch
3
4
  from importlib import reload
@@ -40,6 +41,20 @@ class SettingsTests(TestCase):
40
41
  self.assertTrue(config['fixed'].get() is None)
41
42
  self.assertRaises(ConfigTypeError, config['fixed'].as_str_seq)
42
43
 
44
+ def test_missing_database_in_fixed_config(self):
45
+ from tempfile import TemporaryDirectory
46
+ from pathlib import Path
47
+ with TemporaryDirectory() as tmpdir:
48
+ self.assertFalse((Path(tmpdir) / 'database.db').exists())
49
+ with patch.dict(os.environ, {'RESTAGE_FIXED': tmpdir}):
50
+ reload(restage.config)
51
+ from restage.config import config
52
+ self.assertTrue(config['fixed'].exists())
53
+ self.assertEqual(config['fixed'].as_str(), tmpdir)
54
+ from restage.cache import FILESYSTEM
55
+ self.assertEqual(len(FILESYSTEM.db_fixed), 0)
56
+
57
+
43
58
  def test_restage_standard_config(self):
44
59
  from os import environ
45
60
  reload(restage.config)
@@ -32,53 +32,53 @@ class SingleTestCase(unittest.TestCase):
32
32
 
33
33
  def test_parsing(self):
34
34
  args = self.parser.parse_args(['test.instr', 'a=1', 'b=2', '--split-at=here', '-m'])
35
- self.assertEqual(args.instrument, ['test.instr'])
35
+ self.assertEqual(args.instrument, 'test.instr')
36
36
  self.assertEqual(args.parameters, ['a=1', 'b=2'])
37
- self.assertEqual(args.split_at, ['here'])
37
+ self.assertEqual(args.split_at, 'here')
38
38
  self.assertTrue(args.mesh)
39
39
 
40
40
  def test_mixed_parsing(self):
41
41
  from mccode_antlr.run.runner import sort_args
42
42
  args = self.parser.parse_args(sort_args(['test.instr', '-m', 'a=1', 'b=2', '--split-at=here']))
43
- self.assertEqual(args.instrument, ['test.instr'])
43
+ self.assertEqual(args.instrument, 'test.instr')
44
44
  self.assertEqual(args.parameters, ['a=1', 'b=2'])
45
- self.assertEqual(args.split_at, ['here'])
45
+ self.assertEqual(args.split_at, 'here')
46
46
  self.assertTrue(args.mesh)
47
47
 
48
48
  def test_mccode_flags(self):
49
49
  args = self.parser.parse_args(['test.instr', '-s', '123456', '-n', '-1', '-d', '/a/dir', '-t', '-g'])
50
- self.assertEqual(args.seed, [123456])
51
- self.assertEqual(args.ncount, [-1])
52
- self.assertEqual(args.dir, ['/a/dir'])
50
+ self.assertEqual(args.seed, 123456)
51
+ self.assertEqual(args.ncount, -1)
52
+ self.assertEqual(args.dir, '/a/dir')
53
53
  self.assertEqual(args.trace, True)
54
54
  self.assertEqual(args.gravitation, True)
55
55
 
56
56
  args = self.parser.parse_args(['test.instr', '-s=99999', '-n=10000', '-d=/b/dir'])
57
- self.assertEqual(args.seed, [99999])
58
- self.assertEqual(args.ncount, [10000])
59
- self.assertEqual(args.dir, ['/b/dir'])
57
+ self.assertEqual(args.seed, 99999)
58
+ self.assertEqual(args.ncount, 10000)
59
+ self.assertEqual(args.dir, '/b/dir')
60
60
  self.assertEqual(args.trace, False)
61
61
  self.assertEqual(args.gravitation, False)
62
62
 
63
63
  args = self.parser.parse_args(['test.instr', '--seed', '888', '--ncount', '4', '--dir', '/c/dir', '--trace',
64
64
  '--gravitation', '--bufsiz', '1000', '--format', 'NEXUS'])
65
- self.assertEqual(args.seed, [888])
66
- self.assertEqual(args.ncount, [4])
67
- self.assertEqual(args.dir, ['/c/dir'])
65
+ self.assertEqual(args.seed, 888)
66
+ self.assertEqual(args.ncount, 4)
67
+ self.assertEqual(args.dir, '/c/dir')
68
68
  self.assertEqual(args.trace, True)
69
69
  self.assertEqual(args.gravitation, True)
70
- self.assertEqual(args.bufsiz, [1000])
71
- self.assertEqual(args.format, ['NEXUS'])
70
+ self.assertEqual(args.bufsiz, 1000)
71
+ self.assertEqual(args.format, 'NEXUS')
72
72
 
73
73
  args = self.parser.parse_args(['test.instr', '--seed=777', '--ncount=5', '--dir=/d/dir', '--bufsiz=2000',
74
74
  '--format=RAW'])
75
- self.assertEqual(args.seed, [777])
76
- self.assertEqual(args.ncount, [5])
77
- self.assertEqual(args.dir, ['/d/dir'])
75
+ self.assertEqual(args.seed, 777)
76
+ self.assertEqual(args.ncount, 5)
77
+ self.assertEqual(args.dir, '/d/dir')
78
78
  self.assertEqual(args.trace, False)
79
79
  self.assertEqual(args.gravitation, False)
80
- self.assertEqual(args.bufsiz, [2000])
81
- self.assertEqual(args.format, ['RAW'])
80
+ self.assertEqual(args.bufsiz, 2000)
81
+ self.assertEqual(args.format, 'RAW')
82
82
 
83
83
  def test_parameters(self):
84
84
  from restage.range import MRange, Singular, parameters_to_scan, parse_scan_parameters
@@ -106,14 +106,14 @@ class SingleTestCase(unittest.TestCase):
106
106
 
107
107
  def test_mcpl_split_parameters(self):
108
108
  args = self.parser.parse_args(['test.instr', 'a=1.0', 'b=2', 'c=3:5', 'd=blah', 'e=/data',
109
- '--mcpl-input-parameters', 'preload:1', 'v_smear:0.01'])
109
+ '--mcpl-input-parameters', 'preload:1,v_smear:0.01'])
110
110
  self.assertEqual(args.parameters, ['a=1.0', 'b=2', 'c=3:5', 'd=blah', 'e=/data'])
111
111
  self.assertEqual(args.mcpl_input_parameters, [('preload', '1'), ('v_smear', '0.01')])
112
112
  args = self.parser.parse_args(['new_tst.instr', '--mcpl-output-parameters', 'preload:1',
113
113
  '--mcpl-input-component=MCPL_input_once'])
114
114
  self.assertEqual(args.parameters, [])
115
115
  self.assertEqual(args.mcpl_output_parameters, [('preload', '1')])
116
- self.assertEqual(args.mcpl_input_component, ['MCPL_input_once'])
116
+ self.assertEqual(args.mcpl_input_component, 'MCPL_input_once')
117
117
 
118
118
 
119
119
  class DictWranglingTestCase(unittest.TestCase):
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes