FAQ
| This is a
LIVE
service |
Changelog
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
phasecalculator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
GitLab has been upgraded. See what's new in the
Changelog
.
Show more breadcrumbs
Yusuf Hamied Department of Chemistry
Hunter Group
SSIPtools
SSIMPLEapps
phasecalculator
Commits
4026533a
Commit
4026533a
authored
5 years ago
by
Mark Driver
Browse files
Options
Downloads
Patches
Plain Diff
add function for reading polynomial files.
parent
c1769a1c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
phasecalculator/io/polynomialio.py
+23
-0
23 additions, 0 deletions
phasecalculator/io/polynomialio.py
phasecalculator/test/iotest/polynomialiotest.py
+31
-1
31 additions, 1 deletion
phasecalculator/test/iotest/polynomialiotest.py
with
54 additions
and
1 deletion
phasecalculator/io/polynomialio.py
+
23
−
0
View file @
4026533a
...
...
@@ -21,6 +21,7 @@ Script for running polynomial generation.
"""
import
logging
import
solventmapcreator.io.polynomialdatareader
as
polyread
import
solventmapcreator.polynomialanalysis.polynomialplotting
as
polyplot
logging
.
basicConfig
()
...
...
@@ -34,6 +35,28 @@ POSITIVE_POINTS = ["{:.3f}solute".format((float(x)/10.0)) for x in range(101)]
NEGATIVE_POINTS
=
[
"
{:.3f}solute
"
.
format
((
float
(
x
)
/
10.0
)
-
20.0
)
for
x
in
range
(
201
)]
def
read_poly_data_to_dict
(
poly_filename_list
,
**
kwargs
):
"""
Parse each file, and then returns the dictionary of information, by solvent ID.
Parameters
----------
poly_filename_list : list
list of polynomial file names.
suffix : str, optional
polynomial file suffix.
temperature_dir : bool, optional
if files are in temperature based directories, indicates to include
the preceding directory name in solvent ID to be able to distiguish
the same solvent composition at different temperatures.
Returns
-------
dict
dict of polynomial data by solvent ID.
"""
return
polyread
.
parse_polynomial_data_file_list
(
poly_filename_list
,
**
kwargs
)
def
generate_polynomial_data_free_energy_file_list
(
free_energy_filename_list
):
"""
Generate polynomial fits for free energy data in given files.
...
...
This diff is collapsed.
Click to expand it.
phasecalculator/test/iotest/polynomialiotest.py
+
31
−
1
View file @
4026533a
...
...
@@ -44,6 +44,7 @@ class PolynomialIOTestCase(unittest.TestCase):
None.
"""
self
.
maxDiff
=
None
parent_directory
=
pathlib
.
Path
(
__file__
).
parents
[
1
]
self
.
binding_file
=
(
parent_directory
/
"
resources
"
/
"
expected_parsedbinding.xml
"
).
absolute
().
as_posix
()
self
.
expected_binding_poly
=
(
parent_directory
/
"
resources
"
/
"
expected_bindingpoly.csv
"
).
absolute
().
as_posix
()
...
...
@@ -63,8 +64,37 @@ class PolynomialIOTestCase(unittest.TestCase):
os
.
remove
(
self
.
actual_binding_poly_file
)
if
os
.
path
.
isfile
(
self
.
actual_free_poly_file
):
os
.
remove
(
self
.
actual_free_poly_file
)
def
test_read_poly_data_to_dict
(
self
):
"""
Test expected_polynomial information read in.
Returns
-------
None.
"""
expected_dict
=
{
'
resourcesexpected,parsed
'
:{
8
:
{
'
negative
'
:
{
'
RMSE
'
:
0.0137444779
,
'
coefficients
'
:
np
.
array
([
-
2.60836624e-01
,
4.65295250e-01
,
2.57637417e-01
,
2.19491128e-01
,
4.20087475e-02
,
4.02289353e-03
,
2.12247938e-04
,
5.89243946e-06
,
6.73443996e-08
]),
'
covar
'
:
0.0379710451935
,
'
order
'
:
8
},
'
positive
'
:
{
'
RMSE
'
:
0.008907316
,
'
coefficients
'
:
np
.
array
([
-
2.52075337e-01
,
-
7.07009850e-01
,
9.86359325e-01
,
-
1.40859321e+00
,
5.04060101e-01
,
-
9.17970326e-02
,
9.28812463e-03
,
-
4.97458825e-04
,
1.10198937e-05
]),
'
covar
'
:
0.008013368123414
,
'
order
'
:
8
}}}}
actual_dict
=
polyio
.
read_poly_data_to_dict
([
self
.
expected_free_poly
],
suffix
=
"
freepoly.csv
"
,
temperature_dir
=
True
)
self
.
assertListEqual
(
list
(
expected_dict
.
keys
()),
list
(
actual_dict
.
keys
()))
for
region
,
info_dict
in
actual_dict
[
'
resourcesexpected,parsed
'
][
8
].
items
():
for
key
,
value
in
info_dict
.
items
():
if
key
==
"
coefficients
"
:
np
.
testing
.
assert_allclose
(
value
,
expected_dict
[
'
resourcesexpected,parsed
'
][
8
][
region
][
key
])
else
:
self
.
assertEqual
(
value
,
expected_dict
[
'
resourcesexpected,parsed
'
][
8
][
region
][
key
])
def
test_generate_polynomial_data_free_energy_file_list
(
self
):
"""
Test expected polynomial data ouputed.
"""
Test expected polynomial data ou
t
puted.
Returns
-------
...
...
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