Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
BOXMOX Python Package
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MBEES
BOXMOX Python Package
Commits
3705b2a3
Commit
3705b2a3
authored
7 years ago
by
Christoph.Knote
Browse files
Options
Downloads
Patches
Plain Diff
Updated ConcentrationOutput reading routine (faster). Exposing
InputFileOrig, InputFile17 for documentation.
parent
843a9471
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
boxmox/__init__.py
+1
-1
1 addition, 1 deletion
boxmox/__init__.py
boxmox/data.py
+12
-1
12 additions, 1 deletion
boxmox/data.py
docs/index.rst
+3
-1
3 additions, 1 deletion
docs/index.rst
with
16 additions
and
3 deletions
boxmox/__init__.py
+
1
−
1
View file @
3705b2a3
...
...
@@ -5,7 +5,7 @@ except:
import
_installation
from
data
import
InputFile
,
Output
,
ConcentrationOutput
,
RatesOutput
,
AdjointOutput
,
JacobianOutput
,
HessianOutput
from
data
import
InputFile
,
InputFileOrig
,
InputFile17
,
Output
,
ConcentrationOutput
,
RatesOutput
,
AdjointOutput
,
JacobianOutput
,
HessianOutput
from
fluxes
import
FluxParser
work_path
=
_installation
.
validate
()
...
...
This diff is collapsed.
Click to expand it.
boxmox/data.py
+
12
−
1
View file @
3705b2a3
...
...
@@ -43,6 +43,11 @@ def _mygenfromtxt(f):
return
np
.
array
(
dat
,
dtype
=
[(
_
,
float
)
for
_
in
hdr
])
def
InputFile
(
fpath
=
None
,
version
=
1.7
):
'''
Returns an instance of a BOXMOX input file class, either old format if
version < 1.7 (class InputFileOrig), or the current file format
(class InputFile17).
'''
if
not
fpath
is
None
:
# file format discovery: 3 lines with numbers ==> 1.7
with
open
(
fpath
,
'
rb
'
)
as
f
:
...
...
@@ -324,7 +329,13 @@ class ConcentrationOutput(Output):
def
__init__
(
self
,
fpath
,
vars
=
None
):
self
.
fpath
=
fpath
with
open
(
fpath
,
'
rb
'
)
as
f
:
self
.
data
=
_mygenfromtxt
(
f
)
# not using mygenfromtxt as we know the file format and this is way faster...
spamreader
=
csv
.
reader
(
f
,
skipinitialspace
=
True
,
delimiter
=
"
"
)
hdr
=
spamreader
.
next
()
dat
=
[]
for
row
in
spamreader
:
dat
.
append
(
tuple
(
map
(
float
,
row
))
)
self
.
data
=
np
.
array
(
dat
,
dtype
=
[(
_
,
float
)
for
_
in
hdr
])
self
.
times
=
self
.
data
[
'
time
'
]
if
not
vars
is
None
:
self
.
data
=
self
.
data
[
vars
]
...
...
This diff is collapsed.
Click to expand it.
docs/index.rst
+
3
−
1
View file @
3705b2a3
...
...
@@ -129,7 +129,9 @@ Experiment
Input/Output
^^^^^^^^^^^^
.. autoclass:: InputFile
.. autofunction:: InputFile
.. autoclass:: InputFile17
.. autoclass:: InputFileOrig
.. autoclass:: ConcentrationOutput
:inherited-members:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment