stepss 3.77.1__tar.gz → 3.78__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.
- {stepss-3.77.1/stepss.egg-info → stepss-3.78}/PKG-INFO +1 -1
- {stepss-3.77.1 → stepss-3.78}/stepss/__init__.py +1 -1
- {stepss-3.77.1 → stepss-3.78}/stepss/_bundled.py +1 -1
- {stepss-3.77.1 → stepss-3.78}/stepss/cases.py +60 -6
- {stepss-3.77.1 → stepss-3.78}/stepss/libs/lin/ramses.so +0 -0
- {stepss-3.77.1 → stepss-3.78}/stepss/libs/mac/ramses.so +0 -0
- {stepss-3.77.1 → stepss-3.78}/stepss/libs/win/ramses.dll +0 -0
- {stepss-3.77.1 → stepss-3.78/stepss.egg-info}/PKG-INFO +1 -1
- {stepss-3.77.1 → stepss-3.78}/LICENSE.rst +0 -0
- {stepss-3.77.1 → stepss-3.78}/MANIFEST.in +0 -0
- {stepss-3.77.1 → stepss-3.78}/README.rst +0 -0
- {stepss-3.77.1 → stepss-3.78}/setup.cfg +0 -0
- {stepss-3.77.1 → stepss-3.78}/setup.py +0 -0
- {stepss-3.77.1 → stepss-3.78}/stepss/extractor.py +0 -0
- {stepss-3.77.1 → stepss-3.78}/stepss/globals.py +0 -0
- {stepss-3.77.1 → stepss-3.78}/stepss/helios.py +0 -0
- {stepss-3.77.1 → stepss-3.78}/stepss/libs/helios_api.h +0 -0
- {stepss-3.77.1 → stepss-3.78}/stepss/libs/lin/libhelios_api.so +0 -0
- {stepss-3.77.1 → stepss-3.78}/stepss/libs/mac/libhelios_api.dylib +0 -0
- {stepss-3.77.1 → stepss-3.78}/stepss/libs/ramses.h +0 -0
- {stepss-3.77.1 → stepss-3.78}/stepss/libs/win/helios_api.dll +0 -0
- {stepss-3.77.1 → stepss-3.78}/stepss/live.py +0 -0
- {stepss-3.77.1 → stepss-3.78}/stepss/scripts/__init__.py +0 -0
- {stepss-3.77.1 → stepss-3.78}/stepss/scripts/exec.py +0 -0
- {stepss-3.77.1 → stepss-3.78}/stepss/simulator.py +0 -0
- {stepss-3.77.1 → stepss-3.78}/stepss.egg-info/SOURCES.txt +0 -0
- {stepss-3.77.1 → stepss-3.78}/stepss.egg-info/dependency_links.txt +0 -0
- {stepss-3.77.1 → stepss-3.78}/stepss.egg-info/entry_points.txt +0 -0
- {stepss-3.77.1 → stepss-3.78}/stepss.egg-info/requires.txt +0 -0
- {stepss-3.77.1 → stepss-3.78}/stepss.egg-info/top_level.txt +0 -0
|
@@ -15,6 +15,48 @@ from .globals import RAMSESError, CustomWarning
|
|
|
15
15
|
warnings.showwarning = CustomWarning
|
|
16
16
|
|
|
17
17
|
|
|
18
|
+
def _dstProblem(dstfile):
|
|
19
|
+
"""Return None if *dstfile* can drive a run, or a sentence saying what is wrong.
|
|
20
|
+
|
|
21
|
+
Mirrors what the engine itself accepts. A blank line, or one opening with
|
|
22
|
+
``#`` or ``!``, is a comment. Every other line is a record whose first field
|
|
23
|
+
is a time and whose remainder is the description, and the run ends at the
|
|
24
|
+
first record whose description carries ``STOP``.
|
|
25
|
+
|
|
26
|
+
:param str dstfile: path to the disturbance file to check.
|
|
27
|
+
:returns: None when the file is usable, otherwise the reason it is not.
|
|
28
|
+
:rtype: str or None
|
|
29
|
+
"""
|
|
30
|
+
records = 0
|
|
31
|
+
untimed = False
|
|
32
|
+
try:
|
|
33
|
+
with open(dstfile, 'r', encoding='utf-8', errors='replace') as records_file:
|
|
34
|
+
for line in records_file:
|
|
35
|
+
text = line.strip()
|
|
36
|
+
if not text or text[0] in '#!':
|
|
37
|
+
continue
|
|
38
|
+
_, space, description = text.partition(' ')
|
|
39
|
+
if not space:
|
|
40
|
+
# The engine refuses a record with fewer than two fields.
|
|
41
|
+
# Noting a bare STOP separately turns "no STOP record" into
|
|
42
|
+
# a sentence the reader can act on, with STOP on screen.
|
|
43
|
+
untimed = untimed or 'STOP' in text
|
|
44
|
+
continue
|
|
45
|
+
records += 1
|
|
46
|
+
if 'STOP' in description:
|
|
47
|
+
return None
|
|
48
|
+
except IOError as e:
|
|
49
|
+
return 'RAMSES: The disturbance file %s could not be read: %s' % (dstfile, e)
|
|
50
|
+
|
|
51
|
+
if untimed:
|
|
52
|
+
return ('RAMSES: The disturbance file %s has a STOP without a time. Every '
|
|
53
|
+
'record starts with its time, as in "240.0 STOP".' % dstfile)
|
|
54
|
+
if records == 0:
|
|
55
|
+
return 'RAMSES: The disturbance file %s has no disturbance records.' % dstfile
|
|
56
|
+
return ('RAMSES: The disturbance file %s has no STOP record. A dynamic simulation '
|
|
57
|
+
'ends at its STOP time, so add a line such as "240.0 STOP".' % dstfile)
|
|
58
|
+
|
|
59
|
+
|
|
18
60
|
class cfg(object):
|
|
19
61
|
"""Simulation case configuration.
|
|
20
62
|
|
|
@@ -174,8 +216,16 @@ class cfg(object):
|
|
|
174
216
|
|
|
175
217
|
.. warning:: If *userFile* already exists it will be overwritten.
|
|
176
218
|
"""
|
|
177
|
-
if not self._dataset
|
|
178
|
-
raise RAMSESError('
|
|
219
|
+
if not self._dataset:
|
|
220
|
+
raise RAMSESError('RAMSES: No data file is set. A case needs at least one.')
|
|
221
|
+
if not self._dstset:
|
|
222
|
+
raise RAMSESError('RAMSES: No disturbance file is set. A dynamic simulation '
|
|
223
|
+
'needs one, ending in a STOP record.')
|
|
224
|
+
# Re-checked here rather than trusted from addDst: the file can be
|
|
225
|
+
# edited, or replaced, between being attached and being run.
|
|
226
|
+
problem = _dstProblem(self._dstset[0])
|
|
227
|
+
if problem:
|
|
228
|
+
raise RAMSESError(problem)
|
|
179
229
|
|
|
180
230
|
cmdFile = ""
|
|
181
231
|
|
|
@@ -534,11 +584,15 @@ class cfg(object):
|
|
|
534
584
|
|
|
535
585
|
.. warning:: A disturbance file must be provided before the simulation can start.
|
|
536
586
|
"""
|
|
537
|
-
if os.path.isfile(dstfile):
|
|
538
|
-
del self._dstset[:]
|
|
539
|
-
self._dstset.append(dstfile)
|
|
540
|
-
else:
|
|
587
|
+
if not os.path.isfile(dstfile):
|
|
541
588
|
raise IOError('RAMSES: The dstfile %s does not exist or is not valid.' % (dstfile))
|
|
589
|
+
# Checked before the case is touched, so a rejected file never replaces
|
|
590
|
+
# a working one.
|
|
591
|
+
problem = _dstProblem(dstfile)
|
|
592
|
+
if problem:
|
|
593
|
+
raise RAMSESError(problem)
|
|
594
|
+
del self._dstset[:]
|
|
595
|
+
self._dstset.append(dstfile)
|
|
542
596
|
|
|
543
597
|
def getDst(self):
|
|
544
598
|
"""Get disturbance
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|