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
Show more breadcrumbs
Yusuf Hamied Department of Chemistry
Hunter Group
SSIPtools
SSIMPLEapps
phasecalculator
Commits
4663347b
Commit
4663347b
authored
5 years ago
by
Mark Driver
Browse files
Options
Downloads
Patches
Plain Diff
doc updates.
parent
40b39d25
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
phasecalculator/classes/outputinformation.py
+97
-0
97 additions, 0 deletions
phasecalculator/classes/outputinformation.py
with
97 additions
and
0 deletions
phasecalculator/classes/outputinformation.py
+
97
−
0
View file @
4663347b
...
@@ -32,6 +32,25 @@ LOGGER.setLevel(logging.WARN)
...
@@ -32,6 +32,25 @@ LOGGER.setLevel(logging.WARN)
class
OutputInformation
(
object
):
class
OutputInformation
(
object
):
"""
Class representation of output information.
"""
"""
Class representation of output information.
"""
def
__init__
(
self
,
fgip_output
,
similarity_output
,
similarity_output_type
,
vle_output
):
def
__init__
(
self
,
fgip_output
,
similarity_output
,
similarity_output_type
,
vle_output
):
"""
Initialise OutputInformation.
Parameters
----------
fgip_output : bool
FGIP output result.
similarity_output : bool
Similarity output result.
similarity_output_type : str
Output type, see schema for restriction.
vle_output : bool
VLE output result.
Returns
-------
OutputInformation
Initialise new OutputInformation.
"""
self
.
fgip_output
=
fgip_output
self
.
fgip_output
=
fgip_output
self
.
similarity_output
=
similarity_output
self
.
similarity_output
=
similarity_output
self
.
similarity_output_type
=
similarity_output_type
self
.
similarity_output_type
=
similarity_output_type
...
@@ -58,17 +77,58 @@ class OutputInformation(object):
...
@@ -58,17 +77,58 @@ class OutputInformation(object):
return
False
return
False
@classmethod
@classmethod
def
parse_xml
(
cls
,
output_xml
):
def
parse_xml
(
cls
,
output_xml
):
"""
Parse XML representation.
Parameters
----------
output_xml : etree.Element
OutputInformation element representation.
Returns
-------
OutputInformation
New class instance.
"""
fgip_output
=
OutputInformation
.
parse_fgip_output
(
output_xml
)
fgip_output
=
OutputInformation
.
parse_fgip_output
(
output_xml
)
similarity_output
,
similarity_output_type
=
OutputInformation
.
parse_similarity_output
(
output_xml
)
similarity_output
,
similarity_output_type
=
OutputInformation
.
parse_similarity_output
(
output_xml
)
vle_output
=
OutputInformation
.
parse_vle_output
(
output_xml
)
vle_output
=
OutputInformation
.
parse_vle_output
(
output_xml
)
return
OutputInformation
(
fgip_output
,
similarity_output
,
similarity_output_type
,
vle_output
)
return
OutputInformation
(
fgip_output
,
similarity_output
,
similarity_output_type
,
vle_output
)
@classmethod
@classmethod
def
parse_fgip_output
(
cls
,
output_xml
):
def
parse_fgip_output
(
cls
,
output_xml
):
"""
Parse FGIP output information from from output information element.
Parameters
----------
output_xml : etree.Element
OutputInformation element representation.
Returns
-------
bool
FGIP output result.
"""
xpath_expression
=
"
phasecalc:FGIPOutput/text()
"
xpath_expression
=
"
phasecalc:FGIPOutput/text()
"
fgip_output
=
output_xml
.
xpath
(
xpath_expression
,
namespaces
=
PHASE_CALC_NAMESPACE_DICT
)[
0
]
fgip_output
=
output_xml
.
xpath
(
xpath_expression
,
namespaces
=
PHASE_CALC_NAMESPACE_DICT
)[
0
]
return
True
if
fgip_output
==
"
true
"
else
False
return
True
if
fgip_output
==
"
true
"
else
False
@classmethod
@classmethod
def
parse_similarity_output
(
cls
,
output_xml
):
def
parse_similarity_output
(
cls
,
output_xml
):
"""
Parse similarity output information from output information element.
Parameters
----------
output_xml : etree.Element
OutputInformation element representation.
Returns
-------
similarity_output : bool
Similarity output result.
similarity_output_type : str
Output type, see schema for restriction.
"""
xpath_expression
=
"
phasecalc:SimilarityOutput/text()
"
xpath_expression
=
"
phasecalc:SimilarityOutput/text()
"
similarity_output
=
output_xml
.
xpath
(
xpath_expression
,
namespaces
=
PHASE_CALC_NAMESPACE_DICT
)[
0
]
similarity_output
=
output_xml
.
xpath
(
xpath_expression
,
namespaces
=
PHASE_CALC_NAMESPACE_DICT
)[
0
]
if
similarity_output
:
if
similarity_output
:
...
@@ -80,6 +140,19 @@ class OutputInformation(object):
...
@@ -80,6 +140,19 @@ class OutputInformation(object):
return
similarity_output
,
similarity_output_type
return
similarity_output
,
similarity_output_type
@classmethod
@classmethod
def
parse_vle_output
(
cls
,
output_xml
):
def
parse_vle_output
(
cls
,
output_xml
):
"""
Parse VLE from output information element.
Parameters
----------
output_xml : etree.Element
OutputInformation element representation.
Returns
-------
bool
VLE output option.
"""
xpath_expression
=
"
phasecalc:FGIPOutput/text()
"
xpath_expression
=
"
phasecalc:FGIPOutput/text()
"
vle_output
=
output_xml
.
xpath
(
xpath_expression
,
namespaces
=
PHASE_CALC_NAMESPACE_DICT
)[
0
]
vle_output
=
output_xml
.
xpath
(
xpath_expression
,
namespaces
=
PHASE_CALC_NAMESPACE_DICT
)[
0
]
return
True
if
vle_output
==
"
true
"
else
False
return
True
if
vle_output
==
"
true
"
else
False
...
@@ -98,16 +171,40 @@ class OutputInformation(object):
...
@@ -98,16 +171,40 @@ class OutputInformation(object):
out_element
.
append
(
self
.
write_vle_output
())
out_element
.
append
(
self
.
write_vle_output
())
return
out_element
return
out_element
def
write_fgip_output
(
self
):
def
write_fgip_output
(
self
):
"""
Write FGIP output XML Element.
Returns
-------
fgip_element : etree.Element
FGIP element representation.
"""
fgip_element
=
etree
.
Element
(
PHASE_CALCULATOR
+
"
FGIPOutput
"
,
nsmap
=
PHASE_CALC_NAMESPACE_DICT
)
fgip_element
=
etree
.
Element
(
PHASE_CALCULATOR
+
"
FGIPOutput
"
,
nsmap
=
PHASE_CALC_NAMESPACE_DICT
)
fgip_element
.
text
=
str
(
self
.
fgip_output
).
lower
()
fgip_element
.
text
=
str
(
self
.
fgip_output
).
lower
()
return
fgip_element
return
fgip_element
def
write_similarity_output
(
self
):
def
write_similarity_output
(
self
):
"""
Write Similarity output XML Element.
Returns
-------
sim_element : etree.Element
Similarity element representation.
"""
sim_element
=
etree
.
Element
(
PHASE_CALCULATOR
+
"
SimilarityOutput
"
,
nsmap
=
PHASE_CALC_NAMESPACE_DICT
)
sim_element
=
etree
.
Element
(
PHASE_CALCULATOR
+
"
SimilarityOutput
"
,
nsmap
=
PHASE_CALC_NAMESPACE_DICT
)
sim_element
.
text
=
str
(
self
.
similarity_output
).
lower
()
sim_element
.
text
=
str
(
self
.
similarity_output
).
lower
()
if
self
.
similarity_output_type
is
not
None
:
if
self
.
similarity_output_type
is
not
None
:
sim_element
.
set
(
PHASE_CALCULATOR
+
"
outputType
"
,
self
.
similarity_output_type
)
sim_element
.
set
(
PHASE_CALCULATOR
+
"
outputType
"
,
self
.
similarity_output_type
)
return
sim_element
return
sim_element
def
write_vle_output
(
self
):
def
write_vle_output
(
self
):
"""
Write VLE output XML Element.
Returns
-------
vle_element : etree.Element
VLE element representation.
"""
vle_element
=
etree
.
Element
(
PHASE_CALCULATOR
+
"
VLEOutput
"
,
nsmap
=
PHASE_CALC_NAMESPACE_DICT
)
vle_element
=
etree
.
Element
(
PHASE_CALCULATOR
+
"
VLEOutput
"
,
nsmap
=
PHASE_CALC_NAMESPACE_DICT
)
vle_element
.
text
=
str
(
self
.
vle_output
).
lower
()
vle_element
.
text
=
str
(
self
.
vle_output
).
lower
()
return
vle_element
return
vle_element
\ No newline at end of file
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