bcliang / gamry-parser Goto Github PK
View Code? Open in Web Editor NEWPackage for parsing the contents of Gamry EXPLAIN data (DTA) files
License: MIT License
Package for parsing the contents of Gamry EXPLAIN data (DTA) files
License: MIT License
List of errors generated:
./gamry_parser/vfp600.py:42:17: E226 missing whitespace around arithmetic operator
./gamry_parser/vfp600.py:67:1: W293 blank line contains whitespace
./gamry_parser/vfp600.py:88:1: W391 blank line at end of file
./gamry_parser/__init__.py:7:27: W292 no newline at end of file
./gamry_parser/gamryparser.py:185:1: W293 blank line contains whitespace
./tests/test_vfp600.py:17:49: E226 missing whitespace around arithmetic operator
./tests/test_vfp600.py:17:53: E261 at least two spaces before inline comment
./tests/test_vfp600.py:21:1: W293 blank line contains whitespace
./tests/test_vfp600.py:25:1: W293 blank line contains whitespace
./tests/test_vfp600.py:28:1: W293 blank line contains whitespace
./tests/test_vfp600.py:30:51: E226 missing whitespace around arithmetic operator
./tests/test_vfp600.py:32:57: E226 missing whitespace around arithmetic operator
./tests/test_vfp600.py:32:70: W292 no newline at end of file
4 E226 missing whitespace around arithmetic operator
1 E261 at least two spaces before inline comment
2 W292 no newline at end of file
Couple years old now, but setup.py test
and the test_suite
property have been deprecated. The setuptools recommendation is to migrate to tox
https://tox.readthedocs.io/en/latest/example/basic.html#a-simple-tox-ini-default-environments
Currently, github actions are used as CI to run linting and unit tests. It would be nice to automate publishing a new release to pypi through similar triggers.
Hello everyone,
sorry if this is a newbie question, but upon loading the file, I run into a 'could not convert string to float: '0,00000E+000' error. My Gamry outpul .DATA files contain scientific notation of numbers and apparently the loading of the file and conversion to pd.dataframe has an issue with that. What were your solutions/what am I doing wrong?
Thanks for any advice
Hi!
I'm having the same issue has there been found a solution already?
Originally posted by @wotgit in #47 (comment)
Following up on #47 (and related to #13), need to make a note in the README to let users know how to handle data from a non-US locale (pandas
default)
Latest Gamry Framework will append the following line for experiments that are aborted (including in the middle of a curve).
EXPERIMENTABORTED TOGGLE T Experiment Aborted
Current behavior:
This currently causes the parser to raise an exception (can't convert string to int when trying to add the row into the current curve's dataframe).
Expected behavior:
Curve should load all collected data leading up to the EXPERIMENTABORTED
label
Recently installed new gamry framework software. Looks like the EXPLAIN label for DATE
is now presented in D-M-YYYY
format. Previously, the date label was provided as MM/DD/YYYY
(EN_US format).
This breaks assumptions using timestamp-aware experiments (CHRONOA
, CORPOT
), in which we rely exclusively on pandas.to_datetime()
.
Solution:
pandas.to_datetime
calls, add the parameter datefirst=True
when necessary.Package should properly parse CORPOT
explain files.
T
, Vf
self.curves[0]
should be the same as self.ocv
In my fork, I've added functionality to cv.py:
We should migrate to using pandas read_csv rather than maintaining a custom parser.
See gamryparser.GamryParser.read_curves.read_curve_data
Replace class getter methods with @property
decorators.
Note: this will be a breaking change.
After pull request 13 adds read-in of units, it would be straightforward to use the quantities package.
ChronoAmperometry
is a subclass of GamryParser
. It overloads the GamryParser.load()
function improperly (does not support filename input).
Need to fix to support specifying ChronoAmperometry.load(filename)
Installation, Usage, Development information.
The load()
method of the GamryParser
class and subclasses process raw DTA data. An alternative is to specify the file to be processed during class initialization.
For the OpenCircuitPotential subclass, an additional parameter was introduced allowing users to define whether the resulting dataframe samples should be listed in time elapsed (seconds) or as a pandas.Timestamp
(param: to_timestamp
).
load()
method doesn't respect the to_timestamp
parameter specified in init.load()
method should accept another optional input (to_timestamp
) allowing the user to specify on a per-load basis.Hello everyone,
sorry if this is a newbie question, but upon loading the file, I run into a 'could not convert string to float: '0,00000E+000' error.
My Gamry outpul .DATA files contain scientific notation of numbers and apparently the loading of the file and conversion to pd.dataframe has an issue with that.
What were your solutions/what am I doing wrong?
Thanks for any advice
Currently, OCVCURVE data is ignored by the parser (#13).
Instead, (if it exists) the OCV data should be kept and made accessible to the user.
Currently:
self.ocv_curve
indicates if the DTA file contained an OCV curve in the header.Fix:
OCVCURVE TABLE [__a_number__]
Pt T Vf Vm Ach Over
# s V vs. Ref. V V bits
It appears that the manifest is missing at least one file necessary to build
from the sdist for version 0.4.1. You're in good company, about 5% of other
projects updated in the last year are also missing files.
+ /tmp/venv/bin/pip3 wheel --no-binary gamry-parser -w /tmp/ext gamry-parser==0.4.1
Looking in indexes: http://10.10.0.139:9191/root/pypi/+simple/
Collecting gamry-parser==0.4.1
Downloading http://10.10.0.139:9191/root/pypi/%2Bf/598/4cf3a2950d58a/gamry_parser-0.4.1.tar.gz (10 kB)
ERROR: Command errored out with exit status 1:
command: /tmp/venv/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-wheel-4es5ic97/gamry-parser/setup.py'"'"'; __file__='"'"'/tmp/pip-wheel-4es5ic97/gamry-parser/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-wheel-4es5ic97/gamry-parser/pip-egg-info
cwd: /tmp/pip-wheel-4es5ic97/gamry-parser/
Complete output (7 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-wheel-4es5ic97/gamry-parser/setup.py", line 23, in <module>
install_requires=get_requirements(),
File "/tmp/pip-wheel-4es5ic97/gamry-parser/setup.py", line 5, in get_requirements
requirements = open("requirements.txt", "r").read()
FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
EXPLAIN data format may be used to record many different types of experiments (including custom-generated ones). In fact, all experiments run by the Gamry Framework software will save results to an EXPLAIN-compatible file.
For different experiment types (e.g. cyclic voltammetry and potentiostatic EIS have different inputs and outputs), the generic parser class may result in a lot of overhead for end users.
Example Use case
For cyclic voltammetry experiments, the Gamry Framework is configured to perform N cycles of voltage cycling between A and B potentials at a rate of +/- C mV/s and sampling every D seconds.
GamryParser
T
, keep Vf
and Im
). Not supportedIn the not supported cases, it make sense to extend the GamryParser
class with experiment-specific classes, overloading and adding methods as necessary.
Proposal
An initial set of subclasses should be created. My immediate needs are to do this for Cyclic Voltammetry (CV) and Chronoamperometry (CHRONOA) experiments, though online the most common usage appears to be for Potentiostatic Impedance (EISPOT) experiments (often associated with battery simulation).
Gamry files are created with local number formatting. For example, in Germany and much of the world, the comma is used a decimal separator. So a value would be 8,47309E-004 in the DTA file.
This can be partly solved with import locale
in the header and replacing float
with locale.atof
in read_header
. Then any file using gamry-parser can set the locale:
import gamry_parser as parser
import locale
locale.setlocale(locale.LC_ALL, 'de_DE')
file = 'CV.DTA'
gp = parser.GamryParser()
gp.load(filename=file)
However, a problem remains. read_curves
uses the following line:
temp = temp.apply(pd.to_numeric, errors='ignore')
This doesn't use the locale. It doesn't give an error, but numbers with a comma decimal remain as strings. I'm not sure what the best way to solve this is.
VFP600 is a LabView frontend distributed by Gamry alongside the Gamry Framework. VFP600 generates a simple EXPLAIN-formatted data file.
Notable differences from typical explain files:
CyclicVoltammetry.get_v_range()
only looks up the results from the first curve. Usually, this should match the entire set of curves, but it is possible to set up the initial potential to skip some of the range in the first curve. I suspect it's also possible to miss on other curves if the experiment is aborted before completion.
Instead, we should be looking the range up from the header:
VINIT
: starting potentialVLIMIT1
: minimum voltage rangeVLIMIT2
: maximum voltage rangeVFINAL
: ending potentialFix:
(VLIMIT1, VLIMIT2)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.