Worked examples¶
Each file in the validation corpus, its source beside the representations derived from it.
The corpus is annotation tiers over the same computation. Compare
tier1_plain with tier3_oold: identical control flow, and a constructor that
collapses into a typed node only once its type resolves.
Only the ast profile is shown, and the RDF tab shows the document layer, so
every tab is the tab beside it in another notation.
tier1_plain/procedure.py¶
"""Tier 1: plain Python. No annotations anywhere.
The parameters cross the call boundary as bare floats, so nothing in the
source says what 4.2 or 0.23 mean. This is the lower bound of the gradient:
a call graph with control flow and literals, and no semantics.
"""
from battery.device import charge, rest
def procedure(cycles):
i = 0
while i < cycles:
charge(4.2, 0.23)
rest(600)
i += 1
{
"@type": "Module",
"body": [
{
"literal": "Tier 1: plain Python. No annotations anywhere.\n\nThe parameters cross the call boundary as bare floats, so nothing in the\nsource says what 4.2 or 0.23 mean. This is the lower bound of the gradient:\na call graph with control flow and literals, and no semantics.\n"
},
{"@type": "ImportFrom", "module": "battery.device", "names": ["charge", "rest"], "level": 0},
{
"@type": "FunctionDef",
"name": "procedure",
"args": ["cycles"],
"body": [
{"@type": "Assign", "targets": [{"var": "i"}], "value": {"literal": 0}},
{
"@type": "While",
"test": {"@type": "Compare", "left": {"var": "i"}, "ops": ["Lt"], "comparators": [{"var": "cycles"}]},
"body": [
{"@type": "Call", "func": {"var": "charge"}, "args": [{"literal": 4.2}, {"literal": 0.23}]},
{"@type": "Call", "func": {"var": "rest"}, "args": [{"literal": 600}]},
{"@type": "AugAssign", "target": {"var": "i"}, "op": "Add", "value": {"literal": 1}}
]
}
]
}
]
}
{
"@type": "Module",
"body": [
{
"literal": "Tier 1: plain Python. No annotations anywhere.\n\nThe parameters cross the call boundary as bare floats, so nothing in the\nsource says what 4.2 or 0.23 mean. This is the lower bound of the gradient:\na call graph with control flow and literals, and no semantics.\n"
},
{"@type": "ImportFrom", "module": "battery.device", "names": ["charge", "rest"], "level": 0},
{
"@type": "FunctionDef",
"name": "procedure",
"args": ["cycles"],
"body": [
{"@type": "Assign", "targets": [{"var": "i"}], "value": {"literal": 0}},
{
"@type": "While",
"test": {"@type": "Compare", "left": {"var": "i"}, "ops": ["Lt"], "comparators": [{"var": "cycles"}]},
"body": [
{"@type": "Call", "func": {"var": "charge"}, "args": [{"literal": 4.2}, {"literal": 0.23}]},
{"@type": "Call", "func": {"var": "rest"}, "args": [{"literal": 600}]},
{"@type": "AugAssign", "target": {"var": "i"}, "op": "Add", "value": {"literal": 1}}
]
}
]
}
]
}
@prefix awl: <https://w3id.org/awl/schema/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<https://w3id.org/awl/py/tier1_plain.procedure/procedure.step#3> a awl:Assign ;
awl:order 0 ;
awl:span [ awl:endCol 9 ;
awl:endLine 12 ;
awl:file "procedure.py" ;
awl:startCol 4 ;
awl:startLine 12 ] ;
awl:targets [ awl:span [ awl:endCol 5 ;
awl:endLine 12 ;
awl:file "procedure.py" ;
awl:startCol 4 ;
awl:startLine 12 ] ;
awl:var "i" ] ;
awl:value [ awl:literal 0 ;
awl:span [ awl:endCol 9 ;
awl:endLine 12 ;
awl:file "procedure.py" ;
awl:startCol 8 ;
awl:startLine 12 ] ] .
<https://w3id.org/awl/py/tier1_plain.procedure/procedure.step#4> a awl:While ;
awl:body ( <https://w3id.org/awl/py/tier1_plain.procedure/procedure.step#5> <https://w3id.org/awl/py/tier1_plain.procedure/procedure.step#6> <https://w3id.org/awl/py/tier1_plain.procedure/procedure.step#7> ) ;
awl:order 1 ;
awl:span [ awl:endCol 14 ;
awl:endLine 16 ;
awl:file "procedure.py" ;
awl:startCol 4 ;
awl:startLine 13 ] ;
awl:test [ a awl:Compare ;
awl:comparators [ awl:span [ awl:endCol 20 ;
awl:endLine 13 ;
awl:file "procedure.py" ;
awl:startCol 14 ;
awl:startLine 13 ] ;
awl:var "cycles" ] ;
awl:left [ awl:span [ awl:endCol 11 ;
awl:endLine 13 ;
awl:file "procedure.py" ;
awl:startCol 10 ;
awl:startLine 13 ] ;
awl:var "i" ] ;
awl:ops "Lt" ;
awl:span [ awl:endCol 20 ;
awl:endLine 13 ;
awl:file "procedure.py" ;
awl:startCol 10 ;
awl:startLine 13 ] ] .
<https://w3id.org/awl/py/tier1_plain.procedure/procedure.step#5> a awl:Call ;
awl:argument ( [ awl:literal 4.2e+00 ;
awl:span [ awl:endCol 18 ;
awl:endLine 14 ;
awl:file "procedure.py" ;
awl:startCol 15 ;
awl:startLine 14 ] ] [ awl:literal 2.3e-01 ;
awl:span [ awl:endCol 24 ;
awl:endLine 14 ;
awl:file "procedure.py" ;
awl:startCol 20 ;
awl:startLine 14 ] ] ) ;
awl:func [ awl:span [ awl:endCol 14 ;
awl:endLine 14 ;
awl:file "procedure.py" ;
awl:startCol 8 ;
awl:startLine 14 ] ;
awl:var "charge" ] ;
awl:order 0 ;
awl:span [ awl:endCol 25 ;
awl:endLine 14 ;
awl:file "procedure.py" ;
awl:startCol 8 ;
awl:startLine 14 ] .
<https://w3id.org/awl/py/tier1_plain.procedure/procedure.step#6> a awl:Call ;
awl:argument ( [ awl:literal 600 ;
awl:span [ awl:endCol 16 ;
awl:endLine 15 ;
awl:file "procedure.py" ;
awl:startCol 13 ;
awl:startLine 15 ] ] ) ;
awl:func [ awl:span [ awl:endCol 12 ;
awl:endLine 15 ;
awl:file "procedure.py" ;
awl:startCol 8 ;
awl:startLine 15 ] ;
awl:var "rest" ] ;
awl:order 1 ;
awl:span [ awl:endCol 17 ;
awl:endLine 15 ;
awl:file "procedure.py" ;
awl:startCol 8 ;
awl:startLine 15 ] .
<https://w3id.org/awl/py/tier1_plain.procedure/procedure.step#7> a awl:AugAssign ;
awl:op "Add" ;
awl:order 2 ;
awl:span [ awl:endCol 14 ;
awl:endLine 16 ;
awl:file "procedure.py" ;
awl:startCol 8 ;
awl:startLine 16 ] ;
awl:target [ awl:span [ awl:endCol 9 ;
awl:endLine 16 ;
awl:file "procedure.py" ;
awl:startCol 8 ;
awl:startLine 16 ] ;
awl:var "i" ] ;
awl:value [ awl:literal 1 ;
awl:span [ awl:endCol 14 ;
awl:endLine 16 ;
awl:file "procedure.py" ;
awl:startCol 13 ;
awl:startLine 16 ] ] .
<https://w3id.org/awl/py/tier1_plain.procedure/step#1> awl:literal """Tier 1: plain Python. No annotations anywhere.
The parameters cross the call boundary as bare floats, so nothing in the
source says what 4.2 or 0.23 mean. This is the lower bound of the gradient:
a call graph with control flow and literals, and no semantics.
""" ;
awl:order 0 ;
awl:span [ awl:endCol 3 ;
awl:endLine 6 ;
awl:file "procedure.py" ;
awl:startCol 0 ;
awl:startLine 1 ] .
<https://w3id.org/awl/py/tier1_plain.procedure/step#2> a awl:ImportFrom ;
awl:level 0 ;
awl:module "battery.device" ;
awl:names "charge",
"rest" ;
awl:order 1 ;
awl:span [ awl:endCol 39 ;
awl:endLine 8 ;
awl:file "procedure.py" ;
awl:startCol 0 ;
awl:startLine 8 ] .
[] a awl:Module ;
awl:body ( <https://w3id.org/awl/py/tier1_plain.procedure/step#1> <https://w3id.org/awl/py/tier1_plain.procedure/step#2> [ a awl:FunctionDef ;
awl:args "cycles" ;
awl:body ( <https://w3id.org/awl/py/tier1_plain.procedure/procedure.step#3> <https://w3id.org/awl/py/tier1_plain.procedure/procedure.step#4> ) ;
awl:name "procedure" ;
awl:order 2 ;
awl:span [ awl:endCol 14 ;
awl:endLine 16 ;
awl:file "procedure.py" ;
awl:startCol 0 ;
awl:startLine 11 ] ] ) .
tier2_dataclass/params.py¶
{
"@type": "Module",
"body": [
{"literal": "Tier 2: parameter object as a plain dataclass."},
{"@type": "ImportFrom", "module": "dataclasses", "names": ["dataclass"], "level": 0},
{
"@type": "ClassDef",
"name": "ChargeParam",
"body": [
{"@type": "AnnAssign", "target": {"var": "target_voltage"}, "annotation": {"var": "float"}, "simple": 1},
{"@type": "AnnAssign", "target": {"var": "c_rate"}, "annotation": {"var": "float"}, "simple": 1}
],
"decorator_list": [{"var": "dataclass"}]
}
]
}
{
"@type": "Module",
"body": [
{"literal": "Tier 2: parameter object as a plain dataclass."},
{"@type": "ImportFrom", "module": "dataclasses", "names": ["dataclass"], "level": 0},
{
"@type": "ClassDef",
"name": "ChargeParam",
"body": [
{"@type": "AnnAssign", "target": {"var": "target_voltage"}, "annotation": {"var": "float"}, "simple": 1},
{"@type": "AnnAssign", "target": {"var": "c_rate"}, "annotation": {"var": "float"}, "simple": 1}
],
"decorator_list": [{"var": "dataclass"}]
}
]
}
@prefix awl: <https://w3id.org/awl/schema/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<https://w3id.org/awl/py/tier2_dataclass.params/step#1> awl:literal "Tier 2: parameter object as a plain dataclass." ;
awl:order 0 ;
awl:span [ awl:endCol 52 ;
awl:endLine 1 ;
awl:file "params.py" ;
awl:startCol 0 ;
awl:startLine 1 ] .
<https://w3id.org/awl/py/tier2_dataclass.params/step#2> a awl:ImportFrom ;
awl:level 0 ;
awl:module "dataclasses" ;
awl:names "dataclass" ;
awl:order 1 ;
awl:span [ awl:endCol 33 ;
awl:endLine 3 ;
awl:file "params.py" ;
awl:startCol 0 ;
awl:startLine 3 ] .
[] a awl:Module ;
awl:body ( <https://w3id.org/awl/py/tier2_dataclass.params/step#1> <https://w3id.org/awl/py/tier2_dataclass.params/step#2> [ a awl:ClassDef ;
awl:body ( [ a awl:AnnAssign ;
awl:annotation [ awl:span [ awl:endCol 25 ;
awl:endLine 8 ;
awl:file "params.py" ;
awl:startCol 20 ;
awl:startLine 8 ] ;
awl:var "float" ] ;
awl:order 0 ;
awl:simple 1 ;
awl:span [ awl:endCol 25 ;
awl:endLine 8 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 8 ] ;
awl:target [ awl:span [ awl:endCol 18 ;
awl:endLine 8 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 8 ] ;
awl:var "target_voltage" ] ] [ a awl:AnnAssign ;
awl:annotation [ awl:span [ awl:endCol 17 ;
awl:endLine 9 ;
awl:file "params.py" ;
awl:startCol 12 ;
awl:startLine 9 ] ;
awl:var "float" ] ;
awl:order 1 ;
awl:simple 1 ;
awl:span [ awl:endCol 17 ;
awl:endLine 9 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 9 ] ;
awl:target [ awl:span [ awl:endCol 10 ;
awl:endLine 9 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 9 ] ;
awl:var "c_rate" ] ] ) ;
awl:decorator_list [ awl:span [ awl:endCol 10 ;
awl:endLine 6 ;
awl:file "params.py" ;
awl:startCol 1 ;
awl:startLine 6 ] ;
awl:var "dataclass" ] ;
awl:name "ChargeParam" ;
awl:order 2 ;
awl:span [ awl:endCol 17 ;
awl:endLine 9 ;
awl:file "params.py" ;
awl:startCol 0 ;
awl:startLine 7 ] ] ) .
tier2_dataclass/procedure.py¶
"""Tier 2: typed Python, no linked data.
Same computation as tier 1, but the call now carries a named parameter
object. Field names and their Python types are recoverable; their meaning
is not, because nothing maps `target_voltage` to an IRI.
"""
from battery.device import charge, rest
from .params import ChargeParam
def procedure(cycles: int) -> None:
i = 0
while i < cycles:
charge(ChargeParam(target_voltage=4.2, c_rate=0.23))
rest(600)
i += 1
{
"@type": "Module",
"body": [
{
"literal": "Tier 2: typed Python, no linked data.\n\nSame computation as tier 1, but the call now carries a named parameter\nobject. Field names and their Python types are recoverable; their meaning\nis not, because nothing maps `target_voltage` to an IRI.\n"
},
{"@type": "ImportFrom", "module": "battery.device", "names": ["charge", "rest"], "level": 0},
{"@type": "ImportFrom", "module": "params", "names": ["ChargeParam"], "level": 1},
{
"@type": "FunctionDef",
"name": "procedure",
"args": [{"arg": "cycles", "annotation": {"var": "int"}}],
"body": [
{"@type": "Assign", "targets": [{"var": "i"}], "value": {"literal": 0}},
{
"@type": "While",
"test": {"@type": "Compare", "left": {"var": "i"}, "ops": ["Lt"], "comparators": [{"var": "cycles"}]},
"body": [
{"@type": "Call", "func": {"var": "charge"}, "args": [{"@type": ["ChargeParam"], "target_voltage": 4.2, "c_rate": 0.23}]},
{"@type": "Call", "func": {"var": "rest"}, "args": [{"literal": 600}]},
{"@type": "AugAssign", "target": {"var": "i"}, "op": "Add", "value": {"literal": 1}}
]
}
],
"returns": {"literal": null}
}
]
}
{
"@type": "Module",
"body": [
{
"literal": "Tier 2: typed Python, no linked data.\n\nSame computation as tier 1, but the call now carries a named parameter\nobject. Field names and their Python types are recoverable; their meaning\nis not, because nothing maps `target_voltage` to an IRI.\n"
},
{"@type": "ImportFrom", "module": "battery.device", "names": ["charge", "rest"], "level": 0},
{"@type": "ImportFrom", "module": "params", "names": ["ChargeParam"], "level": 1},
{
"@type": "FunctionDef",
"name": "procedure",
"args": [{"arg": "cycles", "annotation": {"var": "int"}}],
"body": [
{"@type": "Assign", "targets": [{"var": "i"}], "value": {"literal": 0}},
{
"@type": "While",
"test": {"@type": "Compare", "left": {"var": "i"}, "ops": ["Lt"], "comparators": [{"var": "cycles"}]},
"body": [
{
"@type": "Call",
"func": {"var": "charge"},
"args": [
{
"@type": "Call",
"func": {"var": "ChargeParam"},
"keyword_arguments": {"target_voltage": {"literal": 4.2}, "c_rate": {"literal": 0.23}}
}
]
},
{"@type": "Call", "func": {"var": "rest"}, "args": [{"literal": 600}]},
{"@type": "AugAssign", "target": {"var": "i"}, "op": "Add", "value": {"literal": 1}}
]
}
],
"returns": {"literal": null}
}
]
}
@prefix awl: <https://w3id.org/awl/schema/> .
@prefix ns1: <https://w3id.org/awl/py/tier2_dataclass.params/ChargeParam#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<https://w3id.org/awl/py/tier2_dataclass.procedure/procedure.step#4> a awl:Assign ;
awl:order 0 ;
awl:span [ awl:endCol 9 ;
awl:endLine 14 ;
awl:file "procedure.py" ;
awl:startCol 4 ;
awl:startLine 14 ] ;
awl:targets [ awl:span [ awl:endCol 5 ;
awl:endLine 14 ;
awl:file "procedure.py" ;
awl:startCol 4 ;
awl:startLine 14 ] ;
awl:var "i" ] ;
awl:value [ awl:literal 0 ;
awl:span [ awl:endCol 9 ;
awl:endLine 14 ;
awl:file "procedure.py" ;
awl:startCol 8 ;
awl:startLine 14 ] ] .
<https://w3id.org/awl/py/tier2_dataclass.procedure/procedure.step#5> a awl:While ;
awl:body ( <https://w3id.org/awl/py/tier2_dataclass.procedure/procedure.step#6> <https://w3id.org/awl/py/tier2_dataclass.procedure/procedure.step#7> <https://w3id.org/awl/py/tier2_dataclass.procedure/procedure.step#8> ) ;
awl:order 1 ;
awl:span [ awl:endCol 14 ;
awl:endLine 18 ;
awl:file "procedure.py" ;
awl:startCol 4 ;
awl:startLine 15 ] ;
awl:test [ a awl:Compare ;
awl:comparators [ awl:span [ awl:endCol 20 ;
awl:endLine 15 ;
awl:file "procedure.py" ;
awl:startCol 14 ;
awl:startLine 15 ] ;
awl:var "cycles" ] ;
awl:left [ awl:span [ awl:endCol 11 ;
awl:endLine 15 ;
awl:file "procedure.py" ;
awl:startCol 10 ;
awl:startLine 15 ] ;
awl:var "i" ] ;
awl:ops "Lt" ;
awl:span [ awl:endCol 20 ;
awl:endLine 15 ;
awl:file "procedure.py" ;
awl:startCol 10 ;
awl:startLine 15 ] ] .
<https://w3id.org/awl/py/tier2_dataclass.procedure/procedure.step#6> a awl:Call ;
awl:argument ( [ a <https://w3id.org/awl/py/tier2_dataclass.params/ChargeParam> ;
ns1:c_rate 2.3e-01 ;
ns1:target_voltage 4.2e+00 ;
awl:span [ awl:endCol 59 ;
awl:endLine 16 ;
awl:file "procedure.py" ;
awl:startCol 15 ;
awl:startLine 16 ] ] ) ;
awl:func [ awl:span [ awl:endCol 14 ;
awl:endLine 16 ;
awl:file "procedure.py" ;
awl:startCol 8 ;
awl:startLine 16 ] ;
awl:var "charge" ] ;
awl:order 0 ;
awl:span [ awl:endCol 60 ;
awl:endLine 16 ;
awl:file "procedure.py" ;
awl:startCol 8 ;
awl:startLine 16 ] .
<https://w3id.org/awl/py/tier2_dataclass.procedure/procedure.step#7> a awl:Call ;
awl:argument ( [ awl:literal 600 ;
awl:span [ awl:endCol 16 ;
awl:endLine 17 ;
awl:file "procedure.py" ;
awl:startCol 13 ;
awl:startLine 17 ] ] ) ;
awl:func [ awl:span [ awl:endCol 12 ;
awl:endLine 17 ;
awl:file "procedure.py" ;
awl:startCol 8 ;
awl:startLine 17 ] ;
awl:var "rest" ] ;
awl:order 1 ;
awl:span [ awl:endCol 17 ;
awl:endLine 17 ;
awl:file "procedure.py" ;
awl:startCol 8 ;
awl:startLine 17 ] .
<https://w3id.org/awl/py/tier2_dataclass.procedure/procedure.step#8> a awl:AugAssign ;
awl:op "Add" ;
awl:order 2 ;
awl:span [ awl:endCol 14 ;
awl:endLine 18 ;
awl:file "procedure.py" ;
awl:startCol 8 ;
awl:startLine 18 ] ;
awl:target [ awl:span [ awl:endCol 9 ;
awl:endLine 18 ;
awl:file "procedure.py" ;
awl:startCol 8 ;
awl:startLine 18 ] ;
awl:var "i" ] ;
awl:value [ awl:literal 1 ;
awl:span [ awl:endCol 14 ;
awl:endLine 18 ;
awl:file "procedure.py" ;
awl:startCol 13 ;
awl:startLine 18 ] ] .
<https://w3id.org/awl/py/tier2_dataclass.procedure/step#1> awl:literal """Tier 2: typed Python, no linked data.
Same computation as tier 1, but the call now carries a named parameter
object. Field names and their Python types are recoverable; their meaning
is not, because nothing maps `target_voltage` to an IRI.
""" ;
awl:order 0 ;
awl:span [ awl:endCol 3 ;
awl:endLine 6 ;
awl:file "procedure.py" ;
awl:startCol 0 ;
awl:startLine 1 ] .
<https://w3id.org/awl/py/tier2_dataclass.procedure/step#2> a awl:ImportFrom ;
awl:level 0 ;
awl:module "battery.device" ;
awl:names "charge",
"rest" ;
awl:order 1 ;
awl:span [ awl:endCol 39 ;
awl:endLine 8 ;
awl:file "procedure.py" ;
awl:startCol 0 ;
awl:startLine 8 ] .
<https://w3id.org/awl/py/tier2_dataclass.procedure/step#3> a awl:ImportFrom ;
awl:level 1 ;
awl:module "params" ;
awl:names "ChargeParam" ;
awl:order 2 ;
awl:span [ awl:endCol 31 ;
awl:endLine 10 ;
awl:file "procedure.py" ;
awl:startCol 0 ;
awl:startLine 10 ] .
[] a awl:Module ;
awl:body ( <https://w3id.org/awl/py/tier2_dataclass.procedure/step#1> <https://w3id.org/awl/py/tier2_dataclass.procedure/step#2> <https://w3id.org/awl/py/tier2_dataclass.procedure/step#3> [ a awl:FunctionDef ;
awl:args [ awl:annotation [ awl:span [ awl:endCol 25 ;
awl:endLine 13 ;
awl:file "procedure.py" ;
awl:startCol 22 ;
awl:startLine 13 ] ;
awl:var "int" ] ;
awl:arg "cycles" ] ;
awl:body ( <https://w3id.org/awl/py/tier2_dataclass.procedure/procedure.step#4> <https://w3id.org/awl/py/tier2_dataclass.procedure/procedure.step#5> ) ;
awl:name "procedure" ;
awl:order 3 ;
awl:returns [ awl:span [ awl:endCol 34 ;
awl:endLine 13 ;
awl:file "procedure.py" ;
awl:startCol 30 ;
awl:startLine 13 ] ] ;
awl:span [ awl:endCol 14 ;
awl:endLine 18 ;
awl:file "procedure.py" ;
awl:startCol 0 ;
awl:startLine 13 ] ] ) .
tier3_oold/params.py¶
"""Tier 3: parameter object in the OO-LD notation.
Exercises every declaration form the extraction pass must recognise:
- a declared instance type, via the ``type`` field default;
- ``Link[T]`` inside the annotation;
- ``LinkedField(link=True)`` with a plain annotation, the alternative form;
- a union arm mixing a literal, an inline object and a reference;
- a declared ``@context``, which is pulled rather than generated.
``Device`` declares no context, so both halves stay exercised: what a class
says about itself, and what has to be inferred from annotations when it says
nothing.
This module is parsed statically and is deliberately not imported: the
notation lives on an experimental oold-python branch, so it may not be
installed. Extraction is static, so that is sufficient.
"""
from pydantic import ConfigDict
from oold.experimental.notation import Link, LinkedBaseModel, LinkedField
class Device(LinkedBaseModel):
id: str
type: str | None = "ex:Device"
serial: str | None = None
class ChargeParam(LinkedBaseModel):
# The class states what its own fields mean, in the form the reference
# schemas use: a prefix, the class term, the type tag, then the terms.
# See https://schemas.oo-ld.org/quantities/0.1/QuantityValue.schema.json.
# Only target_voltage is declared, so c_rate still shows what a field the
# class says nothing about gets.
model_config = ConfigDict(
json_schema_extra={
"@context": {
"ex": "https://example.org/battery#",
"type": {"@id": "@type", "@container": "@set"},
"ChargeParam": "ex:ChargeParam",
"target_voltage": {"@id": "ex:targetVoltage", "@type": "xsd:double"},
}
}
)
id: str | None = None
type: list[str] | None = ["ChargeParam"]
target_voltage: float
c_rate: float
# Link[T] inside the annotation.
device: Link[Device] | None = None
# The alternative form: plain annotation, link declared on the field.
calibrated_against: Device | None = LinkedField(link=True)
# Union arm: literal text, inline object, or reference by IRI.
operator: str | Device | None = LinkedField(link=True)
{
"@type": "Module",
"body": [
{
"literal": "Tier 3: parameter object in the OO-LD notation.\n\nExercises every declaration form the extraction pass must recognise:\n\n- a declared instance type, via the ``type`` field default;\n- ``Link[T]`` inside the annotation;\n- ``LinkedField(link=True)`` with a plain annotation, the alternative form;\n- a union arm mixing a literal, an inline object and a reference;\n- a declared ``@context``, which is pulled rather than generated.\n\n``Device`` declares no context, so both halves stay exercised: what a class\nsays about itself, and what has to be inferred from annotations when it says\nnothing.\n\nThis module is parsed statically and is deliberately not imported: the\nnotation lives on an experimental oold-python branch, so it may not be\ninstalled. Extraction is static, so that is sufficient.\n"
},
{"@type": "ImportFrom", "module": "pydantic", "names": ["ConfigDict"], "level": 0},
{
"@type": "ImportFrom",
"module": "oold.experimental.notation",
"names": ["Link", "LinkedBaseModel", "LinkedField"],
"level": 0
},
{
"@type": "ClassDef",
"name": "Device",
"bases": [{"var": "LinkedBaseModel"}],
"body": [
{"@type": "AnnAssign", "target": {"var": "id"}, "annotation": {"var": "str"}, "simple": 1},
{
"@type": "AnnAssign",
"target": {"var": "type"},
"annotation": {"@type": "BinOp", "left": {"var": "str"}, "op": "BitOr", "right": {"literal": null}},
"value": {"literal": "ex:Device"},
"simple": 1
},
{
"@type": "AnnAssign",
"target": {"var": "serial"},
"annotation": {"@type": "BinOp", "left": {"var": "str"}, "op": "BitOr", "right": {"literal": null}},
"value": {"literal": null},
"simple": 1
}
]
},
{
"@type": "ClassDef",
"name": "ChargeParam",
"bases": [{"var": "LinkedBaseModel"}],
"body": [
{
"@type": "Assign",
"targets": [{"var": "model_config"}],
"value": {
"@type": "Call",
"func": {"var": "ConfigDict"},
"keyword_arguments": {
"json_schema_extra": {
"@type": "Dict",
"keys": [{"literal": "@context"}],
"values": [
{
"@type": "Dict",
"keys": [{"literal": "ex"}, {"literal": "type"}, {"literal": "ChargeParam"}, {"literal": "target_voltage"}],
"values": [
{"literal": "https://example.org/battery#"},
{
"@type": "Dict",
"keys": [{"literal": "@id"}, {"literal": "@container"}],
"values": [{"literal": "@type"}, {"literal": "@set"}]
},
{"literal": "ex:ChargeParam"},
{
"@type": "Dict",
"keys": [{"literal": "@id"}, {"literal": "@type"}],
"values": [{"literal": "ex:targetVoltage"}, {"literal": "xsd:double"}]
}
]
}
]
}
}
}
},
{
"@type": "AnnAssign",
"target": {"var": "id"},
"annotation": {"@type": "BinOp", "left": {"var": "str"}, "op": "BitOr", "right": {"literal": null}},
"value": {"literal": null},
"simple": 1
},
{
"@type": "AnnAssign",
"target": {"var": "type"},
"annotation": {
"@type": "BinOp",
"left": {"@type": "Subscript", "value": {"var": "list"}, "slice": {"var": "str"}},
"op": "BitOr",
"right": {"literal": null}
},
"value": {"@type": "List", "elts": [{"literal": "ChargeParam"}]},
"simple": 1
},
{"@type": "AnnAssign", "target": {"var": "target_voltage"}, "annotation": {"var": "float"}, "simple": 1},
{"@type": "AnnAssign", "target": {"var": "c_rate"}, "annotation": {"var": "float"}, "simple": 1},
{
"@type": "AnnAssign",
"target": {"var": "device"},
"annotation": {
"@type": "BinOp",
"left": {"@type": "Subscript", "value": {"var": "Link"}, "slice": {"var": "Device"}},
"op": "BitOr",
"right": {"literal": null}
},
"value": {"literal": null},
"simple": 1
},
{
"@type": "AnnAssign",
"target": {"var": "calibrated_against"},
"annotation": {"@type": "BinOp", "left": {"var": "Device"}, "op": "BitOr", "right": {"literal": null}},
"value": {"@type": "Call", "func": {"var": "LinkedField"}, "keyword_arguments": {"link": {"literal": true}}},
"simple": 1
},
{
"@type": "AnnAssign",
"target": {"var": "operator"},
"annotation": {
"@type": "BinOp",
"left": {"@type": "BinOp", "left": {"var": "str"}, "op": "BitOr", "right": {"var": "Device"}},
"op": "BitOr",
"right": {"literal": null}
},
"value": {"@type": "Call", "func": {"var": "LinkedField"}, "keyword_arguments": {"link": {"literal": true}}},
"simple": 1
}
]
}
]
}
{
"@type": "Module",
"body": [
{
"literal": "Tier 3: parameter object in the OO-LD notation.\n\nExercises every declaration form the extraction pass must recognise:\n\n- a declared instance type, via the ``type`` field default;\n- ``Link[T]`` inside the annotation;\n- ``LinkedField(link=True)`` with a plain annotation, the alternative form;\n- a union arm mixing a literal, an inline object and a reference;\n- a declared ``@context``, which is pulled rather than generated.\n\n``Device`` declares no context, so both halves stay exercised: what a class\nsays about itself, and what has to be inferred from annotations when it says\nnothing.\n\nThis module is parsed statically and is deliberately not imported: the\nnotation lives on an experimental oold-python branch, so it may not be\ninstalled. Extraction is static, so that is sufficient.\n"
},
{"@type": "ImportFrom", "module": "pydantic", "names": ["ConfigDict"], "level": 0},
{
"@type": "ImportFrom",
"module": "oold.experimental.notation",
"names": ["Link", "LinkedBaseModel", "LinkedField"],
"level": 0
},
{
"@type": "ClassDef",
"name": "Device",
"bases": [{"var": "LinkedBaseModel"}],
"body": [
{"@type": "AnnAssign", "target": {"var": "id"}, "annotation": {"var": "str"}, "simple": 1},
{
"@type": "AnnAssign",
"target": {"var": "type"},
"annotation": {"@type": "BinOp", "left": {"var": "str"}, "op": "BitOr", "right": {"literal": null}},
"value": {"literal": "ex:Device"},
"simple": 1
},
{
"@type": "AnnAssign",
"target": {"var": "serial"},
"annotation": {"@type": "BinOp", "left": {"var": "str"}, "op": "BitOr", "right": {"literal": null}},
"value": {"literal": null},
"simple": 1
}
]
},
{
"@type": "ClassDef",
"name": "ChargeParam",
"bases": [{"var": "LinkedBaseModel"}],
"body": [
{
"@type": "Assign",
"targets": [{"var": "model_config"}],
"value": {
"@type": "Call",
"func": {"var": "ConfigDict"},
"keyword_arguments": {
"json_schema_extra": {
"@type": "Dict",
"keys": [{"literal": "@context"}],
"values": [
{
"@type": "Dict",
"keys": [{"literal": "ex"}, {"literal": "type"}, {"literal": "ChargeParam"}, {"literal": "target_voltage"}],
"values": [
{"literal": "https://example.org/battery#"},
{
"@type": "Dict",
"keys": [{"literal": "@id"}, {"literal": "@container"}],
"values": [{"literal": "@type"}, {"literal": "@set"}]
},
{"literal": "ex:ChargeParam"},
{
"@type": "Dict",
"keys": [{"literal": "@id"}, {"literal": "@type"}],
"values": [{"literal": "ex:targetVoltage"}, {"literal": "xsd:double"}]
}
]
}
]
}
}
}
},
{
"@type": "AnnAssign",
"target": {"var": "id"},
"annotation": {"@type": "BinOp", "left": {"var": "str"}, "op": "BitOr", "right": {"literal": null}},
"value": {"literal": null},
"simple": 1
},
{
"@type": "AnnAssign",
"target": {"var": "type"},
"annotation": {
"@type": "BinOp",
"left": {"@type": "Subscript", "value": {"var": "list"}, "slice": {"var": "str"}},
"op": "BitOr",
"right": {"literal": null}
},
"value": {"@type": "List", "elts": [{"literal": "ChargeParam"}]},
"simple": 1
},
{"@type": "AnnAssign", "target": {"var": "target_voltage"}, "annotation": {"var": "float"}, "simple": 1},
{"@type": "AnnAssign", "target": {"var": "c_rate"}, "annotation": {"var": "float"}, "simple": 1},
{
"@type": "AnnAssign",
"target": {"var": "device"},
"annotation": {
"@type": "BinOp",
"left": {"@type": "Subscript", "value": {"var": "Link"}, "slice": {"var": "Device"}},
"op": "BitOr",
"right": {"literal": null}
},
"value": {"literal": null},
"simple": 1
},
{
"@type": "AnnAssign",
"target": {"var": "calibrated_against"},
"annotation": {"@type": "BinOp", "left": {"var": "Device"}, "op": "BitOr", "right": {"literal": null}},
"value": {"@type": "Call", "func": {"var": "LinkedField"}, "keyword_arguments": {"link": {"literal": true}}},
"simple": 1
},
{
"@type": "AnnAssign",
"target": {"var": "operator"},
"annotation": {
"@type": "BinOp",
"left": {"@type": "BinOp", "left": {"var": "str"}, "op": "BitOr", "right": {"var": "Device"}},
"op": "BitOr",
"right": {"literal": null}
},
"value": {"@type": "Call", "func": {"var": "LinkedField"}, "keyword_arguments": {"link": {"literal": true}}},
"simple": 1
}
]
}
]
}
@prefix awl: <https://w3id.org/awl/schema/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<https://w3id.org/awl/py/tier3_oold.params/step#1> awl:literal """Tier 3: parameter object in the OO-LD notation.
Exercises every declaration form the extraction pass must recognise:
- a declared instance type, via the ``type`` field default;
- ``Link[T]`` inside the annotation;
- ``LinkedField(link=True)`` with a plain annotation, the alternative form;
- a union arm mixing a literal, an inline object and a reference;
- a declared ``@context``, which is pulled rather than generated.
``Device`` declares no context, so both halves stay exercised: what a class
says about itself, and what has to be inferred from annotations when it says
nothing.
This module is parsed statically and is deliberately not imported: the
notation lives on an experimental oold-python branch, so it may not be
installed. Extraction is static, so that is sufficient.
""" ;
awl:order 0 ;
awl:span [ awl:endCol 3 ;
awl:endLine 18 ;
awl:file "params.py" ;
awl:startCol 0 ;
awl:startLine 1 ] .
<https://w3id.org/awl/py/tier3_oold.params/step#2> a awl:ImportFrom ;
awl:level 0 ;
awl:module "pydantic" ;
awl:names "ConfigDict" ;
awl:order 1 ;
awl:span [ awl:endCol 31 ;
awl:endLine 20 ;
awl:file "params.py" ;
awl:startCol 0 ;
awl:startLine 20 ] .
<https://w3id.org/awl/py/tier3_oold.params/step#3> a awl:ImportFrom ;
awl:level 0 ;
awl:module "oold.experimental.notation" ;
awl:names "Link",
"LinkedBaseModel",
"LinkedField" ;
awl:order 2 ;
awl:span [ awl:endCol 73 ;
awl:endLine 22 ;
awl:file "params.py" ;
awl:startCol 0 ;
awl:startLine 22 ] .
[] a awl:Module ;
awl:body ( <https://w3id.org/awl/py/tier3_oold.params/step#1> <https://w3id.org/awl/py/tier3_oold.params/step#2> <https://w3id.org/awl/py/tier3_oold.params/step#3> [ a awl:ClassDef ;
awl:bases [ awl:span [ awl:endCol 28 ;
awl:endLine 25 ;
awl:file "params.py" ;
awl:startCol 13 ;
awl:startLine 25 ] ;
awl:var "LinkedBaseModel" ] ;
awl:body ( [ a awl:AnnAssign ;
awl:annotation [ awl:span [ awl:endCol 11 ;
awl:endLine 26 ;
awl:file "params.py" ;
awl:startCol 8 ;
awl:startLine 26 ] ;
awl:var "str" ] ;
awl:order 0 ;
awl:simple 1 ;
awl:span [ awl:endCol 11 ;
awl:endLine 26 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 26 ] ;
awl:target [ awl:span [ awl:endCol 6 ;
awl:endLine 26 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 26 ] ;
awl:var "id" ] ] [ a awl:AnnAssign ;
awl:annotation [ a awl:BinOp ;
awl:left [ awl:span [ awl:endCol 13 ;
awl:endLine 27 ;
awl:file "params.py" ;
awl:startCol 10 ;
awl:startLine 27 ] ;
awl:var "str" ] ;
awl:op "BitOr" ;
awl:right [ awl:span [ awl:endCol 20 ;
awl:endLine 27 ;
awl:file "params.py" ;
awl:startCol 16 ;
awl:startLine 27 ] ] ;
awl:span [ awl:endCol 20 ;
awl:endLine 27 ;
awl:file "params.py" ;
awl:startCol 10 ;
awl:startLine 27 ] ] ;
awl:order 1 ;
awl:simple 1 ;
awl:span [ awl:endCol 34 ;
awl:endLine 27 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 27 ] ;
awl:target [ awl:span [ awl:endCol 8 ;
awl:endLine 27 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 27 ] ;
awl:var "type" ] ;
awl:value [ awl:literal "ex:Device" ;
awl:span [ awl:endCol 34 ;
awl:endLine 27 ;
awl:file "params.py" ;
awl:startCol 23 ;
awl:startLine 27 ] ] ] [ a awl:AnnAssign ;
awl:annotation [ a awl:BinOp ;
awl:left [ awl:span [ awl:endCol 15 ;
awl:endLine 28 ;
awl:file "params.py" ;
awl:startCol 12 ;
awl:startLine 28 ] ;
awl:var "str" ] ;
awl:op "BitOr" ;
awl:right [ awl:span [ awl:endCol 22 ;
awl:endLine 28 ;
awl:file "params.py" ;
awl:startCol 18 ;
awl:startLine 28 ] ] ;
awl:span [ awl:endCol 22 ;
awl:endLine 28 ;
awl:file "params.py" ;
awl:startCol 12 ;
awl:startLine 28 ] ] ;
awl:order 2 ;
awl:simple 1 ;
awl:span [ awl:endCol 29 ;
awl:endLine 28 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 28 ] ;
awl:target [ awl:span [ awl:endCol 10 ;
awl:endLine 28 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 28 ] ;
awl:var "serial" ] ;
awl:value [ awl:span [ awl:endCol 29 ;
awl:endLine 28 ;
awl:file "params.py" ;
awl:startCol 25 ;
awl:startLine 28 ] ] ] ) ;
awl:name "Device" ;
awl:order 3 ;
awl:span [ awl:endCol 29 ;
awl:endLine 28 ;
awl:file "params.py" ;
awl:startCol 0 ;
awl:startLine 25 ] ] [ a awl:ClassDef ;
awl:bases [ awl:span [ awl:endCol 33 ;
awl:endLine 31 ;
awl:file "params.py" ;
awl:startCol 18 ;
awl:startLine 31 ] ;
awl:var "LinkedBaseModel" ] ;
awl:body ( [ a awl:Assign ;
awl:comment [ awl:span [ awl:endCol 36 ;
awl:endLine 36 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 36 ] ;
awl:text "class says nothing about gets." ;
awl:where "above" ] ;
awl:order 0 ;
awl:span [ awl:endCol 5 ;
awl:endLine 46 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 37 ] ;
awl:targets [ awl:span [ awl:endCol 16 ;
awl:endLine 37 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 37 ] ;
awl:var "model_config" ] ;
awl:value [ a awl:Call ;
awl:func [ awl:span [ awl:endCol 29 ;
awl:endLine 37 ;
awl:file "params.py" ;
awl:startCol 19 ;
awl:startLine 37 ] ;
awl:var "ConfigDict" ] ;
awl:keywordArguments [ awl:json_schema_extra [ a awl:Dict ;
awl:keys [ awl:literal "@context" ;
awl:span [ awl:endCol 22 ;
awl:endLine 39 ;
awl:file "params.py" ;
awl:startCol 12 ;
awl:startLine 39 ] ] ;
awl:span [ awl:endCol 9 ;
awl:endLine 45 ;
awl:file "params.py" ;
awl:startCol 26 ;
awl:startLine 38 ] ;
awl:values [ a awl:Dict ;
awl:keys [ awl:literal "type" ;
awl:span [ awl:endCol 22 ;
awl:endLine 41 ;
awl:file "params.py" ;
awl:startCol 16 ;
awl:startLine 41 ] ],
[ awl:literal "ChargeParam" ;
awl:span [ awl:endCol 29 ;
awl:endLine 42 ;
awl:file "params.py" ;
awl:startCol 16 ;
awl:startLine 42 ] ],
[ awl:literal "target_voltage" ;
awl:span [ awl:endCol 32 ;
awl:endLine 43 ;
awl:file "params.py" ;
awl:startCol 16 ;
awl:startLine 43 ] ],
[ awl:literal "ex" ;
awl:span [ awl:endCol 20 ;
awl:endLine 40 ;
awl:file "params.py" ;
awl:startCol 16 ;
awl:startLine 40 ] ] ;
awl:span [ awl:endCol 13 ;
awl:endLine 44 ;
awl:file "params.py" ;
awl:startCol 24 ;
awl:startLine 39 ] ;
awl:values [ awl:literal "https://example.org/battery#" ;
awl:span [ awl:endCol 52 ;
awl:endLine 40 ;
awl:file "params.py" ;
awl:startCol 22 ;
awl:startLine 40 ] ],
[ a awl:Dict ;
awl:keys [ awl:literal "@container" ;
awl:span [ awl:endCol 53 ;
awl:endLine 41 ;
awl:file "params.py" ;
awl:startCol 41 ;
awl:startLine 41 ] ],
[ awl:literal "@id" ;
awl:span [ awl:endCol 30 ;
awl:endLine 41 ;
awl:file "params.py" ;
awl:startCol 25 ;
awl:startLine 41 ] ] ;
awl:span [ awl:endCol 62 ;
awl:endLine 41 ;
awl:file "params.py" ;
awl:startCol 24 ;
awl:startLine 41 ] ;
awl:values [ awl:literal "@set" ;
awl:span [ awl:endCol 61 ;
awl:endLine 41 ;
awl:file "params.py" ;
awl:startCol 55 ;
awl:startLine 41 ] ],
[ awl:literal "@type" ;
awl:span [ awl:endCol 39 ;
awl:endLine 41 ;
awl:file "params.py" ;
awl:startCol 32 ;
awl:startLine 41 ] ] ],
[ awl:literal "ex:ChargeParam" ;
awl:span [ awl:endCol 47 ;
awl:endLine 42 ;
awl:file "params.py" ;
awl:startCol 31 ;
awl:startLine 42 ] ],
[ a awl:Dict ;
awl:keys [ awl:literal "@id" ;
awl:span [ awl:endCol 40 ;
awl:endLine 43 ;
awl:file "params.py" ;
awl:startCol 35 ;
awl:startLine 43 ] ],
[ awl:literal "@type" ;
awl:span [ awl:endCol 69 ;
awl:endLine 43 ;
awl:file "params.py" ;
awl:startCol 62 ;
awl:startLine 43 ] ] ;
awl:span [ awl:endCol 84 ;
awl:endLine 43 ;
awl:file "params.py" ;
awl:startCol 34 ;
awl:startLine 43 ] ;
awl:values [ awl:literal "ex:targetVoltage" ;
awl:span [ awl:endCol 60 ;
awl:endLine 43 ;
awl:file "params.py" ;
awl:startCol 42 ;
awl:startLine 43 ] ],
[ awl:literal "xsd:double" ;
awl:span [ awl:endCol 83 ;
awl:endLine 43 ;
awl:file "params.py" ;
awl:startCol 71 ;
awl:startLine 43 ] ] ] ] ] ] ;
awl:span [ awl:endCol 5 ;
awl:endLine 46 ;
awl:file "params.py" ;
awl:startCol 19 ;
awl:startLine 37 ] ] ] [ a awl:AnnAssign ;
awl:annotation [ a awl:BinOp ;
awl:left [ awl:span [ awl:endCol 11 ;
awl:endLine 48 ;
awl:file "params.py" ;
awl:startCol 8 ;
awl:startLine 48 ] ;
awl:var "str" ] ;
awl:op "BitOr" ;
awl:right [ awl:span [ awl:endCol 18 ;
awl:endLine 48 ;
awl:file "params.py" ;
awl:startCol 14 ;
awl:startLine 48 ] ] ;
awl:span [ awl:endCol 18 ;
awl:endLine 48 ;
awl:file "params.py" ;
awl:startCol 8 ;
awl:startLine 48 ] ] ;
awl:order 1 ;
awl:simple 1 ;
awl:span [ awl:endCol 25 ;
awl:endLine 48 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 48 ] ;
awl:target [ awl:span [ awl:endCol 6 ;
awl:endLine 48 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 48 ] ;
awl:var "id" ] ;
awl:value [ awl:span [ awl:endCol 25 ;
awl:endLine 48 ;
awl:file "params.py" ;
awl:startCol 21 ;
awl:startLine 48 ] ] ] [ a awl:AnnAssign ;
awl:annotation [ a awl:BinOp ;
awl:left [ a awl:Subscript ;
awl:slice [ awl:span [ awl:endCol 18 ;
awl:endLine 49 ;
awl:file "params.py" ;
awl:startCol 15 ;
awl:startLine 49 ] ;
awl:var "str" ] ;
awl:span [ awl:endCol 19 ;
awl:endLine 49 ;
awl:file "params.py" ;
awl:startCol 10 ;
awl:startLine 49 ] ;
awl:value [ awl:span [ awl:endCol 14 ;
awl:endLine 49 ;
awl:file "params.py" ;
awl:startCol 10 ;
awl:startLine 49 ] ;
awl:var "list" ] ] ;
awl:op "BitOr" ;
awl:right [ awl:span [ awl:endCol 26 ;
awl:endLine 49 ;
awl:file "params.py" ;
awl:startCol 22 ;
awl:startLine 49 ] ] ;
awl:span [ awl:endCol 26 ;
awl:endLine 49 ;
awl:file "params.py" ;
awl:startCol 10 ;
awl:startLine 49 ] ] ;
awl:order 2 ;
awl:simple 1 ;
awl:span [ awl:endCol 44 ;
awl:endLine 49 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 49 ] ;
awl:target [ awl:span [ awl:endCol 8 ;
awl:endLine 49 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 49 ] ;
awl:var "type" ] ;
awl:value [ a awl:List ;
awl:elts [ awl:literal "ChargeParam" ;
awl:span [ awl:endCol 43 ;
awl:endLine 49 ;
awl:file "params.py" ;
awl:startCol 30 ;
awl:startLine 49 ] ] ;
awl:span [ awl:endCol 44 ;
awl:endLine 49 ;
awl:file "params.py" ;
awl:startCol 29 ;
awl:startLine 49 ] ] ] [ a awl:AnnAssign ;
awl:annotation [ awl:span [ awl:endCol 25 ;
awl:endLine 51 ;
awl:file "params.py" ;
awl:startCol 20 ;
awl:startLine 51 ] ;
awl:var "float" ] ;
awl:order 3 ;
awl:simple 1 ;
awl:span [ awl:endCol 25 ;
awl:endLine 51 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 51 ] ;
awl:target [ awl:span [ awl:endCol 18 ;
awl:endLine 51 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 51 ] ;
awl:var "target_voltage" ] ] [ a awl:AnnAssign ;
awl:annotation [ awl:span [ awl:endCol 17 ;
awl:endLine 52 ;
awl:file "params.py" ;
awl:startCol 12 ;
awl:startLine 52 ] ;
awl:var "float" ] ;
awl:order 4 ;
awl:simple 1 ;
awl:span [ awl:endCol 17 ;
awl:endLine 52 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 52 ] ;
awl:target [ awl:span [ awl:endCol 10 ;
awl:endLine 52 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 52 ] ;
awl:var "c_rate" ] ] [ a awl:AnnAssign ;
awl:annotation [ a awl:BinOp ;
awl:left [ a awl:Subscript ;
awl:slice [ awl:span [ awl:endCol 23 ;
awl:endLine 55 ;
awl:file "params.py" ;
awl:startCol 17 ;
awl:startLine 55 ] ;
awl:var "Device" ] ;
awl:span [ awl:endCol 24 ;
awl:endLine 55 ;
awl:file "params.py" ;
awl:startCol 12 ;
awl:startLine 55 ] ;
awl:value [ awl:span [ awl:endCol 16 ;
awl:endLine 55 ;
awl:file "params.py" ;
awl:startCol 12 ;
awl:startLine 55 ] ;
awl:var "Link" ] ] ;
awl:op "BitOr" ;
awl:right [ awl:span [ awl:endCol 31 ;
awl:endLine 55 ;
awl:file "params.py" ;
awl:startCol 27 ;
awl:startLine 55 ] ] ;
awl:span [ awl:endCol 31 ;
awl:endLine 55 ;
awl:file "params.py" ;
awl:startCol 12 ;
awl:startLine 55 ] ] ;
awl:comment [ awl:span [ awl:endCol 36 ;
awl:endLine 54 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 54 ] ;
awl:text "Link[T] inside the annotation." ;
awl:where "above" ] ;
awl:order 5 ;
awl:simple 1 ;
awl:span [ awl:endCol 38 ;
awl:endLine 55 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 55 ] ;
awl:target [ awl:span [ awl:endCol 10 ;
awl:endLine 55 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 55 ] ;
awl:var "device" ] ;
awl:value [ awl:span [ awl:endCol 38 ;
awl:endLine 55 ;
awl:file "params.py" ;
awl:startCol 34 ;
awl:startLine 55 ] ] ] [ a awl:AnnAssign ;
awl:annotation [ a awl:BinOp ;
awl:left [ awl:span [ awl:endCol 30 ;
awl:endLine 58 ;
awl:file "params.py" ;
awl:startCol 24 ;
awl:startLine 58 ] ;
awl:var "Device" ] ;
awl:op "BitOr" ;
awl:right [ awl:span [ awl:endCol 37 ;
awl:endLine 58 ;
awl:file "params.py" ;
awl:startCol 33 ;
awl:startLine 58 ] ] ;
awl:span [ awl:endCol 37 ;
awl:endLine 58 ;
awl:file "params.py" ;
awl:startCol 24 ;
awl:startLine 58 ] ] ;
awl:comment [ awl:span [ awl:endCol 73 ;
awl:endLine 57 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 57 ] ;
awl:text "The alternative form: plain annotation, link declared on the field." ;
awl:where "above" ] ;
awl:order 6 ;
awl:simple 1 ;
awl:span [ awl:endCol 62 ;
awl:endLine 58 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 58 ] ;
awl:target [ awl:span [ awl:endCol 22 ;
awl:endLine 58 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 58 ] ;
awl:var "calibrated_against" ] ;
awl:value [ a awl:Call ;
awl:func [ awl:span [ awl:endCol 51 ;
awl:endLine 58 ;
awl:file "params.py" ;
awl:startCol 40 ;
awl:startLine 58 ] ;
awl:var "LinkedField" ] ;
awl:keywordArguments [ awl:link [ awl:literal true ;
awl:span [ awl:endCol 61 ;
awl:endLine 58 ;
awl:file "params.py" ;
awl:startCol 57 ;
awl:startLine 58 ] ] ] ;
awl:span [ awl:endCol 62 ;
awl:endLine 58 ;
awl:file "params.py" ;
awl:startCol 40 ;
awl:startLine 58 ] ] ] [ a awl:AnnAssign ;
awl:annotation [ a awl:BinOp ;
awl:left [ a awl:BinOp ;
awl:left [ awl:span [ awl:endCol 17 ;
awl:endLine 61 ;
awl:file "params.py" ;
awl:startCol 14 ;
awl:startLine 61 ] ;
awl:var "str" ] ;
awl:op "BitOr" ;
awl:right [ awl:span [ awl:endCol 26 ;
awl:endLine 61 ;
awl:file "params.py" ;
awl:startCol 20 ;
awl:startLine 61 ] ;
awl:var "Device" ] ;
awl:span [ awl:endCol 26 ;
awl:endLine 61 ;
awl:file "params.py" ;
awl:startCol 14 ;
awl:startLine 61 ] ] ;
awl:op "BitOr" ;
awl:right [ awl:span [ awl:endCol 33 ;
awl:endLine 61 ;
awl:file "params.py" ;
awl:startCol 29 ;
awl:startLine 61 ] ] ;
awl:span [ awl:endCol 33 ;
awl:endLine 61 ;
awl:file "params.py" ;
awl:startCol 14 ;
awl:startLine 61 ] ] ;
awl:comment [ awl:span [ awl:endCol 66 ;
awl:endLine 60 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 60 ] ;
awl:text "Union arm: literal text, inline object, or reference by IRI." ;
awl:where "above" ] ;
awl:order 7 ;
awl:simple 1 ;
awl:span [ awl:endCol 58 ;
awl:endLine 61 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 61 ] ;
awl:target [ awl:span [ awl:endCol 12 ;
awl:endLine 61 ;
awl:file "params.py" ;
awl:startCol 4 ;
awl:startLine 61 ] ;
awl:var "operator" ] ;
awl:value [ a awl:Call ;
awl:func [ awl:span [ awl:endCol 47 ;
awl:endLine 61 ;
awl:file "params.py" ;
awl:startCol 36 ;
awl:startLine 61 ] ;
awl:var "LinkedField" ] ;
awl:keywordArguments [ awl:link [ awl:literal true ;
awl:span [ awl:endCol 57 ;
awl:endLine 61 ;
awl:file "params.py" ;
awl:startCol 53 ;
awl:startLine 61 ] ] ] ;
awl:span [ awl:endCol 58 ;
awl:endLine 61 ;
awl:file "params.py" ;
awl:startCol 36 ;
awl:startLine 61 ] ] ] ) ;
awl:name "ChargeParam" ;
awl:order 4 ;
awl:span [ awl:endCol 58 ;
awl:endLine 61 ;
awl:file "params.py" ;
awl:startCol 0 ;
awl:startLine 31 ] ] ) .
tier3_oold/procedure.py¶
"""Tier 3: OO-LD annotated Python.
Same computation as tiers 1 and 2. The call site is unchanged from tier 2,
and no IRI appears here: the semantics come from the resolved type, so the
collapse has everything it needs without the author writing linked data.
"""
from battery.device import charge, rest
from .params import ChargeParam
def procedure(cycles: int) -> None:
i = 0
while i < cycles:
charge(ChargeParam(target_voltage=4.2, c_rate=0.23))
rest(600)
i += 1
{
"@type": "Module",
"body": [
{
"literal": "Tier 3: OO-LD annotated Python.\n\nSame computation as tiers 1 and 2. The call site is unchanged from tier 2,\nand no IRI appears here: the semantics come from the resolved type, so the\ncollapse has everything it needs without the author writing linked data.\n"
},
{"@type": "ImportFrom", "module": "battery.device", "names": ["charge", "rest"], "level": 0},
{"@type": "ImportFrom", "module": "params", "names": ["ChargeParam"], "level": 1},
{
"@type": "FunctionDef",
"name": "procedure",
"args": [{"arg": "cycles", "annotation": {"var": "int"}}],
"body": [
{"@type": "Assign", "targets": [{"var": "i"}], "value": {"literal": 0}},
{
"@type": "While",
"test": {"@type": "Compare", "left": {"var": "i"}, "ops": ["Lt"], "comparators": [{"var": "cycles"}]},
"body": [
{
"@type": "Call",
"func": {"var": "charge"},
"args": [{"@type": ["ChargeParam", "ex:ChargeParam"], "target_voltage": 4.2, "c_rate": 0.23}]
},
{"@type": "Call", "func": {"var": "rest"}, "args": [{"literal": 600}]},
{"@type": "AugAssign", "target": {"var": "i"}, "op": "Add", "value": {"literal": 1}}
]
}
],
"returns": {"literal": null}
}
]
}
{
"@type": "Module",
"body": [
{
"literal": "Tier 3: OO-LD annotated Python.\n\nSame computation as tiers 1 and 2. The call site is unchanged from tier 2,\nand no IRI appears here: the semantics come from the resolved type, so the\ncollapse has everything it needs without the author writing linked data.\n"
},
{"@type": "ImportFrom", "module": "battery.device", "names": ["charge", "rest"], "level": 0},
{"@type": "ImportFrom", "module": "params", "names": ["ChargeParam"], "level": 1},
{
"@type": "FunctionDef",
"name": "procedure",
"args": [{"arg": "cycles", "annotation": {"var": "int"}}],
"body": [
{"@type": "Assign", "targets": [{"var": "i"}], "value": {"literal": 0}},
{
"@type": "While",
"test": {"@type": "Compare", "left": {"var": "i"}, "ops": ["Lt"], "comparators": [{"var": "cycles"}]},
"body": [
{
"@type": "Call",
"func": {"var": "charge"},
"args": [
{
"@type": "Call",
"func": {"var": "ChargeParam"},
"keyword_arguments": {"target_voltage": {"literal": 4.2}, "c_rate": {"literal": 0.23}}
}
]
},
{"@type": "Call", "func": {"var": "rest"}, "args": [{"literal": 600}]},
{"@type": "AugAssign", "target": {"var": "i"}, "op": "Add", "value": {"literal": 1}}
]
}
],
"returns": {"literal": null}
}
]
}
@prefix awl: <https://w3id.org/awl/schema/> .
@prefix ex: <https://example.org/battery#> .
@prefix ns1: <https://w3id.org/awl/py/tier3_oold.params/ChargeParam#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<https://w3id.org/awl/py/tier3_oold.procedure/procedure.step#4> a awl:Assign ;
awl:order 0 ;
awl:span [ awl:endCol 9 ;
awl:endLine 14 ;
awl:file "procedure.py" ;
awl:startCol 4 ;
awl:startLine 14 ] ;
awl:targets [ awl:span [ awl:endCol 5 ;
awl:endLine 14 ;
awl:file "procedure.py" ;
awl:startCol 4 ;
awl:startLine 14 ] ;
awl:var "i" ] ;
awl:value [ awl:literal 0 ;
awl:span [ awl:endCol 9 ;
awl:endLine 14 ;
awl:file "procedure.py" ;
awl:startCol 8 ;
awl:startLine 14 ] ] .
<https://w3id.org/awl/py/tier3_oold.procedure/procedure.step#5> a awl:While ;
awl:body ( <https://w3id.org/awl/py/tier3_oold.procedure/procedure.step#6> <https://w3id.org/awl/py/tier3_oold.procedure/procedure.step#7> <https://w3id.org/awl/py/tier3_oold.procedure/procedure.step#8> ) ;
awl:order 1 ;
awl:span [ awl:endCol 14 ;
awl:endLine 18 ;
awl:file "procedure.py" ;
awl:startCol 4 ;
awl:startLine 15 ] ;
awl:test [ a awl:Compare ;
awl:comparators [ awl:span [ awl:endCol 20 ;
awl:endLine 15 ;
awl:file "procedure.py" ;
awl:startCol 14 ;
awl:startLine 15 ] ;
awl:var "cycles" ] ;
awl:left [ awl:span [ awl:endCol 11 ;
awl:endLine 15 ;
awl:file "procedure.py" ;
awl:startCol 10 ;
awl:startLine 15 ] ;
awl:var "i" ] ;
awl:ops "Lt" ;
awl:span [ awl:endCol 20 ;
awl:endLine 15 ;
awl:file "procedure.py" ;
awl:startCol 10 ;
awl:startLine 15 ] ] .
<https://w3id.org/awl/py/tier3_oold.procedure/procedure.step#6> a awl:Call ;
awl:argument ( [ a ex:ChargeParam,
<https://w3id.org/awl/py/tier3_oold.params/ChargeParam> ;
ex:targetVoltage 4.2e+00 ;
ns1:c_rate 2.3e-01 ;
awl:span [ awl:endCol 59 ;
awl:endLine 16 ;
awl:file "procedure.py" ;
awl:startCol 15 ;
awl:startLine 16 ] ] ) ;
awl:func [ awl:span [ awl:endCol 14 ;
awl:endLine 16 ;
awl:file "procedure.py" ;
awl:startCol 8 ;
awl:startLine 16 ] ;
awl:var "charge" ] ;
awl:order 0 ;
awl:span [ awl:endCol 60 ;
awl:endLine 16 ;
awl:file "procedure.py" ;
awl:startCol 8 ;
awl:startLine 16 ] .
<https://w3id.org/awl/py/tier3_oold.procedure/procedure.step#7> a awl:Call ;
awl:argument ( [ awl:literal 600 ;
awl:span [ awl:endCol 16 ;
awl:endLine 17 ;
awl:file "procedure.py" ;
awl:startCol 13 ;
awl:startLine 17 ] ] ) ;
awl:func [ awl:span [ awl:endCol 12 ;
awl:endLine 17 ;
awl:file "procedure.py" ;
awl:startCol 8 ;
awl:startLine 17 ] ;
awl:var "rest" ] ;
awl:order 1 ;
awl:span [ awl:endCol 17 ;
awl:endLine 17 ;
awl:file "procedure.py" ;
awl:startCol 8 ;
awl:startLine 17 ] .
<https://w3id.org/awl/py/tier3_oold.procedure/procedure.step#8> a awl:AugAssign ;
awl:op "Add" ;
awl:order 2 ;
awl:span [ awl:endCol 14 ;
awl:endLine 18 ;
awl:file "procedure.py" ;
awl:startCol 8 ;
awl:startLine 18 ] ;
awl:target [ awl:span [ awl:endCol 9 ;
awl:endLine 18 ;
awl:file "procedure.py" ;
awl:startCol 8 ;
awl:startLine 18 ] ;
awl:var "i" ] ;
awl:value [ awl:literal 1 ;
awl:span [ awl:endCol 14 ;
awl:endLine 18 ;
awl:file "procedure.py" ;
awl:startCol 13 ;
awl:startLine 18 ] ] .
<https://w3id.org/awl/py/tier3_oold.procedure/step#1> awl:literal """Tier 3: OO-LD annotated Python.
Same computation as tiers 1 and 2. The call site is unchanged from tier 2,
and no IRI appears here: the semantics come from the resolved type, so the
collapse has everything it needs without the author writing linked data.
""" ;
awl:order 0 ;
awl:span [ awl:endCol 3 ;
awl:endLine 6 ;
awl:file "procedure.py" ;
awl:startCol 0 ;
awl:startLine 1 ] .
<https://w3id.org/awl/py/tier3_oold.procedure/step#2> a awl:ImportFrom ;
awl:level 0 ;
awl:module "battery.device" ;
awl:names "charge",
"rest" ;
awl:order 1 ;
awl:span [ awl:endCol 39 ;
awl:endLine 8 ;
awl:file "procedure.py" ;
awl:startCol 0 ;
awl:startLine 8 ] .
<https://w3id.org/awl/py/tier3_oold.procedure/step#3> a awl:ImportFrom ;
awl:level 1 ;
awl:module "params" ;
awl:names "ChargeParam" ;
awl:order 2 ;
awl:span [ awl:endCol 31 ;
awl:endLine 10 ;
awl:file "procedure.py" ;
awl:startCol 0 ;
awl:startLine 10 ] .
[] a awl:Module ;
awl:body ( <https://w3id.org/awl/py/tier3_oold.procedure/step#1> <https://w3id.org/awl/py/tier3_oold.procedure/step#2> <https://w3id.org/awl/py/tier3_oold.procedure/step#3> [ a awl:FunctionDef ;
awl:args [ awl:annotation [ awl:span [ awl:endCol 25 ;
awl:endLine 13 ;
awl:file "procedure.py" ;
awl:startCol 22 ;
awl:startLine 13 ] ;
awl:var "int" ] ;
awl:arg "cycles" ] ;
awl:body ( <https://w3id.org/awl/py/tier3_oold.procedure/procedure.step#4> <https://w3id.org/awl/py/tier3_oold.procedure/procedure.step#5> ) ;
awl:name "procedure" ;
awl:order 3 ;
awl:returns [ awl:span [ awl:endCol 34 ;
awl:endLine 13 ;
awl:file "procedure.py" ;
awl:startCol 30 ;
awl:startLine 13 ] ] ;
awl:span [ awl:endCol 14 ;
awl:endLine 18 ;
awl:file "procedure.py" ;
awl:startCol 0 ;
awl:startLine 13 ] ] ) .
edge/function_call.py¶
{
"@type": "Module",
"body": [
{
"literal": "Keyword and positional calls, and a call result bound to a name.\n\nFrom the awl-schema README. The regression it guards: a keyword argument\nand a positional argument must remain distinguishable, and the same name\nmust resolve to one identity whether it is written or read.\n"
},
{
"@type": "Assign",
"targets": [{"var": "x"}],
"value": {"@type": "Call", "func": {"var": "run"}, "keyword_arguments": {"a": {"literal": 1}}}
},
{"@type": "Call", "func": {"var": "run"}, "args": [{"var": "x"}]}
]
}
{
"@type": "Module",
"body": [
{
"literal": "Keyword and positional calls, and a call result bound to a name.\n\nFrom the awl-schema README. The regression it guards: a keyword argument\nand a positional argument must remain distinguishable, and the same name\nmust resolve to one identity whether it is written or read.\n"
},
{
"@type": "Assign",
"targets": [{"var": "x"}],
"value": {"@type": "Call", "func": {"var": "run"}, "keyword_arguments": {"a": {"literal": 1}}}
},
{"@type": "Call", "func": {"var": "run"}, "args": [{"var": "x"}]}
]
}
@prefix awl: <https://w3id.org/awl/schema/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<https://w3id.org/awl/py/edge.function_call/step#1> awl:literal """Keyword and positional calls, and a call result bound to a name.
From the awl-schema README. The regression it guards: a keyword argument
and a positional argument must remain distinguishable, and the same name
must resolve to one identity whether it is written or read.
""" ;
awl:order 0 ;
awl:span [ awl:endCol 3 ;
awl:endLine 6 ;
awl:file "function_call.py" ;
awl:startCol 0 ;
awl:startLine 1 ] .
<https://w3id.org/awl/py/edge.function_call/step#2> a awl:Assign ;
awl:order 1 ;
awl:span [ awl:endCol 12 ;
awl:endLine 8 ;
awl:file "function_call.py" ;
awl:startCol 0 ;
awl:startLine 8 ] ;
awl:targets [ awl:span [ awl:endCol 1 ;
awl:endLine 8 ;
awl:file "function_call.py" ;
awl:startCol 0 ;
awl:startLine 8 ] ;
awl:var "x" ] ;
awl:value [ a awl:Call ;
awl:func [ awl:span [ awl:endCol 7 ;
awl:endLine 8 ;
awl:file "function_call.py" ;
awl:startCol 4 ;
awl:startLine 8 ] ;
awl:var "run" ] ;
awl:keywordArguments [ awl:a [ awl:literal 1 ;
awl:span [ awl:endCol 11 ;
awl:endLine 8 ;
awl:file "function_call.py" ;
awl:startCol 10 ;
awl:startLine 8 ] ] ] ;
awl:span [ awl:endCol 12 ;
awl:endLine 8 ;
awl:file "function_call.py" ;
awl:startCol 4 ;
awl:startLine 8 ] ] .
<https://w3id.org/awl/py/edge.function_call/step#3> a awl:Call ;
awl:argument ( [ awl:span [ awl:endCol 5 ;
awl:endLine 9 ;
awl:file "function_call.py" ;
awl:startCol 4 ;
awl:startLine 9 ] ;
awl:var "x" ] ) ;
awl:func [ awl:span [ awl:endCol 3 ;
awl:endLine 9 ;
awl:file "function_call.py" ;
awl:startCol 0 ;
awl:startLine 9 ] ;
awl:var "run" ] ;
awl:order 2 ;
awl:span [ awl:endCol 6 ;
awl:endLine 9 ;
awl:file "function_call.py" ;
awl:startCol 0 ;
awl:startLine 9 ] .
[] a awl:Module ;
awl:body ( <https://w3id.org/awl/py/edge.function_call/step#1> <https://w3id.org/awl/py/edge.function_call/step#2> <https://w3id.org/awl/py/edge.function_call/step#3> ) .
edge/if_else.py¶
{
"@type": "Module",
"body": [
{
"literal": "Branch with two assignments to the same name.\n\nFrom the awl-schema README. The regression it guards: both possible values\nof `b` must be reachable, and the branch taken must be distinguishable from\nthe branch not taken.\n"
},
{
"@type": "If",
"test": {"@type": "Compare", "left": {"var": "a"}, "ops": ["Eq"], "comparators": [{"literal": 1}]},
"body": [{"@type": "Assign", "targets": [{"var": "b"}], "value": {"literal": 1}}],
"orelse": [{"@type": "Assign", "targets": [{"var": "b"}], "value": {"literal": "test"}}]
}
]
}
{
"@type": "Module",
"body": [
{
"literal": "Branch with two assignments to the same name.\n\nFrom the awl-schema README. The regression it guards: both possible values\nof `b` must be reachable, and the branch taken must be distinguishable from\nthe branch not taken.\n"
},
{
"@type": "If",
"test": {"@type": "Compare", "left": {"var": "a"}, "ops": ["Eq"], "comparators": [{"literal": 1}]},
"body": [{"@type": "Assign", "targets": [{"var": "b"}], "value": {"literal": 1}}],
"orelse": [{"@type": "Assign", "targets": [{"var": "b"}], "value": {"literal": "test"}}]
}
]
}
@prefix awl: <https://w3id.org/awl/schema/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<https://w3id.org/awl/py/edge.if_else/step#1> awl:literal """Branch with two assignments to the same name.
From the awl-schema README. The regression it guards: both possible values
of `b` must be reachable, and the branch taken must be distinguishable from
the branch not taken.
""" ;
awl:order 0 ;
awl:span [ awl:endCol 3 ;
awl:endLine 6 ;
awl:file "if_else.py" ;
awl:startCol 0 ;
awl:startLine 1 ] .
<https://w3id.org/awl/py/edge.if_else/step#2> a awl:If ;
awl:body ( <https://w3id.org/awl/py/edge.if_else/step#3> ) ;
awl:order 1 ;
awl:orelse ( <https://w3id.org/awl/py/edge.if_else/step#4> ) ;
awl:span [ awl:endCol 14 ;
awl:endLine 11 ;
awl:file "if_else.py" ;
awl:startCol 0 ;
awl:startLine 8 ] ;
awl:test [ a awl:Compare ;
awl:comparators [ awl:literal 1 ;
awl:span [ awl:endCol 9 ;
awl:endLine 8 ;
awl:file "if_else.py" ;
awl:startCol 8 ;
awl:startLine 8 ] ] ;
awl:left [ awl:span [ awl:endCol 4 ;
awl:endLine 8 ;
awl:file "if_else.py" ;
awl:startCol 3 ;
awl:startLine 8 ] ;
awl:var "a" ] ;
awl:ops "Eq" ;
awl:span [ awl:endCol 9 ;
awl:endLine 8 ;
awl:file "if_else.py" ;
awl:startCol 3 ;
awl:startLine 8 ] ] .
<https://w3id.org/awl/py/edge.if_else/step#3> a awl:Assign ;
awl:order 0 ;
awl:span [ awl:endCol 9 ;
awl:endLine 9 ;
awl:file "if_else.py" ;
awl:startCol 4 ;
awl:startLine 9 ] ;
awl:targets [ awl:span [ awl:endCol 5 ;
awl:endLine 9 ;
awl:file "if_else.py" ;
awl:startCol 4 ;
awl:startLine 9 ] ;
awl:var "b" ] ;
awl:value [ awl:literal 1 ;
awl:span [ awl:endCol 9 ;
awl:endLine 9 ;
awl:file "if_else.py" ;
awl:startCol 8 ;
awl:startLine 9 ] ] .
<https://w3id.org/awl/py/edge.if_else/step#4> a awl:Assign ;
awl:order 0 ;
awl:span [ awl:endCol 14 ;
awl:endLine 11 ;
awl:file "if_else.py" ;
awl:startCol 4 ;
awl:startLine 11 ] ;
awl:targets [ awl:span [ awl:endCol 5 ;
awl:endLine 11 ;
awl:file "if_else.py" ;
awl:startCol 4 ;
awl:startLine 11 ] ;
awl:var "b" ] ;
awl:value [ awl:literal "test" ;
awl:span [ awl:endCol 14 ;
awl:endLine 11 ;
awl:file "if_else.py" ;
awl:startCol 8 ;
awl:startLine 11 ] ] .
[] a awl:Module ;
awl:body ( <https://w3id.org/awl/py/edge.if_else/step#1> <https://w3id.org/awl/py/edge.if_else/step#2> ) .
real/optimize_global.py¶
import numpy as np
import matplotlib.pyplot as plt
from scipy import optimize
def eggholder(x):
return (-(x[1] + 47) * np.sin(np.sqrt(abs(x[0]/2 + (x[1] + 47))))
-x[0] * np.sin(np.sqrt(abs(x[0] - (x[1] + 47)))))
bounds = [(-512, 512), (-512, 512)]
x = np.arange(-512, 513)
y = np.arange(-512, 513)
xgrid, ygrid = np.meshgrid(x, y)
xy = np.stack([xgrid, ygrid])
results = dict()
results['shgo'] = optimize.shgo(eggholder, bounds)
results['DA'] = optimize.dual_annealing(eggholder, bounds)
results['DE'] = optimize.differential_evolution(eggholder, bounds)
results['shgo_sobol'] = optimize.shgo(eggholder, bounds, n=256, iters=5,
sampling_method='sobol')
fig = plt.figure(figsize=(4.5, 4.5))
ax = fig.add_subplot(111)
im = ax.imshow(eggholder(xy), interpolation='bilinear', origin='lower',
cmap='gray')
ax.set_xlabel('x')
ax.set_ylabel('y')
def plot_point(res, marker='o', color=None):
ax.plot(512+res.x[0], 512+res.x[1], marker=marker, color=color, ms=10)
plot_point(results['DE'], color='c') # differential_evolution - cyan
plot_point(results['DA'], color='w') # dual_annealing. - white
# SHGO produces multiple minima, plot them all (with a smaller marker size)
plot_point(results['shgo'], color='r', marker='+')
plot_point(results['shgo_sobol'], color='r', marker='x')
for i in range(results['shgo_sobol'].xl.shape[0]):
ax.plot(512 + results['shgo_sobol'].xl[i, 0],
512 + results['shgo_sobol'].xl[i, 1],
'ro', ms=2)
ax.set_xlim([-4, 514*2])
ax.set_ylim([-4, 514*2])
fig.tight_layout()
plt.show()
{
"@type": "Module",
"body": [
{"@type": "Import", "names": [{"name": "numpy", "asname": "np"}]},
{"@type": "Import", "names": [{"name": "matplotlib.pyplot", "asname": "plt"}]},
{"@type": "ImportFrom", "module": "scipy", "names": ["optimize"], "level": 0},
{
"@type": "FunctionDef",
"name": "eggholder",
"args": ["x"],
"body": [
{
"@type": "Return",
"value": {
"@type": "BinOp",
"left": {
"@type": "BinOp",
"left": {
"@type": "UnaryOp",
"op": "USub",
"operand": {
"@type": "BinOp",
"left": {"@type": "Subscript", "value": {"var": "x"}, "slice": {"literal": 1}},
"op": "Add",
"right": {"literal": 47}
}
},
"op": "Mult",
"right": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "np"}, "attr": "sin"},
"args": [
{
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "np"}, "attr": "sqrt"},
"args": [
{
"@type": "Call",
"func": {"var": "abs"},
"args": [
{
"@type": "BinOp",
"left": {
"@type": "BinOp",
"left": {"@type": "Subscript", "value": {"var": "x"}, "slice": {"literal": 0}},
"op": "Div",
"right": {"literal": 2}
},
"op": "Add",
"right": {
"@type": "BinOp",
"left": {"@type": "Subscript", "value": {"var": "x"}, "slice": {"literal": 1}},
"op": "Add",
"right": {"literal": 47}
}
}
]
}
]
}
]
}
},
"op": "Sub",
"right": {
"@type": "BinOp",
"left": {"@type": "Subscript", "value": {"var": "x"}, "slice": {"literal": 0}},
"op": "Mult",
"right": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "np"}, "attr": "sin"},
"args": [
{
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "np"}, "attr": "sqrt"},
"args": [
{
"@type": "Call",
"func": {"var": "abs"},
"args": [
{
"@type": "BinOp",
"left": {"@type": "Subscript", "value": {"var": "x"}, "slice": {"literal": 0}},
"op": "Sub",
"right": {
"@type": "BinOp",
"left": {"@type": "Subscript", "value": {"var": "x"}, "slice": {"literal": 1}},
"op": "Add",
"right": {"literal": 47}
}
}
]
}
]
}
]
}
}
}
}
]
},
{
"@type": "Assign",
"targets": [{"var": "bounds"}],
"value": {
"@type": "List",
"elts": [
{"@type": "Tuple", "elts": [{"@type": "UnaryOp", "op": "USub", "operand": {"literal": 512}}, {"literal": 512}]},
{"@type": "Tuple", "elts": [{"@type": "UnaryOp", "op": "USub", "operand": {"literal": 512}}, {"literal": 512}]}
]
}
},
{
"@type": "Assign",
"targets": [{"var": "x"}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "np"}, "attr": "arange"},
"args": [{"@type": "UnaryOp", "op": "USub", "operand": {"literal": 512}}, {"literal": 513}]
}
},
{
"@type": "Assign",
"targets": [{"var": "y"}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "np"}, "attr": "arange"},
"args": [{"@type": "UnaryOp", "op": "USub", "operand": {"literal": 512}}, {"literal": 513}]
}
},
{
"@type": "Assign",
"targets": [{"@type": "Tuple", "elts": [{"var": "xgrid"}, {"var": "ygrid"}]}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "np"}, "attr": "meshgrid"},
"args": [{"var": "x"}, {"var": "y"}]
}
},
{
"@type": "Assign",
"targets": [{"var": "xy"}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "np"}, "attr": "stack"},
"args": [{"@type": "List", "elts": [{"var": "xgrid"}, {"var": "ygrid"}]}]
}
},
{"@type": "Assign", "targets": [{"var": "results"}], "value": {"@type": "Call", "func": {"var": "dict"}}},
{
"@type": "Assign",
"targets": [{"@type": "Subscript", "value": {"var": "results"}, "slice": {"literal": "shgo"}}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "optimize"}, "attr": "shgo"},
"args": [{"var": "eggholder"}, {"var": "bounds"}]
}
},
{
"@type": "Assign",
"targets": [{"@type": "Subscript", "value": {"var": "results"}, "slice": {"literal": "DA"}}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "optimize"}, "attr": "dual_annealing"},
"args": [{"var": "eggholder"}, {"var": "bounds"}]
}
},
{
"@type": "Assign",
"targets": [{"@type": "Subscript", "value": {"var": "results"}, "slice": {"literal": "DE"}}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "optimize"}, "attr": "differential_evolution"},
"args": [{"var": "eggholder"}, {"var": "bounds"}]
}
},
{
"@type": "Assign",
"targets": [{"@type": "Subscript", "value": {"var": "results"}, "slice": {"literal": "shgo_sobol"}}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "optimize"}, "attr": "shgo"},
"args": [{"var": "eggholder"}, {"var": "bounds"}],
"keyword_arguments": {"n": {"literal": 256}, "iters": {"literal": 5}, "sampling_method": {"literal": "sobol"}}
}
},
{
"@type": "Assign",
"targets": [{"var": "fig"}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "plt"}, "attr": "figure"},
"keyword_arguments": {"figsize": {"@type": "Tuple", "elts": [{"literal": 4.5}, {"literal": 4.5}]}}
}
},
{
"@type": "Assign",
"targets": [{"var": "ax"}],
"value": {"@type": "Call", "func": {"@type": "Attribute", "value": {"var": "fig"}, "attr": "add_subplot"}, "args": [{"literal": 111}]}
},
{
"@type": "Assign",
"targets": [{"var": "im"}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "ax"}, "attr": "imshow"},
"args": [{"@type": "Call", "func": {"var": "eggholder"}, "args": [{"var": "xy"}]}],
"keyword_arguments": {"interpolation": {"literal": "bilinear"}, "origin": {"literal": "lower"}, "cmap": {"literal": "gray"}}
}
},
{"@type": "Call", "func": {"@type": "Attribute", "value": {"var": "ax"}, "attr": "set_xlabel"}, "args": [{"literal": "x"}]},
{"@type": "Call", "func": {"@type": "Attribute", "value": {"var": "ax"}, "attr": "set_ylabel"}, "args": [{"literal": "y"}]},
{
"@type": "FunctionDef",
"name": "plot_point",
"args": ["res", "marker", "color"],
"defaults": [{"literal": "o"}, {"literal": null}],
"body": [
{
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "ax"}, "attr": "plot"},
"args": [
{
"@type": "BinOp",
"left": {"literal": 512},
"op": "Add",
"right": {"@type": "Subscript", "value": {"@type": "Attribute", "value": {"var": "res"}, "attr": "x"}, "slice": {"literal": 0}}
},
{
"@type": "BinOp",
"left": {"literal": 512},
"op": "Add",
"right": {"@type": "Subscript", "value": {"@type": "Attribute", "value": {"var": "res"}, "attr": "x"}, "slice": {"literal": 1}}
}
],
"keyword_arguments": {"marker": {"var": "marker"}, "color": {"var": "color"}, "ms": {"literal": 10}}
}
]
},
{
"@type": "Call",
"func": {"var": "plot_point"},
"args": [{"@type": "Subscript", "value": {"var": "results"}, "slice": {"literal": "DE"}}],
"keyword_arguments": {"color": {"literal": "c"}}
},
{
"@type": "Call",
"func": {"var": "plot_point"},
"args": [{"@type": "Subscript", "value": {"var": "results"}, "slice": {"literal": "DA"}}],
"keyword_arguments": {"color": {"literal": "w"}}
},
{
"@type": "Call",
"func": {"var": "plot_point"},
"args": [{"@type": "Subscript", "value": {"var": "results"}, "slice": {"literal": "shgo"}}],
"keyword_arguments": {"color": {"literal": "r"}, "marker": {"literal": "+"}}
},
{
"@type": "Call",
"func": {"var": "plot_point"},
"args": [{"@type": "Subscript", "value": {"var": "results"}, "slice": {"literal": "shgo_sobol"}}],
"keyword_arguments": {"color": {"literal": "r"}, "marker": {"literal": "x"}}
},
{
"@type": "For",
"target": {"var": "i"},
"iter": {
"@type": "Call",
"func": {"var": "range"},
"args": [
{
"@type": "Subscript",
"value": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {"@type": "Subscript", "value": {"var": "results"}, "slice": {"literal": "shgo_sobol"}},
"attr": "xl"
},
"attr": "shape"
},
"slice": {"literal": 0}
}
]
},
"body": [
{
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "ax"}, "attr": "plot"},
"args": [
{
"@type": "BinOp",
"left": {"literal": 512},
"op": "Add",
"right": {
"@type": "Subscript",
"value": {
"@type": "Attribute",
"value": {"@type": "Subscript", "value": {"var": "results"}, "slice": {"literal": "shgo_sobol"}},
"attr": "xl"
},
"slice": {"@type": "Tuple", "elts": [{"var": "i"}, {"literal": 0}]}
}
},
{
"@type": "BinOp",
"left": {"literal": 512},
"op": "Add",
"right": {
"@type": "Subscript",
"value": {
"@type": "Attribute",
"value": {"@type": "Subscript", "value": {"var": "results"}, "slice": {"literal": "shgo_sobol"}},
"attr": "xl"
},
"slice": {"@type": "Tuple", "elts": [{"var": "i"}, {"literal": 1}]}
}
},
{"literal": "ro"}
],
"keyword_arguments": {"ms": {"literal": 2}}
}
]
},
{
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "ax"}, "attr": "set_xlim"},
"args": [
{
"@type": "List",
"elts": [
{"@type": "UnaryOp", "op": "USub", "operand": {"literal": 4}},
{"@type": "BinOp", "left": {"literal": 514}, "op": "Mult", "right": {"literal": 2}}
]
}
]
},
{
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "ax"}, "attr": "set_ylim"},
"args": [
{
"@type": "List",
"elts": [
{"@type": "UnaryOp", "op": "USub", "operand": {"literal": 4}},
{"@type": "BinOp", "left": {"literal": 514}, "op": "Mult", "right": {"literal": 2}}
]
}
]
},
{"@type": "Call", "func": {"@type": "Attribute", "value": {"var": "fig"}, "attr": "tight_layout"}},
{"@type": "Call", "func": {"@type": "Attribute", "value": {"var": "plt"}, "attr": "show"}}
]
}
{
"@type": "Module",
"body": [
{"@type": "Import", "names": [{"name": "numpy", "asname": "np"}]},
{"@type": "Import", "names": [{"name": "matplotlib.pyplot", "asname": "plt"}]},
{"@type": "ImportFrom", "module": "scipy", "names": ["optimize"], "level": 0},
{
"@type": "FunctionDef",
"name": "eggholder",
"args": ["x"],
"body": [
{
"@type": "Return",
"value": {
"@type": "BinOp",
"left": {
"@type": "BinOp",
"left": {
"@type": "UnaryOp",
"op": "USub",
"operand": {
"@type": "BinOp",
"left": {"@type": "Subscript", "value": {"var": "x"}, "slice": {"literal": 1}},
"op": "Add",
"right": {"literal": 47}
}
},
"op": "Mult",
"right": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "np"}, "attr": "sin"},
"args": [
{
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "np"}, "attr": "sqrt"},
"args": [
{
"@type": "Call",
"func": {"var": "abs"},
"args": [
{
"@type": "BinOp",
"left": {
"@type": "BinOp",
"left": {"@type": "Subscript", "value": {"var": "x"}, "slice": {"literal": 0}},
"op": "Div",
"right": {"literal": 2}
},
"op": "Add",
"right": {
"@type": "BinOp",
"left": {"@type": "Subscript", "value": {"var": "x"}, "slice": {"literal": 1}},
"op": "Add",
"right": {"literal": 47}
}
}
]
}
]
}
]
}
},
"op": "Sub",
"right": {
"@type": "BinOp",
"left": {"@type": "Subscript", "value": {"var": "x"}, "slice": {"literal": 0}},
"op": "Mult",
"right": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "np"}, "attr": "sin"},
"args": [
{
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "np"}, "attr": "sqrt"},
"args": [
{
"@type": "Call",
"func": {"var": "abs"},
"args": [
{
"@type": "BinOp",
"left": {"@type": "Subscript", "value": {"var": "x"}, "slice": {"literal": 0}},
"op": "Sub",
"right": {
"@type": "BinOp",
"left": {"@type": "Subscript", "value": {"var": "x"}, "slice": {"literal": 1}},
"op": "Add",
"right": {"literal": 47}
}
}
]
}
]
}
]
}
}
}
}
]
},
{
"@type": "Assign",
"targets": [{"var": "bounds"}],
"value": {
"@type": "List",
"elts": [
{"@type": "Tuple", "elts": [{"@type": "UnaryOp", "op": "USub", "operand": {"literal": 512}}, {"literal": 512}]},
{"@type": "Tuple", "elts": [{"@type": "UnaryOp", "op": "USub", "operand": {"literal": 512}}, {"literal": 512}]}
]
}
},
{
"@type": "Assign",
"targets": [{"var": "x"}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "np"}, "attr": "arange"},
"args": [{"@type": "UnaryOp", "op": "USub", "operand": {"literal": 512}}, {"literal": 513}]
}
},
{
"@type": "Assign",
"targets": [{"var": "y"}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "np"}, "attr": "arange"},
"args": [{"@type": "UnaryOp", "op": "USub", "operand": {"literal": 512}}, {"literal": 513}]
}
},
{
"@type": "Assign",
"targets": [{"@type": "Tuple", "elts": [{"var": "xgrid"}, {"var": "ygrid"}]}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "np"}, "attr": "meshgrid"},
"args": [{"var": "x"}, {"var": "y"}]
}
},
{
"@type": "Assign",
"targets": [{"var": "xy"}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "np"}, "attr": "stack"},
"args": [{"@type": "List", "elts": [{"var": "xgrid"}, {"var": "ygrid"}]}]
}
},
{"@type": "Assign", "targets": [{"var": "results"}], "value": {"@type": "Call", "func": {"var": "dict"}}},
{
"@type": "Assign",
"targets": [{"@type": "Subscript", "value": {"var": "results"}, "slice": {"literal": "shgo"}}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "optimize"}, "attr": "shgo"},
"args": [{"var": "eggholder"}, {"var": "bounds"}]
}
},
{
"@type": "Assign",
"targets": [{"@type": "Subscript", "value": {"var": "results"}, "slice": {"literal": "DA"}}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "optimize"}, "attr": "dual_annealing"},
"args": [{"var": "eggholder"}, {"var": "bounds"}]
}
},
{
"@type": "Assign",
"targets": [{"@type": "Subscript", "value": {"var": "results"}, "slice": {"literal": "DE"}}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "optimize"}, "attr": "differential_evolution"},
"args": [{"var": "eggholder"}, {"var": "bounds"}]
}
},
{
"@type": "Assign",
"targets": [{"@type": "Subscript", "value": {"var": "results"}, "slice": {"literal": "shgo_sobol"}}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "optimize"}, "attr": "shgo"},
"args": [{"var": "eggholder"}, {"var": "bounds"}],
"keyword_arguments": {"n": {"literal": 256}, "iters": {"literal": 5}, "sampling_method": {"literal": "sobol"}}
}
},
{
"@type": "Assign",
"targets": [{"var": "fig"}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "plt"}, "attr": "figure"},
"keyword_arguments": {"figsize": {"@type": "Tuple", "elts": [{"literal": 4.5}, {"literal": 4.5}]}}
}
},
{
"@type": "Assign",
"targets": [{"var": "ax"}],
"value": {"@type": "Call", "func": {"@type": "Attribute", "value": {"var": "fig"}, "attr": "add_subplot"}, "args": [{"literal": 111}]}
},
{
"@type": "Assign",
"targets": [{"var": "im"}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "ax"}, "attr": "imshow"},
"args": [{"@type": "Call", "func": {"var": "eggholder"}, "args": [{"var": "xy"}]}],
"keyword_arguments": {"interpolation": {"literal": "bilinear"}, "origin": {"literal": "lower"}, "cmap": {"literal": "gray"}}
}
},
{"@type": "Call", "func": {"@type": "Attribute", "value": {"var": "ax"}, "attr": "set_xlabel"}, "args": [{"literal": "x"}]},
{"@type": "Call", "func": {"@type": "Attribute", "value": {"var": "ax"}, "attr": "set_ylabel"}, "args": [{"literal": "y"}]},
{
"@type": "FunctionDef",
"name": "plot_point",
"args": ["res", "marker", "color"],
"defaults": [{"literal": "o"}, {"literal": null}],
"body": [
{
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "ax"}, "attr": "plot"},
"args": [
{
"@type": "BinOp",
"left": {"literal": 512},
"op": "Add",
"right": {"@type": "Subscript", "value": {"@type": "Attribute", "value": {"var": "res"}, "attr": "x"}, "slice": {"literal": 0}}
},
{
"@type": "BinOp",
"left": {"literal": 512},
"op": "Add",
"right": {"@type": "Subscript", "value": {"@type": "Attribute", "value": {"var": "res"}, "attr": "x"}, "slice": {"literal": 1}}
}
],
"keyword_arguments": {"marker": {"var": "marker"}, "color": {"var": "color"}, "ms": {"literal": 10}}
}
]
},
{
"@type": "Call",
"func": {"var": "plot_point"},
"args": [{"@type": "Subscript", "value": {"var": "results"}, "slice": {"literal": "DE"}}],
"keyword_arguments": {"color": {"literal": "c"}}
},
{
"@type": "Call",
"func": {"var": "plot_point"},
"args": [{"@type": "Subscript", "value": {"var": "results"}, "slice": {"literal": "DA"}}],
"keyword_arguments": {"color": {"literal": "w"}}
},
{
"@type": "Call",
"func": {"var": "plot_point"},
"args": [{"@type": "Subscript", "value": {"var": "results"}, "slice": {"literal": "shgo"}}],
"keyword_arguments": {"color": {"literal": "r"}, "marker": {"literal": "+"}}
},
{
"@type": "Call",
"func": {"var": "plot_point"},
"args": [{"@type": "Subscript", "value": {"var": "results"}, "slice": {"literal": "shgo_sobol"}}],
"keyword_arguments": {"color": {"literal": "r"}, "marker": {"literal": "x"}}
},
{
"@type": "For",
"target": {"var": "i"},
"iter": {
"@type": "Call",
"func": {"var": "range"},
"args": [
{
"@type": "Subscript",
"value": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {"@type": "Subscript", "value": {"var": "results"}, "slice": {"literal": "shgo_sobol"}},
"attr": "xl"
},
"attr": "shape"
},
"slice": {"literal": 0}
}
]
},
"body": [
{
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "ax"}, "attr": "plot"},
"args": [
{
"@type": "BinOp",
"left": {"literal": 512},
"op": "Add",
"right": {
"@type": "Subscript",
"value": {
"@type": "Attribute",
"value": {"@type": "Subscript", "value": {"var": "results"}, "slice": {"literal": "shgo_sobol"}},
"attr": "xl"
},
"slice": {"@type": "Tuple", "elts": [{"var": "i"}, {"literal": 0}]}
}
},
{
"@type": "BinOp",
"left": {"literal": 512},
"op": "Add",
"right": {
"@type": "Subscript",
"value": {
"@type": "Attribute",
"value": {"@type": "Subscript", "value": {"var": "results"}, "slice": {"literal": "shgo_sobol"}},
"attr": "xl"
},
"slice": {"@type": "Tuple", "elts": [{"var": "i"}, {"literal": 1}]}
}
},
{"literal": "ro"}
],
"keyword_arguments": {"ms": {"literal": 2}}
}
]
},
{
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "ax"}, "attr": "set_xlim"},
"args": [
{
"@type": "List",
"elts": [
{"@type": "UnaryOp", "op": "USub", "operand": {"literal": 4}},
{"@type": "BinOp", "left": {"literal": 514}, "op": "Mult", "right": {"literal": 2}}
]
}
]
},
{
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "ax"}, "attr": "set_ylim"},
"args": [
{
"@type": "List",
"elts": [
{"@type": "UnaryOp", "op": "USub", "operand": {"literal": 4}},
{"@type": "BinOp", "left": {"literal": 514}, "op": "Mult", "right": {"literal": 2}}
]
}
]
},
{"@type": "Call", "func": {"@type": "Attribute", "value": {"var": "fig"}, "attr": "tight_layout"}},
{"@type": "Call", "func": {"@type": "Attribute", "value": {"var": "plt"}, "attr": "show"}}
]
}
@prefix awl: <https://w3id.org/awl/schema/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<https://w3id.org/awl/py/real.optimize_global/eggholder.step#29> a awl:Return ;
awl:order 0 ;
awl:span [ awl:endCol 62 ;
awl:endLine 8 ;
awl:file "optimize_global.py" ;
awl:startCol 4 ;
awl:startLine 7 ] ;
awl:value [ a awl:BinOp ;
awl:left [ a awl:BinOp ;
awl:left [ a awl:UnaryOp ;
awl:op "USub" ;
awl:operand [ a awl:BinOp ;
awl:left [ a awl:Subscript ;
awl:slice [ awl:literal 1 ;
awl:span [ awl:endCol 17 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 16 ;
awl:startLine 7 ] ] ;
awl:span [ awl:endCol 18 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 14 ;
awl:startLine 7 ] ;
awl:value [ awl:span [ awl:endCol 15 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 14 ;
awl:startLine 7 ] ;
awl:var "x" ] ] ;
awl:op "Add" ;
awl:right [ awl:literal 47 ;
awl:span [ awl:endCol 23 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 21 ;
awl:startLine 7 ] ] ;
awl:span [ awl:endCol 23 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 14 ;
awl:startLine 7 ] ] ;
awl:span [ awl:endCol 24 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 12 ;
awl:startLine 7 ] ] ;
awl:op "Mult" ;
awl:right [ a awl:Call ;
awl:argument ( [ a awl:Call ;
awl:argument ( [ a awl:Call ;
awl:argument ( [ a awl:BinOp ;
awl:left [ a awl:BinOp ;
awl:left [ a awl:Subscript ;
awl:slice [ awl:literal 0 ;
awl:span [ awl:endCol 49 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 48 ;
awl:startLine 7 ] ] ;
awl:span [ awl:endCol 50 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 46 ;
awl:startLine 7 ] ;
awl:value [ awl:span [ awl:endCol 47 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 46 ;
awl:startLine 7 ] ;
awl:var "x" ] ] ;
awl:op "Div" ;
awl:right [ awl:literal 2 ;
awl:span [ awl:endCol 52 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 51 ;
awl:startLine 7 ] ] ;
awl:span [ awl:endCol 52 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 46 ;
awl:startLine 7 ] ] ;
awl:op "Add" ;
awl:right [ a awl:BinOp ;
awl:left [ a awl:Subscript ;
awl:slice [ awl:literal 1 ;
awl:span [ awl:endCol 59 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 58 ;
awl:startLine 7 ] ] ;
awl:span [ awl:endCol 60 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 56 ;
awl:startLine 7 ] ;
awl:value [ awl:span [ awl:endCol 57 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 56 ;
awl:startLine 7 ] ;
awl:var "x" ] ] ;
awl:op "Add" ;
awl:right [ awl:literal 47 ;
awl:span [ awl:endCol 66 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 64 ;
awl:startLine 7 ] ] ;
awl:span [ awl:endCol 66 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 56 ;
awl:startLine 7 ] ] ;
awl:span [ awl:endCol 67 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 46 ;
awl:startLine 7 ] ] ) ;
awl:func [ awl:span [ awl:endCol 45 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 42 ;
awl:startLine 7 ] ;
awl:var "abs" ] ;
awl:span [ awl:endCol 68 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 42 ;
awl:startLine 7 ] ] ) ;
awl:func [ a awl:Attribute ;
awl:attr "sqrt" ;
awl:span [ awl:endCol 41 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 34 ;
awl:startLine 7 ] ;
awl:value [ awl:span [ awl:endCol 36 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 34 ;
awl:startLine 7 ] ;
awl:var "np" ] ] ;
awl:span [ awl:endCol 69 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 34 ;
awl:startLine 7 ] ] ) ;
awl:func [ a awl:Attribute ;
awl:attr "sin" ;
awl:span [ awl:endCol 33 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 27 ;
awl:startLine 7 ] ;
awl:value [ awl:span [ awl:endCol 29 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 27 ;
awl:startLine 7 ] ;
awl:var "np" ] ] ;
awl:span [ awl:endCol 70 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 27 ;
awl:startLine 7 ] ] ;
awl:span [ awl:endCol 70 ;
awl:endLine 7 ;
awl:file "optimize_global.py" ;
awl:startCol 12 ;
awl:startLine 7 ] ] ;
awl:op "Sub" ;
awl:right [ a awl:BinOp ;
awl:left [ a awl:Subscript ;
awl:slice [ awl:literal 0 ;
awl:span [ awl:endCol 16 ;
awl:endLine 8 ;
awl:file "optimize_global.py" ;
awl:startCol 15 ;
awl:startLine 8 ] ] ;
awl:span [ awl:endCol 17 ;
awl:endLine 8 ;
awl:file "optimize_global.py" ;
awl:startCol 13 ;
awl:startLine 8 ] ;
awl:value [ awl:span [ awl:endCol 14 ;
awl:endLine 8 ;
awl:file "optimize_global.py" ;
awl:startCol 13 ;
awl:startLine 8 ] ;
awl:var "x" ] ] ;
awl:op "Mult" ;
awl:right [ a awl:Call ;
awl:argument ( [ a awl:Call ;
awl:argument ( [ a awl:Call ;
awl:argument ( [ a awl:BinOp ;
awl:left [ a awl:Subscript ;
awl:slice [ awl:literal 0 ;
awl:span [ awl:endCol 42 ;
awl:endLine 8 ;
awl:file "optimize_global.py" ;
awl:startCol 41 ;
awl:startLine 8 ] ] ;
awl:span [ awl:endCol 43 ;
awl:endLine 8 ;
awl:file "optimize_global.py" ;
awl:startCol 39 ;
awl:startLine 8 ] ;
awl:value [ awl:span [ awl:endCol 40 ;
awl:endLine 8 ;
awl:file "optimize_global.py" ;
awl:startCol 39 ;
awl:startLine 8 ] ;
awl:var "x" ] ] ;
awl:op "Sub" ;
awl:right [ a awl:BinOp ;
awl:left [ a awl:Subscript ;
awl:slice [ awl:literal 1 ;
awl:span [ awl:endCol 50 ;
awl:endLine 8 ;
awl:file "optimize_global.py" ;
awl:startCol 49 ;
awl:startLine 8 ] ] ;
awl:span [ awl:endCol 51 ;
awl:endLine 8 ;
awl:file "optimize_global.py" ;
awl:startCol 47 ;
awl:startLine 8 ] ;
awl:value [ awl:span [ awl:endCol 48 ;
awl:endLine 8 ;
awl:file "optimize_global.py" ;
awl:startCol 47 ;
awl:startLine 8 ] ;
awl:var "x" ] ] ;
awl:op "Add" ;
awl:right [ awl:literal 47 ;
awl:span [ awl:endCol 57 ;
awl:endLine 8 ;
awl:file "optimize_global.py" ;
awl:startCol 55 ;
awl:startLine 8 ] ] ;
awl:span [ awl:endCol 57 ;
awl:endLine 8 ;
awl:file "optimize_global.py" ;
awl:startCol 47 ;
awl:startLine 8 ] ] ;
awl:span [ awl:endCol 58 ;
awl:endLine 8 ;
awl:file "optimize_global.py" ;
awl:startCol 39 ;
awl:startLine 8 ] ] ) ;
awl:func [ awl:span [ awl:endCol 38 ;
awl:endLine 8 ;
awl:file "optimize_global.py" ;
awl:startCol 35 ;
awl:startLine 8 ] ;
awl:var "abs" ] ;
awl:span [ awl:endCol 59 ;
awl:endLine 8 ;
awl:file "optimize_global.py" ;
awl:startCol 35 ;
awl:startLine 8 ] ] ) ;
awl:func [ a awl:Attribute ;
awl:attr "sqrt" ;
awl:span [ awl:endCol 34 ;
awl:endLine 8 ;
awl:file "optimize_global.py" ;
awl:startCol 27 ;
awl:startLine 8 ] ;
awl:value [ awl:span [ awl:endCol 29 ;
awl:endLine 8 ;
awl:file "optimize_global.py" ;
awl:startCol 27 ;
awl:startLine 8 ] ;
awl:var "np" ] ] ;
awl:span [ awl:endCol 60 ;
awl:endLine 8 ;
awl:file "optimize_global.py" ;
awl:startCol 27 ;
awl:startLine 8 ] ] ) ;
awl:func [ a awl:Attribute ;
awl:attr "sin" ;
awl:span [ awl:endCol 26 ;
awl:endLine 8 ;
awl:file "optimize_global.py" ;
awl:startCol 20 ;
awl:startLine 8 ] ;
awl:value [ awl:span [ awl:endCol 22 ;
awl:endLine 8 ;
awl:file "optimize_global.py" ;
awl:startCol 20 ;
awl:startLine 8 ] ;
awl:var "np" ] ] ;
awl:span [ awl:endCol 61 ;
awl:endLine 8 ;
awl:file "optimize_global.py" ;
awl:startCol 20 ;
awl:startLine 8 ] ] ;
awl:span [ awl:endCol 61 ;
awl:endLine 8 ;
awl:file "optimize_global.py" ;
awl:startCol 13 ;
awl:startLine 8 ] ] ;
awl:span [ awl:endCol 61 ;
awl:endLine 8 ;
awl:file "optimize_global.py" ;
awl:startCol 12 ;
awl:startLine 7 ] ] .
<https://w3id.org/awl/py/real.optimize_global/plot_point.step#30> a awl:Call ;
awl:argument ( [ a awl:BinOp ;
awl:left [ awl:literal 512 ;
awl:span [ awl:endCol 15 ;
awl:endLine 32 ;
awl:file "optimize_global.py" ;
awl:startCol 12 ;
awl:startLine 32 ] ] ;
awl:op "Add" ;
awl:right [ a awl:Subscript ;
awl:slice [ awl:literal 0 ;
awl:span [ awl:endCol 23 ;
awl:endLine 32 ;
awl:file "optimize_global.py" ;
awl:startCol 22 ;
awl:startLine 32 ] ] ;
awl:span [ awl:endCol 24 ;
awl:endLine 32 ;
awl:file "optimize_global.py" ;
awl:startCol 16 ;
awl:startLine 32 ] ;
awl:value [ a awl:Attribute ;
awl:attr "x" ;
awl:span [ awl:endCol 21 ;
awl:endLine 32 ;
awl:file "optimize_global.py" ;
awl:startCol 16 ;
awl:startLine 32 ] ;
awl:value [ awl:span [ awl:endCol 19 ;
awl:endLine 32 ;
awl:file "optimize_global.py" ;
awl:startCol 16 ;
awl:startLine 32 ] ;
awl:var "res" ] ] ] ;
awl:span [ awl:endCol 24 ;
awl:endLine 32 ;
awl:file "optimize_global.py" ;
awl:startCol 12 ;
awl:startLine 32 ] ] [ a awl:BinOp ;
awl:left [ awl:literal 512 ;
awl:span [ awl:endCol 29 ;
awl:endLine 32 ;
awl:file "optimize_global.py" ;
awl:startCol 26 ;
awl:startLine 32 ] ] ;
awl:op "Add" ;
awl:right [ a awl:Subscript ;
awl:slice [ awl:literal 1 ;
awl:span [ awl:endCol 37 ;
awl:endLine 32 ;
awl:file "optimize_global.py" ;
awl:startCol 36 ;
awl:startLine 32 ] ] ;
awl:span [ awl:endCol 38 ;
awl:endLine 32 ;
awl:file "optimize_global.py" ;
awl:startCol 30 ;
awl:startLine 32 ] ;
awl:value [ a awl:Attribute ;
awl:attr "x" ;
awl:span [ awl:endCol 35 ;
awl:endLine 32 ;
awl:file "optimize_global.py" ;
awl:startCol 30 ;
awl:startLine 32 ] ;
awl:value [ awl:span [ awl:endCol 33 ;
awl:endLine 32 ;
awl:file "optimize_global.py" ;
awl:startCol 30 ;
awl:startLine 32 ] ;
awl:var "res" ] ] ] ;
awl:span [ awl:endCol 38 ;
awl:endLine 32 ;
awl:file "optimize_global.py" ;
awl:startCol 26 ;
awl:startLine 32 ] ] ) ;
awl:func [ a awl:Attribute ;
awl:attr "plot" ;
awl:span [ awl:endCol 11 ;
awl:endLine 32 ;
awl:file "optimize_global.py" ;
awl:startCol 4 ;
awl:startLine 32 ] ;
awl:value [ awl:span [ awl:endCol 6 ;
awl:endLine 32 ;
awl:file "optimize_global.py" ;
awl:startCol 4 ;
awl:startLine 32 ] ;
awl:var "ax" ] ] ;
awl:keywordArguments [ awl:color [ awl:span [ awl:endCol 66 ;
awl:endLine 32 ;
awl:file "optimize_global.py" ;
awl:startCol 61 ;
awl:startLine 32 ] ;
awl:var "color" ] ;
awl:marker [ awl:span [ awl:endCol 53 ;
awl:endLine 32 ;
awl:file "optimize_global.py" ;
awl:startCol 47 ;
awl:startLine 32 ] ;
awl:var "marker" ] ;
awl:ms [ awl:literal 10 ;
awl:span [ awl:endCol 73 ;
awl:endLine 32 ;
awl:file "optimize_global.py" ;
awl:startCol 71 ;
awl:startLine 32 ] ] ] ;
awl:order 0 ;
awl:span [ awl:endCol 74 ;
awl:endLine 32 ;
awl:file "optimize_global.py" ;
awl:startCol 4 ;
awl:startLine 32 ] .
<https://w3id.org/awl/py/real.optimize_global/step#1> a awl:Import ;
awl:names [ awl:asname "np" ;
awl:name "numpy" ] ;
awl:order 0 ;
awl:span [ awl:endCol 18 ;
awl:endLine 1 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 1 ] .
<https://w3id.org/awl/py/real.optimize_global/step#10> a awl:Assign ;
awl:order 10 ;
awl:span [ awl:endCol 50 ;
awl:endLine 18 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 18 ] ;
awl:targets [ a awl:Subscript ;
awl:slice [ awl:literal "shgo" ;
awl:span [ awl:endCol 14 ;
awl:endLine 18 ;
awl:file "optimize_global.py" ;
awl:startCol 8 ;
awl:startLine 18 ] ] ;
awl:span [ awl:endCol 15 ;
awl:endLine 18 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 18 ] ;
awl:value [ awl:span [ awl:endCol 7 ;
awl:endLine 18 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 18 ] ;
awl:var "results" ] ] ;
awl:value [ a awl:Call ;
awl:argument ( [ awl:span [ awl:endCol 41 ;
awl:endLine 18 ;
awl:file "optimize_global.py" ;
awl:startCol 32 ;
awl:startLine 18 ] ;
awl:var "eggholder" ] [ awl:span [ awl:endCol 49 ;
awl:endLine 18 ;
awl:file "optimize_global.py" ;
awl:startCol 43 ;
awl:startLine 18 ] ;
awl:var "bounds" ] ) ;
awl:func [ a awl:Attribute ;
awl:attr "shgo" ;
awl:span [ awl:endCol 31 ;
awl:endLine 18 ;
awl:file "optimize_global.py" ;
awl:startCol 18 ;
awl:startLine 18 ] ;
awl:value [ awl:span [ awl:endCol 26 ;
awl:endLine 18 ;
awl:file "optimize_global.py" ;
awl:startCol 18 ;
awl:startLine 18 ] ;
awl:var "optimize" ] ] ;
awl:span [ awl:endCol 50 ;
awl:endLine 18 ;
awl:file "optimize_global.py" ;
awl:startCol 18 ;
awl:startLine 18 ] ] .
<https://w3id.org/awl/py/real.optimize_global/step#11> a awl:Assign ;
awl:order 11 ;
awl:span [ awl:endCol 58 ;
awl:endLine 19 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 19 ] ;
awl:targets [ a awl:Subscript ;
awl:slice [ awl:literal "DA" ;
awl:span [ awl:endCol 12 ;
awl:endLine 19 ;
awl:file "optimize_global.py" ;
awl:startCol 8 ;
awl:startLine 19 ] ] ;
awl:span [ awl:endCol 13 ;
awl:endLine 19 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 19 ] ;
awl:value [ awl:span [ awl:endCol 7 ;
awl:endLine 19 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 19 ] ;
awl:var "results" ] ] ;
awl:value [ a awl:Call ;
awl:argument ( [ awl:span [ awl:endCol 49 ;
awl:endLine 19 ;
awl:file "optimize_global.py" ;
awl:startCol 40 ;
awl:startLine 19 ] ;
awl:var "eggholder" ] [ awl:span [ awl:endCol 57 ;
awl:endLine 19 ;
awl:file "optimize_global.py" ;
awl:startCol 51 ;
awl:startLine 19 ] ;
awl:var "bounds" ] ) ;
awl:func [ a awl:Attribute ;
awl:attr "dual_annealing" ;
awl:span [ awl:endCol 39 ;
awl:endLine 19 ;
awl:file "optimize_global.py" ;
awl:startCol 16 ;
awl:startLine 19 ] ;
awl:value [ awl:span [ awl:endCol 24 ;
awl:endLine 19 ;
awl:file "optimize_global.py" ;
awl:startCol 16 ;
awl:startLine 19 ] ;
awl:var "optimize" ] ] ;
awl:span [ awl:endCol 58 ;
awl:endLine 19 ;
awl:file "optimize_global.py" ;
awl:startCol 16 ;
awl:startLine 19 ] ] .
<https://w3id.org/awl/py/real.optimize_global/step#12> a awl:Assign ;
awl:order 12 ;
awl:span [ awl:endCol 66 ;
awl:endLine 20 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 20 ] ;
awl:targets [ a awl:Subscript ;
awl:slice [ awl:literal "DE" ;
awl:span [ awl:endCol 12 ;
awl:endLine 20 ;
awl:file "optimize_global.py" ;
awl:startCol 8 ;
awl:startLine 20 ] ] ;
awl:span [ awl:endCol 13 ;
awl:endLine 20 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 20 ] ;
awl:value [ awl:span [ awl:endCol 7 ;
awl:endLine 20 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 20 ] ;
awl:var "results" ] ] ;
awl:value [ a awl:Call ;
awl:argument ( [ awl:span [ awl:endCol 57 ;
awl:endLine 20 ;
awl:file "optimize_global.py" ;
awl:startCol 48 ;
awl:startLine 20 ] ;
awl:var "eggholder" ] [ awl:span [ awl:endCol 65 ;
awl:endLine 20 ;
awl:file "optimize_global.py" ;
awl:startCol 59 ;
awl:startLine 20 ] ;
awl:var "bounds" ] ) ;
awl:func [ a awl:Attribute ;
awl:attr "differential_evolution" ;
awl:span [ awl:endCol 47 ;
awl:endLine 20 ;
awl:file "optimize_global.py" ;
awl:startCol 16 ;
awl:startLine 20 ] ;
awl:value [ awl:span [ awl:endCol 24 ;
awl:endLine 20 ;
awl:file "optimize_global.py" ;
awl:startCol 16 ;
awl:startLine 20 ] ;
awl:var "optimize" ] ] ;
awl:span [ awl:endCol 66 ;
awl:endLine 20 ;
awl:file "optimize_global.py" ;
awl:startCol 16 ;
awl:startLine 20 ] ] .
<https://w3id.org/awl/py/real.optimize_global/step#13> a awl:Assign ;
awl:order 13 ;
awl:span [ awl:endCol 62 ;
awl:endLine 22 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 21 ] ;
awl:targets [ a awl:Subscript ;
awl:slice [ awl:literal "shgo_sobol" ;
awl:span [ awl:endCol 20 ;
awl:endLine 21 ;
awl:file "optimize_global.py" ;
awl:startCol 8 ;
awl:startLine 21 ] ] ;
awl:span [ awl:endCol 21 ;
awl:endLine 21 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 21 ] ;
awl:value [ awl:span [ awl:endCol 7 ;
awl:endLine 21 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 21 ] ;
awl:var "results" ] ] ;
awl:value [ a awl:Call ;
awl:argument ( [ awl:span [ awl:endCol 47 ;
awl:endLine 21 ;
awl:file "optimize_global.py" ;
awl:startCol 38 ;
awl:startLine 21 ] ;
awl:var "eggholder" ] [ awl:span [ awl:endCol 55 ;
awl:endLine 21 ;
awl:file "optimize_global.py" ;
awl:startCol 49 ;
awl:startLine 21 ] ;
awl:var "bounds" ] ) ;
awl:func [ a awl:Attribute ;
awl:attr "shgo" ;
awl:span [ awl:endCol 37 ;
awl:endLine 21 ;
awl:file "optimize_global.py" ;
awl:startCol 24 ;
awl:startLine 21 ] ;
awl:value [ awl:span [ awl:endCol 32 ;
awl:endLine 21 ;
awl:file "optimize_global.py" ;
awl:startCol 24 ;
awl:startLine 21 ] ;
awl:var "optimize" ] ] ;
awl:keywordArguments [ awl:iters [ awl:literal 5 ;
awl:span [ awl:endCol 71 ;
awl:endLine 21 ;
awl:file "optimize_global.py" ;
awl:startCol 70 ;
awl:startLine 21 ] ] ;
awl:n [ awl:literal 256 ;
awl:span [ awl:endCol 62 ;
awl:endLine 21 ;
awl:file "optimize_global.py" ;
awl:startCol 59 ;
awl:startLine 21 ] ] ;
awl:sampling_method [ awl:literal "sobol" ;
awl:span [ awl:endCol 61 ;
awl:endLine 22 ;
awl:file "optimize_global.py" ;
awl:startCol 54 ;
awl:startLine 22 ] ] ] ;
awl:span [ awl:endCol 62 ;
awl:endLine 22 ;
awl:file "optimize_global.py" ;
awl:startCol 24 ;
awl:startLine 21 ] ] .
<https://w3id.org/awl/py/real.optimize_global/step#14> a awl:Assign ;
awl:order 14 ;
awl:span [ awl:endCol 36 ;
awl:endLine 24 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 24 ] ;
awl:targets [ awl:span [ awl:endCol 3 ;
awl:endLine 24 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 24 ] ;
awl:var "fig" ] ;
awl:value [ a awl:Call ;
awl:func [ a awl:Attribute ;
awl:attr "figure" ;
awl:span [ awl:endCol 16 ;
awl:endLine 24 ;
awl:file "optimize_global.py" ;
awl:startCol 6 ;
awl:startLine 24 ] ;
awl:value [ awl:span [ awl:endCol 9 ;
awl:endLine 24 ;
awl:file "optimize_global.py" ;
awl:startCol 6 ;
awl:startLine 24 ] ;
awl:var "plt" ] ] ;
awl:keywordArguments [ awl:figsize [ a awl:Tuple ;
awl:elts [ awl:literal 4.5e+00 ;
awl:span [ awl:endCol 29 ;
awl:endLine 24 ;
awl:file "optimize_global.py" ;
awl:startCol 26 ;
awl:startLine 24 ] ],
[ awl:literal 4.5e+00 ;
awl:span [ awl:endCol 34 ;
awl:endLine 24 ;
awl:file "optimize_global.py" ;
awl:startCol 31 ;
awl:startLine 24 ] ] ;
awl:span [ awl:endCol 35 ;
awl:endLine 24 ;
awl:file "optimize_global.py" ;
awl:startCol 25 ;
awl:startLine 24 ] ] ] ;
awl:span [ awl:endCol 36 ;
awl:endLine 24 ;
awl:file "optimize_global.py" ;
awl:startCol 6 ;
awl:startLine 24 ] ] .
<https://w3id.org/awl/py/real.optimize_global/step#15> a awl:Assign ;
awl:order 15 ;
awl:span [ awl:endCol 25 ;
awl:endLine 25 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 25 ] ;
awl:targets [ awl:span [ awl:endCol 2 ;
awl:endLine 25 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 25 ] ;
awl:var "ax" ] ;
awl:value [ a awl:Call ;
awl:argument ( [ awl:literal 111 ;
awl:span [ awl:endCol 24 ;
awl:endLine 25 ;
awl:file "optimize_global.py" ;
awl:startCol 21 ;
awl:startLine 25 ] ] ) ;
awl:func [ a awl:Attribute ;
awl:attr "add_subplot" ;
awl:span [ awl:endCol 20 ;
awl:endLine 25 ;
awl:file "optimize_global.py" ;
awl:startCol 5 ;
awl:startLine 25 ] ;
awl:value [ awl:span [ awl:endCol 8 ;
awl:endLine 25 ;
awl:file "optimize_global.py" ;
awl:startCol 5 ;
awl:startLine 25 ] ;
awl:var "fig" ] ] ;
awl:span [ awl:endCol 25 ;
awl:endLine 25 ;
awl:file "optimize_global.py" ;
awl:startCol 5 ;
awl:startLine 25 ] ] .
<https://w3id.org/awl/py/real.optimize_global/step#16> a awl:Assign ;
awl:order 16 ;
awl:span [ awl:endCol 27 ;
awl:endLine 27 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 26 ] ;
awl:targets [ awl:span [ awl:endCol 2 ;
awl:endLine 26 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 26 ] ;
awl:var "im" ] ;
awl:value [ a awl:Call ;
awl:argument ( [ a awl:Call ;
awl:argument ( [ awl:span [ awl:endCol 27 ;
awl:endLine 26 ;
awl:file "optimize_global.py" ;
awl:startCol 25 ;
awl:startLine 26 ] ;
awl:var "xy" ] ) ;
awl:func [ awl:span [ awl:endCol 24 ;
awl:endLine 26 ;
awl:file "optimize_global.py" ;
awl:startCol 15 ;
awl:startLine 26 ] ;
awl:var "eggholder" ] ;
awl:span [ awl:endCol 28 ;
awl:endLine 26 ;
awl:file "optimize_global.py" ;
awl:startCol 15 ;
awl:startLine 26 ] ] ) ;
awl:func [ a awl:Attribute ;
awl:attr "imshow" ;
awl:span [ awl:endCol 14 ;
awl:endLine 26 ;
awl:file "optimize_global.py" ;
awl:startCol 5 ;
awl:startLine 26 ] ;
awl:value [ awl:span [ awl:endCol 7 ;
awl:endLine 26 ;
awl:file "optimize_global.py" ;
awl:startCol 5 ;
awl:startLine 26 ] ;
awl:var "ax" ] ] ;
awl:keywordArguments [ awl:cmap [ awl:literal "gray" ;
awl:span [ awl:endCol 26 ;
awl:endLine 27 ;
awl:file "optimize_global.py" ;
awl:startCol 20 ;
awl:startLine 27 ] ] ;
awl:interpolation [ awl:literal "bilinear" ;
awl:span [ awl:endCol 54 ;
awl:endLine 26 ;
awl:file "optimize_global.py" ;
awl:startCol 44 ;
awl:startLine 26 ] ] ;
awl:origin [ awl:literal "lower" ;
awl:span [ awl:endCol 70 ;
awl:endLine 26 ;
awl:file "optimize_global.py" ;
awl:startCol 63 ;
awl:startLine 26 ] ] ] ;
awl:span [ awl:endCol 27 ;
awl:endLine 27 ;
awl:file "optimize_global.py" ;
awl:startCol 5 ;
awl:startLine 26 ] ] .
<https://w3id.org/awl/py/real.optimize_global/step#17> a awl:Call ;
awl:argument ( [ awl:literal "x" ;
awl:span [ awl:endCol 17 ;
awl:endLine 28 ;
awl:file "optimize_global.py" ;
awl:startCol 14 ;
awl:startLine 28 ] ] ) ;
awl:func [ a awl:Attribute ;
awl:attr "set_xlabel" ;
awl:span [ awl:endCol 13 ;
awl:endLine 28 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 28 ] ;
awl:value [ awl:span [ awl:endCol 2 ;
awl:endLine 28 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 28 ] ;
awl:var "ax" ] ] ;
awl:order 17 ;
awl:span [ awl:endCol 18 ;
awl:endLine 28 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 28 ] .
<https://w3id.org/awl/py/real.optimize_global/step#18> a awl:Call ;
awl:argument ( [ awl:literal "y" ;
awl:span [ awl:endCol 17 ;
awl:endLine 29 ;
awl:file "optimize_global.py" ;
awl:startCol 14 ;
awl:startLine 29 ] ] ) ;
awl:func [ a awl:Attribute ;
awl:attr "set_ylabel" ;
awl:span [ awl:endCol 13 ;
awl:endLine 29 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 29 ] ;
awl:value [ awl:span [ awl:endCol 2 ;
awl:endLine 29 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 29 ] ;
awl:var "ax" ] ] ;
awl:order 18 ;
awl:span [ awl:endCol 18 ;
awl:endLine 29 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 29 ] .
<https://w3id.org/awl/py/real.optimize_global/step#19> a awl:Call ;
awl:argument ( [ a awl:Subscript ;
awl:slice [ awl:literal "DE" ;
awl:span [ awl:endCol 23 ;
awl:endLine 34 ;
awl:file "optimize_global.py" ;
awl:startCol 19 ;
awl:startLine 34 ] ] ;
awl:span [ awl:endCol 24 ;
awl:endLine 34 ;
awl:file "optimize_global.py" ;
awl:startCol 11 ;
awl:startLine 34 ] ;
awl:value [ awl:span [ awl:endCol 18 ;
awl:endLine 34 ;
awl:file "optimize_global.py" ;
awl:startCol 11 ;
awl:startLine 34 ] ;
awl:var "results" ] ] ) ;
awl:comment [ awl:span [ awl:endCol 69 ;
awl:endLine 34 ;
awl:file "optimize_global.py" ;
awl:startCol 38 ;
awl:startLine 34 ] ;
awl:text "differential_evolution - cyan" ;
awl:where "beside" ] ;
awl:func [ awl:span [ awl:endCol 10 ;
awl:endLine 34 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 34 ] ;
awl:var "plot_point" ] ;
awl:keywordArguments [ awl:color [ awl:literal "c" ;
awl:span [ awl:endCol 35 ;
awl:endLine 34 ;
awl:file "optimize_global.py" ;
awl:startCol 32 ;
awl:startLine 34 ] ] ] ;
awl:order 20 ;
awl:span [ awl:endCol 36 ;
awl:endLine 34 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 34 ] .
<https://w3id.org/awl/py/real.optimize_global/step#2> a awl:Import ;
awl:names [ awl:asname "plt" ;
awl:name "matplotlib.pyplot" ] ;
awl:order 1 ;
awl:span [ awl:endCol 31 ;
awl:endLine 2 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 2 ] .
<https://w3id.org/awl/py/real.optimize_global/step#20> a awl:Call ;
awl:argument ( [ a awl:Subscript ;
awl:slice [ awl:literal "DA" ;
awl:span [ awl:endCol 23 ;
awl:endLine 35 ;
awl:file "optimize_global.py" ;
awl:startCol 19 ;
awl:startLine 35 ] ] ;
awl:span [ awl:endCol 24 ;
awl:endLine 35 ;
awl:file "optimize_global.py" ;
awl:startCol 11 ;
awl:startLine 35 ] ;
awl:value [ awl:span [ awl:endCol 18 ;
awl:endLine 35 ;
awl:file "optimize_global.py" ;
awl:startCol 11 ;
awl:startLine 35 ] ;
awl:var "results" ] ] ) ;
awl:comment [ awl:span [ awl:endCol 70 ;
awl:endLine 35 ;
awl:file "optimize_global.py" ;
awl:startCol 38 ;
awl:startLine 35 ] ;
awl:text "dual_annealing. - white" ;
awl:where "beside" ] ;
awl:func [ awl:span [ awl:endCol 10 ;
awl:endLine 35 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 35 ] ;
awl:var "plot_point" ] ;
awl:keywordArguments [ awl:color [ awl:literal "w" ;
awl:span [ awl:endCol 35 ;
awl:endLine 35 ;
awl:file "optimize_global.py" ;
awl:startCol 32 ;
awl:startLine 35 ] ] ] ;
awl:order 21 ;
awl:span [ awl:endCol 36 ;
awl:endLine 35 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 35 ] .
<https://w3id.org/awl/py/real.optimize_global/step#21> a awl:Call ;
awl:argument ( [ a awl:Subscript ;
awl:slice [ awl:literal "shgo" ;
awl:span [ awl:endCol 25 ;
awl:endLine 38 ;
awl:file "optimize_global.py" ;
awl:startCol 19 ;
awl:startLine 38 ] ] ;
awl:span [ awl:endCol 26 ;
awl:endLine 38 ;
awl:file "optimize_global.py" ;
awl:startCol 11 ;
awl:startLine 38 ] ;
awl:value [ awl:span [ awl:endCol 18 ;
awl:endLine 38 ;
awl:file "optimize_global.py" ;
awl:startCol 11 ;
awl:startLine 38 ] ;
awl:var "results" ] ] ) ;
awl:comment [ awl:span [ awl:endCol 75 ;
awl:endLine 37 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 37 ] ;
awl:text "SHGO produces multiple minima, plot them all (with a smaller marker size)" ;
awl:where "above" ] ;
awl:func [ awl:span [ awl:endCol 10 ;
awl:endLine 38 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 38 ] ;
awl:var "plot_point" ] ;
awl:keywordArguments [ awl:color [ awl:literal "r" ;
awl:span [ awl:endCol 37 ;
awl:endLine 38 ;
awl:file "optimize_global.py" ;
awl:startCol 34 ;
awl:startLine 38 ] ] ;
awl:marker [ awl:literal "+" ;
awl:span [ awl:endCol 49 ;
awl:endLine 38 ;
awl:file "optimize_global.py" ;
awl:startCol 46 ;
awl:startLine 38 ] ] ] ;
awl:order 22 ;
awl:span [ awl:endCol 50 ;
awl:endLine 38 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 38 ] .
<https://w3id.org/awl/py/real.optimize_global/step#22> a awl:Call ;
awl:argument ( [ a awl:Subscript ;
awl:slice [ awl:literal "shgo_sobol" ;
awl:span [ awl:endCol 31 ;
awl:endLine 39 ;
awl:file "optimize_global.py" ;
awl:startCol 19 ;
awl:startLine 39 ] ] ;
awl:span [ awl:endCol 32 ;
awl:endLine 39 ;
awl:file "optimize_global.py" ;
awl:startCol 11 ;
awl:startLine 39 ] ;
awl:value [ awl:span [ awl:endCol 18 ;
awl:endLine 39 ;
awl:file "optimize_global.py" ;
awl:startCol 11 ;
awl:startLine 39 ] ;
awl:var "results" ] ] ) ;
awl:func [ awl:span [ awl:endCol 10 ;
awl:endLine 39 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 39 ] ;
awl:var "plot_point" ] ;
awl:keywordArguments [ awl:color [ awl:literal "r" ;
awl:span [ awl:endCol 43 ;
awl:endLine 39 ;
awl:file "optimize_global.py" ;
awl:startCol 40 ;
awl:startLine 39 ] ] ;
awl:marker [ awl:literal "x" ;
awl:span [ awl:endCol 55 ;
awl:endLine 39 ;
awl:file "optimize_global.py" ;
awl:startCol 52 ;
awl:startLine 39 ] ] ] ;
awl:order 23 ;
awl:span [ awl:endCol 56 ;
awl:endLine 39 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 39 ] .
<https://w3id.org/awl/py/real.optimize_global/step#23> a awl:For ;
awl:body ( <https://w3id.org/awl/py/real.optimize_global/step#24> ) ;
awl:iter [ a awl:Call ;
awl:argument ( [ a awl:Subscript ;
awl:slice [ awl:literal 0 ;
awl:span [ awl:endCol 47 ;
awl:endLine 40 ;
awl:file "optimize_global.py" ;
awl:startCol 46 ;
awl:startLine 40 ] ] ;
awl:span [ awl:endCol 48 ;
awl:endLine 40 ;
awl:file "optimize_global.py" ;
awl:startCol 15 ;
awl:startLine 40 ] ;
awl:value [ a awl:Attribute ;
awl:attr "shape" ;
awl:span [ awl:endCol 45 ;
awl:endLine 40 ;
awl:file "optimize_global.py" ;
awl:startCol 15 ;
awl:startLine 40 ] ;
awl:value [ a awl:Attribute ;
awl:attr "xl" ;
awl:span [ awl:endCol 39 ;
awl:endLine 40 ;
awl:file "optimize_global.py" ;
awl:startCol 15 ;
awl:startLine 40 ] ;
awl:value [ a awl:Subscript ;
awl:slice [ awl:literal "shgo_sobol" ;
awl:span [ awl:endCol 35 ;
awl:endLine 40 ;
awl:file "optimize_global.py" ;
awl:startCol 23 ;
awl:startLine 40 ] ] ;
awl:span [ awl:endCol 36 ;
awl:endLine 40 ;
awl:file "optimize_global.py" ;
awl:startCol 15 ;
awl:startLine 40 ] ;
awl:value [ awl:span [ awl:endCol 22 ;
awl:endLine 40 ;
awl:file "optimize_global.py" ;
awl:startCol 15 ;
awl:startLine 40 ] ;
awl:var "results" ] ] ] ] ] ) ;
awl:func [ awl:span [ awl:endCol 14 ;
awl:endLine 40 ;
awl:file "optimize_global.py" ;
awl:startCol 9 ;
awl:startLine 40 ] ;
awl:var "range" ] ;
awl:span [ awl:endCol 49 ;
awl:endLine 40 ;
awl:file "optimize_global.py" ;
awl:startCol 9 ;
awl:startLine 40 ] ] ;
awl:order 24 ;
awl:span [ awl:endCol 23 ;
awl:endLine 43 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 40 ] ;
awl:target [ awl:span [ awl:endCol 5 ;
awl:endLine 40 ;
awl:file "optimize_global.py" ;
awl:startCol 4 ;
awl:startLine 40 ] ;
awl:var "i" ] .
<https://w3id.org/awl/py/real.optimize_global/step#24> a awl:Call ;
awl:argument ( [ a awl:BinOp ;
awl:left [ awl:literal 512 ;
awl:span [ awl:endCol 15 ;
awl:endLine 41 ;
awl:file "optimize_global.py" ;
awl:startCol 12 ;
awl:startLine 41 ] ] ;
awl:op "Add" ;
awl:right [ a awl:Subscript ;
awl:slice [ a awl:Tuple ;
awl:elts [ awl:span [ awl:endCol 44 ;
awl:endLine 41 ;
awl:file "optimize_global.py" ;
awl:startCol 43 ;
awl:startLine 41 ] ;
awl:var "i" ],
[ awl:literal 0 ;
awl:span [ awl:endCol 47 ;
awl:endLine 41 ;
awl:file "optimize_global.py" ;
awl:startCol 46 ;
awl:startLine 41 ] ] ;
awl:span [ awl:endCol 47 ;
awl:endLine 41 ;
awl:file "optimize_global.py" ;
awl:startCol 43 ;
awl:startLine 41 ] ] ;
awl:span [ awl:endCol 48 ;
awl:endLine 41 ;
awl:file "optimize_global.py" ;
awl:startCol 18 ;
awl:startLine 41 ] ;
awl:value [ a awl:Attribute ;
awl:attr "xl" ;
awl:span [ awl:endCol 42 ;
awl:endLine 41 ;
awl:file "optimize_global.py" ;
awl:startCol 18 ;
awl:startLine 41 ] ;
awl:value [ a awl:Subscript ;
awl:slice [ awl:literal "shgo_sobol" ;
awl:span [ awl:endCol 38 ;
awl:endLine 41 ;
awl:file "optimize_global.py" ;
awl:startCol 26 ;
awl:startLine 41 ] ] ;
awl:span [ awl:endCol 39 ;
awl:endLine 41 ;
awl:file "optimize_global.py" ;
awl:startCol 18 ;
awl:startLine 41 ] ;
awl:value [ awl:span [ awl:endCol 25 ;
awl:endLine 41 ;
awl:file "optimize_global.py" ;
awl:startCol 18 ;
awl:startLine 41 ] ;
awl:var "results" ] ] ] ] ;
awl:span [ awl:endCol 48 ;
awl:endLine 41 ;
awl:file "optimize_global.py" ;
awl:startCol 12 ;
awl:startLine 41 ] ] [ a awl:BinOp ;
awl:left [ awl:literal 512 ;
awl:span [ awl:endCol 15 ;
awl:endLine 42 ;
awl:file "optimize_global.py" ;
awl:startCol 12 ;
awl:startLine 42 ] ] ;
awl:op "Add" ;
awl:right [ a awl:Subscript ;
awl:slice [ a awl:Tuple ;
awl:elts [ awl:literal 1 ;
awl:span [ awl:endCol 47 ;
awl:endLine 42 ;
awl:file "optimize_global.py" ;
awl:startCol 46 ;
awl:startLine 42 ] ],
[ awl:span [ awl:endCol 44 ;
awl:endLine 42 ;
awl:file "optimize_global.py" ;
awl:startCol 43 ;
awl:startLine 42 ] ;
awl:var "i" ] ;
awl:span [ awl:endCol 47 ;
awl:endLine 42 ;
awl:file "optimize_global.py" ;
awl:startCol 43 ;
awl:startLine 42 ] ] ;
awl:span [ awl:endCol 48 ;
awl:endLine 42 ;
awl:file "optimize_global.py" ;
awl:startCol 18 ;
awl:startLine 42 ] ;
awl:value [ a awl:Attribute ;
awl:attr "xl" ;
awl:span [ awl:endCol 42 ;
awl:endLine 42 ;
awl:file "optimize_global.py" ;
awl:startCol 18 ;
awl:startLine 42 ] ;
awl:value [ a awl:Subscript ;
awl:slice [ awl:literal "shgo_sobol" ;
awl:span [ awl:endCol 38 ;
awl:endLine 42 ;
awl:file "optimize_global.py" ;
awl:startCol 26 ;
awl:startLine 42 ] ] ;
awl:span [ awl:endCol 39 ;
awl:endLine 42 ;
awl:file "optimize_global.py" ;
awl:startCol 18 ;
awl:startLine 42 ] ;
awl:value [ awl:span [ awl:endCol 25 ;
awl:endLine 42 ;
awl:file "optimize_global.py" ;
awl:startCol 18 ;
awl:startLine 42 ] ;
awl:var "results" ] ] ] ] ;
awl:span [ awl:endCol 48 ;
awl:endLine 42 ;
awl:file "optimize_global.py" ;
awl:startCol 12 ;
awl:startLine 42 ] ] [ awl:literal "ro" ;
awl:span [ awl:endCol 16 ;
awl:endLine 43 ;
awl:file "optimize_global.py" ;
awl:startCol 12 ;
awl:startLine 43 ] ] ) ;
awl:func [ a awl:Attribute ;
awl:attr "plot" ;
awl:span [ awl:endCol 11 ;
awl:endLine 41 ;
awl:file "optimize_global.py" ;
awl:startCol 4 ;
awl:startLine 41 ] ;
awl:value [ awl:span [ awl:endCol 6 ;
awl:endLine 41 ;
awl:file "optimize_global.py" ;
awl:startCol 4 ;
awl:startLine 41 ] ;
awl:var "ax" ] ] ;
awl:keywordArguments [ awl:ms [ awl:literal 2 ;
awl:span [ awl:endCol 22 ;
awl:endLine 43 ;
awl:file "optimize_global.py" ;
awl:startCol 21 ;
awl:startLine 43 ] ] ] ;
awl:order 0 ;
awl:span [ awl:endCol 23 ;
awl:endLine 43 ;
awl:file "optimize_global.py" ;
awl:startCol 4 ;
awl:startLine 41 ] .
<https://w3id.org/awl/py/real.optimize_global/step#25> a awl:Call ;
awl:argument ( [ a awl:List ;
awl:elts [ a awl:BinOp ;
awl:left [ awl:literal 514 ;
awl:span [ awl:endCol 20 ;
awl:endLine 45 ;
awl:file "optimize_global.py" ;
awl:startCol 17 ;
awl:startLine 45 ] ] ;
awl:op "Mult" ;
awl:right [ awl:literal 2 ;
awl:span [ awl:endCol 22 ;
awl:endLine 45 ;
awl:file "optimize_global.py" ;
awl:startCol 21 ;
awl:startLine 45 ] ] ;
awl:span [ awl:endCol 22 ;
awl:endLine 45 ;
awl:file "optimize_global.py" ;
awl:startCol 17 ;
awl:startLine 45 ] ],
[ a awl:UnaryOp ;
awl:op "USub" ;
awl:operand [ awl:literal 4 ;
awl:span [ awl:endCol 15 ;
awl:endLine 45 ;
awl:file "optimize_global.py" ;
awl:startCol 14 ;
awl:startLine 45 ] ] ;
awl:span [ awl:endCol 15 ;
awl:endLine 45 ;
awl:file "optimize_global.py" ;
awl:startCol 13 ;
awl:startLine 45 ] ] ;
awl:span [ awl:endCol 23 ;
awl:endLine 45 ;
awl:file "optimize_global.py" ;
awl:startCol 12 ;
awl:startLine 45 ] ] ) ;
awl:func [ a awl:Attribute ;
awl:attr "set_xlim" ;
awl:span [ awl:endCol 11 ;
awl:endLine 45 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 45 ] ;
awl:value [ awl:span [ awl:endCol 2 ;
awl:endLine 45 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 45 ] ;
awl:var "ax" ] ] ;
awl:order 25 ;
awl:span [ awl:endCol 24 ;
awl:endLine 45 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 45 ] .
<https://w3id.org/awl/py/real.optimize_global/step#26> a awl:Call ;
awl:argument ( [ a awl:List ;
awl:elts [ a awl:BinOp ;
awl:left [ awl:literal 514 ;
awl:span [ awl:endCol 20 ;
awl:endLine 46 ;
awl:file "optimize_global.py" ;
awl:startCol 17 ;
awl:startLine 46 ] ] ;
awl:op "Mult" ;
awl:right [ awl:literal 2 ;
awl:span [ awl:endCol 22 ;
awl:endLine 46 ;
awl:file "optimize_global.py" ;
awl:startCol 21 ;
awl:startLine 46 ] ] ;
awl:span [ awl:endCol 22 ;
awl:endLine 46 ;
awl:file "optimize_global.py" ;
awl:startCol 17 ;
awl:startLine 46 ] ],
[ a awl:UnaryOp ;
awl:op "USub" ;
awl:operand [ awl:literal 4 ;
awl:span [ awl:endCol 15 ;
awl:endLine 46 ;
awl:file "optimize_global.py" ;
awl:startCol 14 ;
awl:startLine 46 ] ] ;
awl:span [ awl:endCol 15 ;
awl:endLine 46 ;
awl:file "optimize_global.py" ;
awl:startCol 13 ;
awl:startLine 46 ] ] ;
awl:span [ awl:endCol 23 ;
awl:endLine 46 ;
awl:file "optimize_global.py" ;
awl:startCol 12 ;
awl:startLine 46 ] ] ) ;
awl:func [ a awl:Attribute ;
awl:attr "set_ylim" ;
awl:span [ awl:endCol 11 ;
awl:endLine 46 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 46 ] ;
awl:value [ awl:span [ awl:endCol 2 ;
awl:endLine 46 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 46 ] ;
awl:var "ax" ] ] ;
awl:order 26 ;
awl:span [ awl:endCol 24 ;
awl:endLine 46 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 46 ] .
<https://w3id.org/awl/py/real.optimize_global/step#27> a awl:Call ;
awl:func [ a awl:Attribute ;
awl:attr "tight_layout" ;
awl:span [ awl:endCol 16 ;
awl:endLine 48 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 48 ] ;
awl:value [ awl:span [ awl:endCol 3 ;
awl:endLine 48 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 48 ] ;
awl:var "fig" ] ] ;
awl:order 27 ;
awl:span [ awl:endCol 18 ;
awl:endLine 48 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 48 ] .
<https://w3id.org/awl/py/real.optimize_global/step#28> a awl:Call ;
awl:func [ a awl:Attribute ;
awl:attr "show" ;
awl:span [ awl:endCol 8 ;
awl:endLine 49 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 49 ] ;
awl:value [ awl:span [ awl:endCol 3 ;
awl:endLine 49 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 49 ] ;
awl:var "plt" ] ] ;
awl:order 28 ;
awl:span [ awl:endCol 10 ;
awl:endLine 49 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 49 ] .
<https://w3id.org/awl/py/real.optimize_global/step#3> a awl:ImportFrom ;
awl:level 0 ;
awl:module "scipy" ;
awl:names "optimize" ;
awl:order 2 ;
awl:span [ awl:endCol 26 ;
awl:endLine 3 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 3 ] .
<https://w3id.org/awl/py/real.optimize_global/step#4> a awl:Assign ;
awl:order 4 ;
awl:span [ awl:endCol 35 ;
awl:endLine 10 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 10 ] ;
awl:targets [ awl:span [ awl:endCol 6 ;
awl:endLine 10 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 10 ] ;
awl:var "bounds" ] ;
awl:value [ a awl:List ;
awl:elts [ a awl:Tuple ;
awl:elts [ a awl:UnaryOp ;
awl:op "USub" ;
awl:operand [ awl:literal 512 ;
awl:span [ awl:endCol 15 ;
awl:endLine 10 ;
awl:file "optimize_global.py" ;
awl:startCol 12 ;
awl:startLine 10 ] ] ;
awl:span [ awl:endCol 15 ;
awl:endLine 10 ;
awl:file "optimize_global.py" ;
awl:startCol 11 ;
awl:startLine 10 ] ],
[ awl:literal 512 ;
awl:span [ awl:endCol 20 ;
awl:endLine 10 ;
awl:file "optimize_global.py" ;
awl:startCol 17 ;
awl:startLine 10 ] ] ;
awl:span [ awl:endCol 21 ;
awl:endLine 10 ;
awl:file "optimize_global.py" ;
awl:startCol 10 ;
awl:startLine 10 ] ],
[ a awl:Tuple ;
awl:elts [ a awl:UnaryOp ;
awl:op "USub" ;
awl:operand [ awl:literal 512 ;
awl:span [ awl:endCol 28 ;
awl:endLine 10 ;
awl:file "optimize_global.py" ;
awl:startCol 25 ;
awl:startLine 10 ] ] ;
awl:span [ awl:endCol 28 ;
awl:endLine 10 ;
awl:file "optimize_global.py" ;
awl:startCol 24 ;
awl:startLine 10 ] ],
[ awl:literal 512 ;
awl:span [ awl:endCol 33 ;
awl:endLine 10 ;
awl:file "optimize_global.py" ;
awl:startCol 30 ;
awl:startLine 10 ] ] ;
awl:span [ awl:endCol 34 ;
awl:endLine 10 ;
awl:file "optimize_global.py" ;
awl:startCol 23 ;
awl:startLine 10 ] ] ;
awl:span [ awl:endCol 35 ;
awl:endLine 10 ;
awl:file "optimize_global.py" ;
awl:startCol 9 ;
awl:startLine 10 ] ] .
<https://w3id.org/awl/py/real.optimize_global/step#5> a awl:Assign ;
awl:order 5 ;
awl:span [ awl:endCol 24 ;
awl:endLine 12 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 12 ] ;
awl:targets [ awl:span [ awl:endCol 1 ;
awl:endLine 12 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 12 ] ;
awl:var "x" ] ;
awl:value [ a awl:Call ;
awl:argument ( [ a awl:UnaryOp ;
awl:op "USub" ;
awl:operand [ awl:literal 512 ;
awl:span [ awl:endCol 18 ;
awl:endLine 12 ;
awl:file "optimize_global.py" ;
awl:startCol 15 ;
awl:startLine 12 ] ] ;
awl:span [ awl:endCol 18 ;
awl:endLine 12 ;
awl:file "optimize_global.py" ;
awl:startCol 14 ;
awl:startLine 12 ] ] [ awl:literal 513 ;
awl:span [ awl:endCol 23 ;
awl:endLine 12 ;
awl:file "optimize_global.py" ;
awl:startCol 20 ;
awl:startLine 12 ] ] ) ;
awl:func [ a awl:Attribute ;
awl:attr "arange" ;
awl:span [ awl:endCol 13 ;
awl:endLine 12 ;
awl:file "optimize_global.py" ;
awl:startCol 4 ;
awl:startLine 12 ] ;
awl:value [ awl:span [ awl:endCol 6 ;
awl:endLine 12 ;
awl:file "optimize_global.py" ;
awl:startCol 4 ;
awl:startLine 12 ] ;
awl:var "np" ] ] ;
awl:span [ awl:endCol 24 ;
awl:endLine 12 ;
awl:file "optimize_global.py" ;
awl:startCol 4 ;
awl:startLine 12 ] ] .
<https://w3id.org/awl/py/real.optimize_global/step#6> a awl:Assign ;
awl:order 6 ;
awl:span [ awl:endCol 24 ;
awl:endLine 13 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 13 ] ;
awl:targets [ awl:span [ awl:endCol 1 ;
awl:endLine 13 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 13 ] ;
awl:var "y" ] ;
awl:value [ a awl:Call ;
awl:argument ( [ a awl:UnaryOp ;
awl:op "USub" ;
awl:operand [ awl:literal 512 ;
awl:span [ awl:endCol 18 ;
awl:endLine 13 ;
awl:file "optimize_global.py" ;
awl:startCol 15 ;
awl:startLine 13 ] ] ;
awl:span [ awl:endCol 18 ;
awl:endLine 13 ;
awl:file "optimize_global.py" ;
awl:startCol 14 ;
awl:startLine 13 ] ] [ awl:literal 513 ;
awl:span [ awl:endCol 23 ;
awl:endLine 13 ;
awl:file "optimize_global.py" ;
awl:startCol 20 ;
awl:startLine 13 ] ] ) ;
awl:func [ a awl:Attribute ;
awl:attr "arange" ;
awl:span [ awl:endCol 13 ;
awl:endLine 13 ;
awl:file "optimize_global.py" ;
awl:startCol 4 ;
awl:startLine 13 ] ;
awl:value [ awl:span [ awl:endCol 6 ;
awl:endLine 13 ;
awl:file "optimize_global.py" ;
awl:startCol 4 ;
awl:startLine 13 ] ;
awl:var "np" ] ] ;
awl:span [ awl:endCol 24 ;
awl:endLine 13 ;
awl:file "optimize_global.py" ;
awl:startCol 4 ;
awl:startLine 13 ] ] .
<https://w3id.org/awl/py/real.optimize_global/step#7> a awl:Assign ;
awl:order 7 ;
awl:span [ awl:endCol 32 ;
awl:endLine 14 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 14 ] ;
awl:targets [ a awl:Tuple ;
awl:elts [ awl:span [ awl:endCol 12 ;
awl:endLine 14 ;
awl:file "optimize_global.py" ;
awl:startCol 7 ;
awl:startLine 14 ] ;
awl:var "ygrid" ],
[ awl:span [ awl:endCol 5 ;
awl:endLine 14 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 14 ] ;
awl:var "xgrid" ] ;
awl:span [ awl:endCol 12 ;
awl:endLine 14 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 14 ] ] ;
awl:value [ a awl:Call ;
awl:argument ( [ awl:span [ awl:endCol 28 ;
awl:endLine 14 ;
awl:file "optimize_global.py" ;
awl:startCol 27 ;
awl:startLine 14 ] ;
awl:var "x" ] [ awl:span [ awl:endCol 31 ;
awl:endLine 14 ;
awl:file "optimize_global.py" ;
awl:startCol 30 ;
awl:startLine 14 ] ;
awl:var "y" ] ) ;
awl:func [ a awl:Attribute ;
awl:attr "meshgrid" ;
awl:span [ awl:endCol 26 ;
awl:endLine 14 ;
awl:file "optimize_global.py" ;
awl:startCol 15 ;
awl:startLine 14 ] ;
awl:value [ awl:span [ awl:endCol 17 ;
awl:endLine 14 ;
awl:file "optimize_global.py" ;
awl:startCol 15 ;
awl:startLine 14 ] ;
awl:var "np" ] ] ;
awl:span [ awl:endCol 32 ;
awl:endLine 14 ;
awl:file "optimize_global.py" ;
awl:startCol 15 ;
awl:startLine 14 ] ] .
<https://w3id.org/awl/py/real.optimize_global/step#8> a awl:Assign ;
awl:order 8 ;
awl:span [ awl:endCol 29 ;
awl:endLine 15 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 15 ] ;
awl:targets [ awl:span [ awl:endCol 2 ;
awl:endLine 15 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 15 ] ;
awl:var "xy" ] ;
awl:value [ a awl:Call ;
awl:argument ( [ a awl:List ;
awl:elts [ awl:span [ awl:endCol 27 ;
awl:endLine 15 ;
awl:file "optimize_global.py" ;
awl:startCol 22 ;
awl:startLine 15 ] ;
awl:var "ygrid" ],
[ awl:span [ awl:endCol 20 ;
awl:endLine 15 ;
awl:file "optimize_global.py" ;
awl:startCol 15 ;
awl:startLine 15 ] ;
awl:var "xgrid" ] ;
awl:span [ awl:endCol 28 ;
awl:endLine 15 ;
awl:file "optimize_global.py" ;
awl:startCol 14 ;
awl:startLine 15 ] ] ) ;
awl:func [ a awl:Attribute ;
awl:attr "stack" ;
awl:span [ awl:endCol 13 ;
awl:endLine 15 ;
awl:file "optimize_global.py" ;
awl:startCol 5 ;
awl:startLine 15 ] ;
awl:value [ awl:span [ awl:endCol 7 ;
awl:endLine 15 ;
awl:file "optimize_global.py" ;
awl:startCol 5 ;
awl:startLine 15 ] ;
awl:var "np" ] ] ;
awl:span [ awl:endCol 29 ;
awl:endLine 15 ;
awl:file "optimize_global.py" ;
awl:startCol 5 ;
awl:startLine 15 ] ] .
<https://w3id.org/awl/py/real.optimize_global/step#9> a awl:Assign ;
awl:order 9 ;
awl:span [ awl:endCol 16 ;
awl:endLine 17 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 17 ] ;
awl:targets [ awl:span [ awl:endCol 7 ;
awl:endLine 17 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 17 ] ;
awl:var "results" ] ;
awl:value [ a awl:Call ;
awl:func [ awl:span [ awl:endCol 14 ;
awl:endLine 17 ;
awl:file "optimize_global.py" ;
awl:startCol 10 ;
awl:startLine 17 ] ;
awl:var "dict" ] ;
awl:span [ awl:endCol 16 ;
awl:endLine 17 ;
awl:file "optimize_global.py" ;
awl:startCol 10 ;
awl:startLine 17 ] ] .
[] a awl:Module ;
awl:body ( <https://w3id.org/awl/py/real.optimize_global/step#1> <https://w3id.org/awl/py/real.optimize_global/step#2> <https://w3id.org/awl/py/real.optimize_global/step#3> [ a awl:FunctionDef ;
awl:args "x" ;
awl:body ( <https://w3id.org/awl/py/real.optimize_global/eggholder.step#29> ) ;
awl:name "eggholder" ;
awl:order 3 ;
awl:span [ awl:endCol 62 ;
awl:endLine 8 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 6 ] ] <https://w3id.org/awl/py/real.optimize_global/step#4> <https://w3id.org/awl/py/real.optimize_global/step#5> <https://w3id.org/awl/py/real.optimize_global/step#6> <https://w3id.org/awl/py/real.optimize_global/step#7> <https://w3id.org/awl/py/real.optimize_global/step#8> <https://w3id.org/awl/py/real.optimize_global/step#9> <https://w3id.org/awl/py/real.optimize_global/step#10> <https://w3id.org/awl/py/real.optimize_global/step#11> <https://w3id.org/awl/py/real.optimize_global/step#12> <https://w3id.org/awl/py/real.optimize_global/step#13> <https://w3id.org/awl/py/real.optimize_global/step#14> <https://w3id.org/awl/py/real.optimize_global/step#15> <https://w3id.org/awl/py/real.optimize_global/step#16> <https://w3id.org/awl/py/real.optimize_global/step#17> <https://w3id.org/awl/py/real.optimize_global/step#18> [ a awl:FunctionDef ;
awl:args "color",
"marker",
"res" ;
awl:body ( <https://w3id.org/awl/py/real.optimize_global/plot_point.step#30> ) ;
awl:defaults [ awl:span [ awl:endCol 42 ;
awl:endLine 31 ;
awl:file "optimize_global.py" ;
awl:startCol 38 ;
awl:startLine 31 ] ],
[ awl:literal "o" ;
awl:span [ awl:endCol 30 ;
awl:endLine 31 ;
awl:file "optimize_global.py" ;
awl:startCol 27 ;
awl:startLine 31 ] ] ;
awl:name "plot_point" ;
awl:order 19 ;
awl:span [ awl:endCol 74 ;
awl:endLine 32 ;
awl:file "optimize_global.py" ;
awl:startCol 0 ;
awl:startLine 31 ] ] <https://w3id.org/awl/py/real.optimize_global/step#19> <https://w3id.org/awl/py/real.optimize_global/step#20> <https://w3id.org/awl/py/real.optimize_global/step#21> <https://w3id.org/awl/py/real.optimize_global/step#22> <https://w3id.org/awl/py/real.optimize_global/step#23> <https://w3id.org/awl/py/real.optimize_global/step#25> <https://w3id.org/awl/py/real.optimize_global/step#26> <https://w3id.org/awl/py/real.optimize_global/step#27> <https://w3id.org/awl/py/real.optimize_global/step#28> ) .
real/tensile_test.py¶
"""Real-world example: tensile test analysis with stress-strain curve fitting."""
from typing import List, Optional
from scipy.stats import linregress
from opensemantic import OswBaseModel
from opensemantic.characteristics.quantitative import (
Area,
Force,
ForcePerAreaUnit,
ForceUnit,
Length,
LengthUnit,
LinearStrain,
ModulusOfElasticity,
Stress,
TabularData,
Thickness,
Width,
)
# Define the data model
class TensileTestSpecimen(OswBaseModel):
length: Length
width: Width
thickness: Length
cross_section_area: Optional[Area] = None
e_mod: Optional[ModulusOfElasticity] = None
class TensileTestResultRow(OswBaseModel):
elongation: Length
force: Force
strain: Optional[LinearStrain] = None
stress: Optional[Stress] = None
class TensileTestResult(TabularData):
rows: List[TensileTestResultRow]
linear_region: Optional[LinearStrain] = LinearStrain(value=0.002)
class TensileTestDataset(OswBaseModel):
specimen: TensileTestSpecimen
result: TensileTestResult
def tensile_test_analysis(dataset: TensileTestDataset) -> TensileTestDataset:
"""Compute stress, strain, and modulus of elasticity from raw test data."""
# Cross section area
if dataset.specimen.cross_section_area is None:
dataset.specimen.cross_section_area = (
dataset.specimen.width * dataset.specimen.thickness
)
# Vectorized stress/strain via pint-pandas
df = dataset.result.to_df()
df["strain"] = df["elongation"] / dataset.specimen.length.to_pint()
df["stress"] = df["force"] / dataset.specimen.cross_section_area.to_pint()
# Linear regression on the elastic region
linear = df[df["strain"] <= dataset.result.linear_region.to_pint()]
slope, *_ = linregress(
linear["strain"].pint.to_base_units().pint.magnitude,
linear["stress"].pint.to_base_units().pint.magnitude,
)
slope = (
slope
* linear["stress"].pint.to_base_units().pint.units
/ linear["strain"].pint.to_base_units().pint.units
)
dataset.specimen.e_mod = ModulusOfElasticity.from_pint(slope.to("Pa"))
dataset.result = TensileTestResult.from_df(df)
return dataset
# Sample data
specimen = TensileTestSpecimen(
length=Length(value=100, unit=LengthUnit.milli_meter),
width=Width(value=10, unit=LengthUnit.milli_meter),
thickness=Thickness(value=10, unit=LengthUnit.milli_meter),
)
result = TensileTestResult(
rows=[
TensileTestResultRow(
force=Force(value=1.0, unit=ForceUnit.kilo_newton),
elongation=Length(value=0.10, unit=LengthUnit.milli_meter),
),
TensileTestResultRow(
force=Force(value=1.505, unit=ForceUnit.kilo_newton),
elongation=Length(value=0.15, unit=LengthUnit.milli_meter),
),
TensileTestResultRow(
force=Force(value=2.0, unit=ForceUnit.kilo_newton),
elongation=Length(value=0.20, unit=LengthUnit.milli_meter),
),
]
)
dataset = TensileTestDataset(specimen=specimen, result=result)
analyzed = tensile_test_analysis(dataset)
print(
f"Cross section area: {analyzed.specimen.cross_section_area.value} "
f"{analyzed.specimen.cross_section_area.unit.name}"
)
print(
f"Modulus of elasticity: {analyzed.specimen.e_mod.value} "
f"{analyzed.specimen.e_mod.unit.name}"
)
assert analyzed.specimen.e_mod == ModulusOfElasticity(
value=10.0, unit=ForcePerAreaUnit.giga_pascal
)
print("E = 10 GPa (as expected for this sample)")
{
"@type": "Module",
"body": [
{"literal": "Real-world example: tensile test analysis with stress-strain curve fitting."},
{"@type": "ImportFrom", "module": "typing", "names": ["List", "Optional"], "level": 0},
{"@type": "ImportFrom", "module": "scipy.stats", "names": ["linregress"], "level": 0},
{"@type": "ImportFrom", "module": "opensemantic", "names": ["OswBaseModel"], "level": 0},
{
"@type": "ImportFrom",
"module": "opensemantic.characteristics.quantitative",
"names": [
"Area",
"Force",
"ForcePerAreaUnit",
"ForceUnit",
"Length",
"LengthUnit",
"LinearStrain",
"ModulusOfElasticity",
"Stress",
"TabularData",
"Thickness",
"Width"
],
"level": 0
},
{
"@type": "ClassDef",
"name": "TensileTestSpecimen",
"bases": [{"var": "OswBaseModel"}],
"body": [
{"@type": "AnnAssign", "target": {"var": "length"}, "annotation": {"var": "Length"}, "simple": 1},
{"@type": "AnnAssign", "target": {"var": "width"}, "annotation": {"var": "Width"}, "simple": 1},
{"@type": "AnnAssign", "target": {"var": "thickness"}, "annotation": {"var": "Length"}, "simple": 1},
{
"@type": "AnnAssign",
"target": {"var": "cross_section_area"},
"annotation": {"@type": "Subscript", "value": {"var": "Optional"}, "slice": {"var": "Area"}},
"value": {"literal": null},
"simple": 1
},
{
"@type": "AnnAssign",
"target": {"var": "e_mod"},
"annotation": {"@type": "Subscript", "value": {"var": "Optional"}, "slice": {"var": "ModulusOfElasticity"}},
"value": {"literal": null},
"simple": 1
}
]
},
{
"@type": "ClassDef",
"name": "TensileTestResultRow",
"bases": [{"var": "OswBaseModel"}],
"body": [
{"@type": "AnnAssign", "target": {"var": "elongation"}, "annotation": {"var": "Length"}, "simple": 1},
{"@type": "AnnAssign", "target": {"var": "force"}, "annotation": {"var": "Force"}, "simple": 1},
{
"@type": "AnnAssign",
"target": {"var": "strain"},
"annotation": {"@type": "Subscript", "value": {"var": "Optional"}, "slice": {"var": "LinearStrain"}},
"value": {"literal": null},
"simple": 1
},
{
"@type": "AnnAssign",
"target": {"var": "stress"},
"annotation": {"@type": "Subscript", "value": {"var": "Optional"}, "slice": {"var": "Stress"}},
"value": {"literal": null},
"simple": 1
}
]
},
{
"@type": "ClassDef",
"name": "TensileTestResult",
"bases": [{"var": "TabularData"}],
"body": [
{
"@type": "AnnAssign",
"target": {"var": "rows"},
"annotation": {"@type": "Subscript", "value": {"var": "List"}, "slice": {"var": "TensileTestResultRow"}},
"simple": 1
},
{
"@type": "AnnAssign",
"target": {"var": "linear_region"},
"annotation": {"@type": "Subscript", "value": {"var": "Optional"}, "slice": {"var": "LinearStrain"}},
"value": {"@type": "Call", "func": {"var": "LinearStrain"}, "keyword_arguments": {"value": {"literal": 0.002}}},
"simple": 1
}
]
},
{
"@type": "ClassDef",
"name": "TensileTestDataset",
"bases": [{"var": "OswBaseModel"}],
"body": [
{"@type": "AnnAssign", "target": {"var": "specimen"}, "annotation": {"var": "TensileTestSpecimen"}, "simple": 1},
{"@type": "AnnAssign", "target": {"var": "result"}, "annotation": {"var": "TensileTestResult"}, "simple": 1}
]
},
{
"@type": "FunctionDef",
"name": "tensile_test_analysis",
"args": [{"arg": "dataset", "annotation": {"var": "TensileTestDataset"}}],
"body": [
{"literal": "Compute stress, strain, and modulus of elasticity from raw test data."},
{
"@type": "If",
"test": {
"@type": "Compare",
"left": {
"@type": "Attribute",
"value": {"@type": "Attribute", "value": {"var": "dataset"}, "attr": "specimen"},
"attr": "cross_section_area"
},
"ops": ["Is"],
"comparators": [{"literal": null}]
},
"body": [
{
"@type": "Assign",
"targets": [
{
"@type": "Attribute",
"value": {"@type": "Attribute", "value": {"var": "dataset"}, "attr": "specimen"},
"attr": "cross_section_area"
}
],
"value": {
"@type": "BinOp",
"left": {
"@type": "Attribute",
"value": {"@type": "Attribute", "value": {"var": "dataset"}, "attr": "specimen"},
"attr": "width"
},
"op": "Mult",
"right": {
"@type": "Attribute",
"value": {"@type": "Attribute", "value": {"var": "dataset"}, "attr": "specimen"},
"attr": "thickness"
}
}
}
]
},
{
"@type": "Assign",
"targets": [{"var": "df"}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"@type": "Attribute", "value": {"var": "dataset"}, "attr": "result"}, "attr": "to_df"}
}
},
{
"@type": "Assign",
"targets": [{"@type": "Subscript", "value": {"var": "df"}, "slice": {"literal": "strain"}}],
"value": {
"@type": "BinOp",
"left": {"@type": "Subscript", "value": {"var": "df"}, "slice": {"literal": "elongation"}},
"op": "Div",
"right": {
"@type": "Call",
"func": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {"@type": "Attribute", "value": {"var": "dataset"}, "attr": "specimen"},
"attr": "length"
},
"attr": "to_pint"
}
}
}
},
{
"@type": "Assign",
"targets": [{"@type": "Subscript", "value": {"var": "df"}, "slice": {"literal": "stress"}}],
"value": {
"@type": "BinOp",
"left": {"@type": "Subscript", "value": {"var": "df"}, "slice": {"literal": "force"}},
"op": "Div",
"right": {
"@type": "Call",
"func": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {"@type": "Attribute", "value": {"var": "dataset"}, "attr": "specimen"},
"attr": "cross_section_area"
},
"attr": "to_pint"
}
}
}
},
{
"@type": "Assign",
"targets": [{"var": "linear"}],
"value": {
"@type": "Subscript",
"value": {"var": "df"},
"slice": {
"@type": "Compare",
"left": {"@type": "Subscript", "value": {"var": "df"}, "slice": {"literal": "strain"}},
"ops": ["LtE"],
"comparators": [
{
"@type": "Call",
"func": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {"@type": "Attribute", "value": {"var": "dataset"}, "attr": "result"},
"attr": "linear_region"
},
"attr": "to_pint"
}
}
]
}
}
},
{
"@type": "Assign",
"targets": [{"@type": "Tuple", "elts": [{"var": "slope"}, {"@type": "Starred", "value": {"var": "_"}}]}],
"value": {
"@type": "Call",
"func": {"var": "linregress"},
"args": [
{
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {
"@type": "Call",
"func": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {"@type": "Subscript", "value": {"var": "linear"}, "slice": {"literal": "strain"}},
"attr": "pint"
},
"attr": "to_base_units"
}
},
"attr": "pint"
},
"attr": "magnitude"
},
{
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {
"@type": "Call",
"func": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {"@type": "Subscript", "value": {"var": "linear"}, "slice": {"literal": "stress"}},
"attr": "pint"
},
"attr": "to_base_units"
}
},
"attr": "pint"
},
"attr": "magnitude"
}
]
}
},
{
"@type": "Assign",
"targets": [{"var": "slope"}],
"value": {
"@type": "BinOp",
"left": {
"@type": "BinOp",
"left": {"var": "slope"},
"op": "Mult",
"right": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {
"@type": "Call",
"func": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {"@type": "Subscript", "value": {"var": "linear"}, "slice": {"literal": "stress"}},
"attr": "pint"
},
"attr": "to_base_units"
}
},
"attr": "pint"
},
"attr": "units"
}
},
"op": "Div",
"right": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {
"@type": "Call",
"func": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {"@type": "Subscript", "value": {"var": "linear"}, "slice": {"literal": "strain"}},
"attr": "pint"
},
"attr": "to_base_units"
}
},
"attr": "pint"
},
"attr": "units"
}
}
},
{
"@type": "Assign",
"targets": [{"@type": "Attribute", "value": {"@type": "Attribute", "value": {"var": "dataset"}, "attr": "specimen"}, "attr": "e_mod"}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "ModulusOfElasticity"}, "attr": "from_pint"},
"args": [{"@type": "Call", "func": {"@type": "Attribute", "value": {"var": "slope"}, "attr": "to"}, "args": [{"literal": "Pa"}]}]
}
},
{
"@type": "Assign",
"targets": [{"@type": "Attribute", "value": {"var": "dataset"}, "attr": "result"}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "TensileTestResult"}, "attr": "from_df"},
"args": [{"var": "df"}]
}
},
{"@type": "Return", "value": {"var": "dataset"}}
],
"returns": {"var": "TensileTestDataset"}
},
{
"@type": "Assign",
"targets": [{"var": "specimen"}],
"value": {
"@type": ["TensileTestSpecimen"],
"length": {
"@type": "Call",
"func": {"var": "Length"},
"keyword_arguments": {"value": {"literal": 100}, "unit": {"@type": "Attribute", "value": {"var": "LengthUnit"}, "attr": "milli_meter"}}
},
"width": {
"@type": "Call",
"func": {"var": "Width"},
"keyword_arguments": {"value": {"literal": 10}, "unit": {"@type": "Attribute", "value": {"var": "LengthUnit"}, "attr": "milli_meter"}}
},
"thickness": {
"@type": "Call",
"func": {"var": "Thickness"},
"keyword_arguments": {"value": {"literal": 10}, "unit": {"@type": "Attribute", "value": {"var": "LengthUnit"}, "attr": "milli_meter"}}
}
}
},
{
"@type": "Assign",
"targets": [{"var": "result"}],
"value": {
"@type": ["TensileTestResult"],
"rows": {
"@type": "List",
"elts": [
{
"@type": ["TensileTestResultRow"],
"force": {
"@type": "Call",
"func": {"var": "Force"},
"keyword_arguments": {"value": {"literal": 1.0}, "unit": {"@type": "Attribute", "value": {"var": "ForceUnit"}, "attr": "kilo_newton"}}
},
"elongation": {
"@type": "Call",
"func": {"var": "Length"},
"keyword_arguments": {"value": {"literal": 0.1}, "unit": {"@type": "Attribute", "value": {"var": "LengthUnit"}, "attr": "milli_meter"}}
}
},
{
"@type": ["TensileTestResultRow"],
"force": {
"@type": "Call",
"func": {"var": "Force"},
"keyword_arguments": {"value": {"literal": 1.505}, "unit": {"@type": "Attribute", "value": {"var": "ForceUnit"}, "attr": "kilo_newton"}}
},
"elongation": {
"@type": "Call",
"func": {"var": "Length"},
"keyword_arguments": {"value": {"literal": 0.15}, "unit": {"@type": "Attribute", "value": {"var": "LengthUnit"}, "attr": "milli_meter"}}
}
},
{
"@type": ["TensileTestResultRow"],
"force": {
"@type": "Call",
"func": {"var": "Force"},
"keyword_arguments": {"value": {"literal": 2.0}, "unit": {"@type": "Attribute", "value": {"var": "ForceUnit"}, "attr": "kilo_newton"}}
},
"elongation": {
"@type": "Call",
"func": {"var": "Length"},
"keyword_arguments": {"value": {"literal": 0.2}, "unit": {"@type": "Attribute", "value": {"var": "LengthUnit"}, "attr": "milli_meter"}}
}
}
]
}
}
},
{
"@type": "Assign",
"targets": [{"var": "dataset"}],
"value": {"@type": ["TensileTestDataset"], "specimen": {"var": "specimen"}, "result": {"var": "result"}}
},
{
"@type": "Assign",
"targets": [{"var": "analyzed"}],
"value": {"@type": "Call", "func": {"var": "tensile_test_analysis"}, "args": [{"var": "dataset"}]}
},
{
"@type": "Call",
"func": {"var": "print"},
"args": [
{
"@type": "JoinedStr",
"values": [
{"literal": "Cross section area: "},
{
"@type": "FormattedValue",
"value": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {"@type": "Attribute", "value": {"var": "analyzed"}, "attr": "specimen"},
"attr": "cross_section_area"
},
"attr": "value"
},
"conversion": -1
},
{"literal": " "},
{
"@type": "FormattedValue",
"value": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {"@type": "Attribute", "value": {"var": "analyzed"}, "attr": "specimen"},
"attr": "cross_section_area"
},
"attr": "unit"
},
"attr": "name"
},
"conversion": -1
}
]
}
]
},
{
"@type": "Call",
"func": {"var": "print"},
"args": [
{
"@type": "JoinedStr",
"values": [
{"literal": "Modulus of elasticity: "},
{
"@type": "FormattedValue",
"value": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {"@type": "Attribute", "value": {"var": "analyzed"}, "attr": "specimen"},
"attr": "e_mod"
},
"attr": "value"
},
"conversion": -1
},
{"literal": " "},
{
"@type": "FormattedValue",
"value": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {"@type": "Attribute", "value": {"var": "analyzed"}, "attr": "specimen"},
"attr": "e_mod"
},
"attr": "unit"
},
"attr": "name"
},
"conversion": -1
}
]
}
]
},
{
"@type": "Assert",
"test": {
"@type": "Compare",
"left": {"@type": "Attribute", "value": {"@type": "Attribute", "value": {"var": "analyzed"}, "attr": "specimen"}, "attr": "e_mod"},
"ops": ["Eq"],
"comparators": [
{
"@type": "Call",
"func": {"var": "ModulusOfElasticity"},
"keyword_arguments": {"value": {"literal": 10.0}, "unit": {"@type": "Attribute", "value": {"var": "ForcePerAreaUnit"}, "attr": "giga_pascal"}}
}
]
}
},
{"@type": "Call", "func": {"var": "print"}, "args": [{"literal": "E = 10 GPa (as expected for this sample)"}]}
]
}
{
"@type": "Module",
"body": [
{"literal": "Real-world example: tensile test analysis with stress-strain curve fitting."},
{"@type": "ImportFrom", "module": "typing", "names": ["List", "Optional"], "level": 0},
{"@type": "ImportFrom", "module": "scipy.stats", "names": ["linregress"], "level": 0},
{"@type": "ImportFrom", "module": "opensemantic", "names": ["OswBaseModel"], "level": 0},
{
"@type": "ImportFrom",
"module": "opensemantic.characteristics.quantitative",
"names": [
"Area",
"Force",
"ForcePerAreaUnit",
"ForceUnit",
"Length",
"LengthUnit",
"LinearStrain",
"ModulusOfElasticity",
"Stress",
"TabularData",
"Thickness",
"Width"
],
"level": 0
},
{
"@type": "ClassDef",
"name": "TensileTestSpecimen",
"bases": [{"var": "OswBaseModel"}],
"body": [
{"@type": "AnnAssign", "target": {"var": "length"}, "annotation": {"var": "Length"}, "simple": 1},
{"@type": "AnnAssign", "target": {"var": "width"}, "annotation": {"var": "Width"}, "simple": 1},
{"@type": "AnnAssign", "target": {"var": "thickness"}, "annotation": {"var": "Length"}, "simple": 1},
{
"@type": "AnnAssign",
"target": {"var": "cross_section_area"},
"annotation": {"@type": "Subscript", "value": {"var": "Optional"}, "slice": {"var": "Area"}},
"value": {"literal": null},
"simple": 1
},
{
"@type": "AnnAssign",
"target": {"var": "e_mod"},
"annotation": {"@type": "Subscript", "value": {"var": "Optional"}, "slice": {"var": "ModulusOfElasticity"}},
"value": {"literal": null},
"simple": 1
}
]
},
{
"@type": "ClassDef",
"name": "TensileTestResultRow",
"bases": [{"var": "OswBaseModel"}],
"body": [
{"@type": "AnnAssign", "target": {"var": "elongation"}, "annotation": {"var": "Length"}, "simple": 1},
{"@type": "AnnAssign", "target": {"var": "force"}, "annotation": {"var": "Force"}, "simple": 1},
{
"@type": "AnnAssign",
"target": {"var": "strain"},
"annotation": {"@type": "Subscript", "value": {"var": "Optional"}, "slice": {"var": "LinearStrain"}},
"value": {"literal": null},
"simple": 1
},
{
"@type": "AnnAssign",
"target": {"var": "stress"},
"annotation": {"@type": "Subscript", "value": {"var": "Optional"}, "slice": {"var": "Stress"}},
"value": {"literal": null},
"simple": 1
}
]
},
{
"@type": "ClassDef",
"name": "TensileTestResult",
"bases": [{"var": "TabularData"}],
"body": [
{
"@type": "AnnAssign",
"target": {"var": "rows"},
"annotation": {"@type": "Subscript", "value": {"var": "List"}, "slice": {"var": "TensileTestResultRow"}},
"simple": 1
},
{
"@type": "AnnAssign",
"target": {"var": "linear_region"},
"annotation": {"@type": "Subscript", "value": {"var": "Optional"}, "slice": {"var": "LinearStrain"}},
"value": {"@type": "Call", "func": {"var": "LinearStrain"}, "keyword_arguments": {"value": {"literal": 0.002}}},
"simple": 1
}
]
},
{
"@type": "ClassDef",
"name": "TensileTestDataset",
"bases": [{"var": "OswBaseModel"}],
"body": [
{"@type": "AnnAssign", "target": {"var": "specimen"}, "annotation": {"var": "TensileTestSpecimen"}, "simple": 1},
{"@type": "AnnAssign", "target": {"var": "result"}, "annotation": {"var": "TensileTestResult"}, "simple": 1}
]
},
{
"@type": "FunctionDef",
"name": "tensile_test_analysis",
"args": [{"arg": "dataset", "annotation": {"var": "TensileTestDataset"}}],
"body": [
{"literal": "Compute stress, strain, and modulus of elasticity from raw test data."},
{
"@type": "If",
"test": {
"@type": "Compare",
"left": {
"@type": "Attribute",
"value": {"@type": "Attribute", "value": {"var": "dataset"}, "attr": "specimen"},
"attr": "cross_section_area"
},
"ops": ["Is"],
"comparators": [{"literal": null}]
},
"body": [
{
"@type": "Assign",
"targets": [
{
"@type": "Attribute",
"value": {"@type": "Attribute", "value": {"var": "dataset"}, "attr": "specimen"},
"attr": "cross_section_area"
}
],
"value": {
"@type": "BinOp",
"left": {
"@type": "Attribute",
"value": {"@type": "Attribute", "value": {"var": "dataset"}, "attr": "specimen"},
"attr": "width"
},
"op": "Mult",
"right": {
"@type": "Attribute",
"value": {"@type": "Attribute", "value": {"var": "dataset"}, "attr": "specimen"},
"attr": "thickness"
}
}
}
]
},
{
"@type": "Assign",
"targets": [{"var": "df"}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"@type": "Attribute", "value": {"var": "dataset"}, "attr": "result"}, "attr": "to_df"}
}
},
{
"@type": "Assign",
"targets": [{"@type": "Subscript", "value": {"var": "df"}, "slice": {"literal": "strain"}}],
"value": {
"@type": "BinOp",
"left": {"@type": "Subscript", "value": {"var": "df"}, "slice": {"literal": "elongation"}},
"op": "Div",
"right": {
"@type": "Call",
"func": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {"@type": "Attribute", "value": {"var": "dataset"}, "attr": "specimen"},
"attr": "length"
},
"attr": "to_pint"
}
}
}
},
{
"@type": "Assign",
"targets": [{"@type": "Subscript", "value": {"var": "df"}, "slice": {"literal": "stress"}}],
"value": {
"@type": "BinOp",
"left": {"@type": "Subscript", "value": {"var": "df"}, "slice": {"literal": "force"}},
"op": "Div",
"right": {
"@type": "Call",
"func": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {"@type": "Attribute", "value": {"var": "dataset"}, "attr": "specimen"},
"attr": "cross_section_area"
},
"attr": "to_pint"
}
}
}
},
{
"@type": "Assign",
"targets": [{"var": "linear"}],
"value": {
"@type": "Subscript",
"value": {"var": "df"},
"slice": {
"@type": "Compare",
"left": {"@type": "Subscript", "value": {"var": "df"}, "slice": {"literal": "strain"}},
"ops": ["LtE"],
"comparators": [
{
"@type": "Call",
"func": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {"@type": "Attribute", "value": {"var": "dataset"}, "attr": "result"},
"attr": "linear_region"
},
"attr": "to_pint"
}
}
]
}
}
},
{
"@type": "Assign",
"targets": [{"@type": "Tuple", "elts": [{"var": "slope"}, {"@type": "Starred", "value": {"var": "_"}}]}],
"value": {
"@type": "Call",
"func": {"var": "linregress"},
"args": [
{
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {
"@type": "Call",
"func": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {"@type": "Subscript", "value": {"var": "linear"}, "slice": {"literal": "strain"}},
"attr": "pint"
},
"attr": "to_base_units"
}
},
"attr": "pint"
},
"attr": "magnitude"
},
{
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {
"@type": "Call",
"func": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {"@type": "Subscript", "value": {"var": "linear"}, "slice": {"literal": "stress"}},
"attr": "pint"
},
"attr": "to_base_units"
}
},
"attr": "pint"
},
"attr": "magnitude"
}
]
}
},
{
"@type": "Assign",
"targets": [{"var": "slope"}],
"value": {
"@type": "BinOp",
"left": {
"@type": "BinOp",
"left": {"var": "slope"},
"op": "Mult",
"right": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {
"@type": "Call",
"func": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {"@type": "Subscript", "value": {"var": "linear"}, "slice": {"literal": "stress"}},
"attr": "pint"
},
"attr": "to_base_units"
}
},
"attr": "pint"
},
"attr": "units"
}
},
"op": "Div",
"right": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {
"@type": "Call",
"func": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {"@type": "Subscript", "value": {"var": "linear"}, "slice": {"literal": "strain"}},
"attr": "pint"
},
"attr": "to_base_units"
}
},
"attr": "pint"
},
"attr": "units"
}
}
},
{
"@type": "Assign",
"targets": [{"@type": "Attribute", "value": {"@type": "Attribute", "value": {"var": "dataset"}, "attr": "specimen"}, "attr": "e_mod"}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "ModulusOfElasticity"}, "attr": "from_pint"},
"args": [{"@type": "Call", "func": {"@type": "Attribute", "value": {"var": "slope"}, "attr": "to"}, "args": [{"literal": "Pa"}]}]
}
},
{
"@type": "Assign",
"targets": [{"@type": "Attribute", "value": {"var": "dataset"}, "attr": "result"}],
"value": {
"@type": "Call",
"func": {"@type": "Attribute", "value": {"var": "TensileTestResult"}, "attr": "from_df"},
"args": [{"var": "df"}]
}
},
{"@type": "Return", "value": {"var": "dataset"}}
],
"returns": {"var": "TensileTestDataset"}
},
{
"@type": "Assign",
"targets": [{"var": "specimen"}],
"value": {
"@type": "Call",
"func": {"var": "TensileTestSpecimen"},
"keyword_arguments": {
"length": {
"@type": "Call",
"func": {"var": "Length"},
"keyword_arguments": {"value": {"literal": 100}, "unit": {"@type": "Attribute", "value": {"var": "LengthUnit"}, "attr": "milli_meter"}}
},
"width": {
"@type": "Call",
"func": {"var": "Width"},
"keyword_arguments": {"value": {"literal": 10}, "unit": {"@type": "Attribute", "value": {"var": "LengthUnit"}, "attr": "milli_meter"}}
},
"thickness": {
"@type": "Call",
"func": {"var": "Thickness"},
"keyword_arguments": {"value": {"literal": 10}, "unit": {"@type": "Attribute", "value": {"var": "LengthUnit"}, "attr": "milli_meter"}}
}
}
}
},
{
"@type": "Assign",
"targets": [{"var": "result"}],
"value": {
"@type": "Call",
"func": {"var": "TensileTestResult"},
"keyword_arguments": {
"rows": {
"@type": "List",
"elts": [
{
"@type": "Call",
"func": {"var": "TensileTestResultRow"},
"keyword_arguments": {
"force": {
"@type": "Call",
"func": {"var": "Force"},
"keyword_arguments": {"value": {"literal": 1.0}, "unit": {"@type": "Attribute", "value": {"var": "ForceUnit"}, "attr": "kilo_newton"}}
},
"elongation": {
"@type": "Call",
"func": {"var": "Length"},
"keyword_arguments": {"value": {"literal": 0.1}, "unit": {"@type": "Attribute", "value": {"var": "LengthUnit"}, "attr": "milli_meter"}}
}
}
},
{
"@type": "Call",
"func": {"var": "TensileTestResultRow"},
"keyword_arguments": {
"force": {
"@type": "Call",
"func": {"var": "Force"},
"keyword_arguments": {"value": {"literal": 1.505}, "unit": {"@type": "Attribute", "value": {"var": "ForceUnit"}, "attr": "kilo_newton"}}
},
"elongation": {
"@type": "Call",
"func": {"var": "Length"},
"keyword_arguments": {"value": {"literal": 0.15}, "unit": {"@type": "Attribute", "value": {"var": "LengthUnit"}, "attr": "milli_meter"}}
}
}
},
{
"@type": "Call",
"func": {"var": "TensileTestResultRow"},
"keyword_arguments": {
"force": {
"@type": "Call",
"func": {"var": "Force"},
"keyword_arguments": {"value": {"literal": 2.0}, "unit": {"@type": "Attribute", "value": {"var": "ForceUnit"}, "attr": "kilo_newton"}}
},
"elongation": {
"@type": "Call",
"func": {"var": "Length"},
"keyword_arguments": {"value": {"literal": 0.2}, "unit": {"@type": "Attribute", "value": {"var": "LengthUnit"}, "attr": "milli_meter"}}
}
}
}
]
}
}
}
},
{
"@type": "Assign",
"targets": [{"var": "dataset"}],
"value": {
"@type": "Call",
"func": {"var": "TensileTestDataset"},
"keyword_arguments": {"specimen": {"var": "specimen"}, "result": {"var": "result"}}
}
},
{
"@type": "Assign",
"targets": [{"var": "analyzed"}],
"value": {"@type": "Call", "func": {"var": "tensile_test_analysis"}, "args": [{"var": "dataset"}]}
},
{
"@type": "Call",
"func": {"var": "print"},
"args": [
{
"@type": "JoinedStr",
"values": [
{"literal": "Cross section area: "},
{
"@type": "FormattedValue",
"value": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {"@type": "Attribute", "value": {"var": "analyzed"}, "attr": "specimen"},
"attr": "cross_section_area"
},
"attr": "value"
},
"conversion": -1
},
{"literal": " "},
{
"@type": "FormattedValue",
"value": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {"@type": "Attribute", "value": {"var": "analyzed"}, "attr": "specimen"},
"attr": "cross_section_area"
},
"attr": "unit"
},
"attr": "name"
},
"conversion": -1
}
]
}
]
},
{
"@type": "Call",
"func": {"var": "print"},
"args": [
{
"@type": "JoinedStr",
"values": [
{"literal": "Modulus of elasticity: "},
{
"@type": "FormattedValue",
"value": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {"@type": "Attribute", "value": {"var": "analyzed"}, "attr": "specimen"},
"attr": "e_mod"
},
"attr": "value"
},
"conversion": -1
},
{"literal": " "},
{
"@type": "FormattedValue",
"value": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {
"@type": "Attribute",
"value": {"@type": "Attribute", "value": {"var": "analyzed"}, "attr": "specimen"},
"attr": "e_mod"
},
"attr": "unit"
},
"attr": "name"
},
"conversion": -1
}
]
}
]
},
{
"@type": "Assert",
"test": {
"@type": "Compare",
"left": {"@type": "Attribute", "value": {"@type": "Attribute", "value": {"var": "analyzed"}, "attr": "specimen"}, "attr": "e_mod"},
"ops": ["Eq"],
"comparators": [
{
"@type": "Call",
"func": {"var": "ModulusOfElasticity"},
"keyword_arguments": {"value": {"literal": 10.0}, "unit": {"@type": "Attribute", "value": {"var": "ForcePerAreaUnit"}, "attr": "giga_pascal"}}
}
]
}
},
{"@type": "Call", "func": {"var": "print"}, "args": [{"literal": "E = 10 GPa (as expected for this sample)"}]}
]
}
@prefix awl: <https://w3id.org/awl/schema/> .
@prefix ns1: <https://w3id.org/awl/py/real.tensile_test/TensileTestResult#> .
@prefix ns2: <https://w3id.org/awl/py/real.tensile_test/TensileTestSpecimen#> .
@prefix ns3: <https://w3id.org/awl/py/real.tensile_test/TensileTestResultRow#> .
@prefix ns4: <https://w3id.org/awl/py/real.tensile_test/TensileTestDataset#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<https://w3id.org/awl/py/real.tensile_test/step#1> awl:literal "Real-world example: tensile test analysis with stress-strain curve fitting." ;
awl:order 0 ;
awl:span [ awl:endCol 81 ;
awl:endLine 1 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 1 ] .
<https://w3id.org/awl/py/real.tensile_test/step#10> a awl:Call ;
awl:argument ( [ a awl:JoinedStr ;
awl:span [ awl:endCol 55 ;
awl:endLine 107 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 106 ] ;
awl:values [ awl:literal " " ;
awl:span [ awl:endCol 71 ;
awl:endLine 106 ;
awl:file "tensile_test.py" ;
awl:startCol 70 ;
awl:startLine 106 ] ],
[ a awl:FormattedValue ;
awl:conversion -1 ;
awl:span [ awl:endCol 54 ;
awl:endLine 107 ;
awl:file "tensile_test.py" ;
awl:startCol 6 ;
awl:startLine 107 ] ;
awl:value [ a awl:Attribute ;
awl:attr "name" ;
awl:span [ awl:endCol 53 ;
awl:endLine 107 ;
awl:file "tensile_test.py" ;
awl:startCol 7 ;
awl:startLine 107 ] ;
awl:value [ a awl:Attribute ;
awl:attr "unit" ;
awl:span [ awl:endCol 48 ;
awl:endLine 107 ;
awl:file "tensile_test.py" ;
awl:startCol 7 ;
awl:startLine 107 ] ;
awl:value [ a awl:Attribute ;
awl:attr "cross_section_area" ;
awl:span [ awl:endCol 43 ;
awl:endLine 107 ;
awl:file "tensile_test.py" ;
awl:startCol 7 ;
awl:startLine 107 ] ;
awl:value [ a awl:Attribute ;
awl:attr "specimen" ;
awl:span [ awl:endCol 24 ;
awl:endLine 107 ;
awl:file "tensile_test.py" ;
awl:startCol 7 ;
awl:startLine 107 ] ;
awl:value [ awl:span [ awl:endCol 15 ;
awl:endLine 107 ;
awl:file "tensile_test.py" ;
awl:startCol 7 ;
awl:startLine 107 ] ;
awl:var "analyzed" ] ] ] ] ] ],
[ a awl:FormattedValue ;
awl:conversion -1 ;
awl:span [ awl:endCol 70 ;
awl:endLine 106 ;
awl:file "tensile_test.py" ;
awl:startCol 26 ;
awl:startLine 106 ] ;
awl:value [ a awl:Attribute ;
awl:attr "value" ;
awl:span [ awl:endCol 69 ;
awl:endLine 106 ;
awl:file "tensile_test.py" ;
awl:startCol 27 ;
awl:startLine 106 ] ;
awl:value [ a awl:Attribute ;
awl:attr "cross_section_area" ;
awl:span [ awl:endCol 63 ;
awl:endLine 106 ;
awl:file "tensile_test.py" ;
awl:startCol 27 ;
awl:startLine 106 ] ;
awl:value [ a awl:Attribute ;
awl:attr "specimen" ;
awl:span [ awl:endCol 44 ;
awl:endLine 106 ;
awl:file "tensile_test.py" ;
awl:startCol 27 ;
awl:startLine 106 ] ;
awl:value [ awl:span [ awl:endCol 35 ;
awl:endLine 106 ;
awl:file "tensile_test.py" ;
awl:startCol 27 ;
awl:startLine 106 ] ;
awl:var "analyzed" ] ] ] ] ],
[ awl:literal "Cross section area: " ;
awl:span [ awl:endCol 26 ;
awl:endLine 106 ;
awl:file "tensile_test.py" ;
awl:startCol 6 ;
awl:startLine 106 ] ] ] ) ;
awl:func [ awl:span [ awl:endCol 5 ;
awl:endLine 105 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 105 ] ;
awl:var "print" ] ;
awl:order 14 ;
awl:span [ awl:endCol 1 ;
awl:endLine 108 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 105 ] .
<https://w3id.org/awl/py/real.tensile_test/step#11> a awl:Call ;
awl:argument ( [ a awl:JoinedStr ;
awl:span [ awl:endCol 42 ;
awl:endLine 111 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 110 ] ;
awl:values [ awl:literal " " ;
awl:span [ awl:endCol 61 ;
awl:endLine 110 ;
awl:file "tensile_test.py" ;
awl:startCol 60 ;
awl:startLine 110 ] ],
[ awl:literal "Modulus of elasticity: " ;
awl:span [ awl:endCol 29 ;
awl:endLine 110 ;
awl:file "tensile_test.py" ;
awl:startCol 6 ;
awl:startLine 110 ] ],
[ a awl:FormattedValue ;
awl:conversion -1 ;
awl:span [ awl:endCol 41 ;
awl:endLine 111 ;
awl:file "tensile_test.py" ;
awl:startCol 6 ;
awl:startLine 111 ] ;
awl:value [ a awl:Attribute ;
awl:attr "name" ;
awl:span [ awl:endCol 40 ;
awl:endLine 111 ;
awl:file "tensile_test.py" ;
awl:startCol 7 ;
awl:startLine 111 ] ;
awl:value [ a awl:Attribute ;
awl:attr "unit" ;
awl:span [ awl:endCol 35 ;
awl:endLine 111 ;
awl:file "tensile_test.py" ;
awl:startCol 7 ;
awl:startLine 111 ] ;
awl:value [ a awl:Attribute ;
awl:attr "e_mod" ;
awl:span [ awl:endCol 30 ;
awl:endLine 111 ;
awl:file "tensile_test.py" ;
awl:startCol 7 ;
awl:startLine 111 ] ;
awl:value [ a awl:Attribute ;
awl:attr "specimen" ;
awl:span [ awl:endCol 24 ;
awl:endLine 111 ;
awl:file "tensile_test.py" ;
awl:startCol 7 ;
awl:startLine 111 ] ;
awl:value [ awl:span [ awl:endCol 15 ;
awl:endLine 111 ;
awl:file "tensile_test.py" ;
awl:startCol 7 ;
awl:startLine 111 ] ;
awl:var "analyzed" ] ] ] ] ] ],
[ a awl:FormattedValue ;
awl:conversion -1 ;
awl:span [ awl:endCol 60 ;
awl:endLine 110 ;
awl:file "tensile_test.py" ;
awl:startCol 29 ;
awl:startLine 110 ] ;
awl:value [ a awl:Attribute ;
awl:attr "value" ;
awl:span [ awl:endCol 59 ;
awl:endLine 110 ;
awl:file "tensile_test.py" ;
awl:startCol 30 ;
awl:startLine 110 ] ;
awl:value [ a awl:Attribute ;
awl:attr "e_mod" ;
awl:span [ awl:endCol 53 ;
awl:endLine 110 ;
awl:file "tensile_test.py" ;
awl:startCol 30 ;
awl:startLine 110 ] ;
awl:value [ a awl:Attribute ;
awl:attr "specimen" ;
awl:span [ awl:endCol 47 ;
awl:endLine 110 ;
awl:file "tensile_test.py" ;
awl:startCol 30 ;
awl:startLine 110 ] ;
awl:value [ awl:span [ awl:endCol 38 ;
awl:endLine 110 ;
awl:file "tensile_test.py" ;
awl:startCol 30 ;
awl:startLine 110 ] ;
awl:var "analyzed" ] ] ] ] ] ] ) ;
awl:func [ awl:span [ awl:endCol 5 ;
awl:endLine 109 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 109 ] ;
awl:var "print" ] ;
awl:order 15 ;
awl:span [ awl:endCol 1 ;
awl:endLine 112 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 109 ] .
<https://w3id.org/awl/py/real.tensile_test/step#12> a awl:Assert ;
awl:order 16 ;
awl:span [ awl:endCol 1 ;
awl:endLine 115 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 113 ] ;
awl:test [ a awl:Compare ;
awl:comparators [ a awl:Call ;
awl:func [ awl:span [ awl:endCol 53 ;
awl:endLine 113 ;
awl:file "tensile_test.py" ;
awl:startCol 34 ;
awl:startLine 113 ] ;
awl:var "ModulusOfElasticity" ] ;
awl:keywordArguments [ awl:unit [ a awl:Attribute ;
awl:attr "giga_pascal" ;
awl:span [ awl:endCol 49 ;
awl:endLine 114 ;
awl:file "tensile_test.py" ;
awl:startCol 21 ;
awl:startLine 114 ] ;
awl:value [ awl:span [ awl:endCol 37 ;
awl:endLine 114 ;
awl:file "tensile_test.py" ;
awl:startCol 21 ;
awl:startLine 114 ] ;
awl:var "ForcePerAreaUnit" ] ] ;
awl:value [ awl:literal 1e+01 ;
awl:span [ awl:endCol 14 ;
awl:endLine 114 ;
awl:file "tensile_test.py" ;
awl:startCol 10 ;
awl:startLine 114 ] ] ] ;
awl:span [ awl:endCol 1 ;
awl:endLine 115 ;
awl:file "tensile_test.py" ;
awl:startCol 34 ;
awl:startLine 113 ] ] ;
awl:left [ a awl:Attribute ;
awl:attr "e_mod" ;
awl:span [ awl:endCol 30 ;
awl:endLine 113 ;
awl:file "tensile_test.py" ;
awl:startCol 7 ;
awl:startLine 113 ] ;
awl:value [ a awl:Attribute ;
awl:attr "specimen" ;
awl:span [ awl:endCol 24 ;
awl:endLine 113 ;
awl:file "tensile_test.py" ;
awl:startCol 7 ;
awl:startLine 113 ] ;
awl:value [ awl:span [ awl:endCol 15 ;
awl:endLine 113 ;
awl:file "tensile_test.py" ;
awl:startCol 7 ;
awl:startLine 113 ] ;
awl:var "analyzed" ] ] ] ;
awl:ops "Eq" ;
awl:span [ awl:endCol 1 ;
awl:endLine 115 ;
awl:file "tensile_test.py" ;
awl:startCol 7 ;
awl:startLine 113 ] ] .
<https://w3id.org/awl/py/real.tensile_test/step#13> a awl:Call ;
awl:argument ( [ awl:literal "E = 10 GPa (as expected for this sample)" ;
awl:span [ awl:endCol 48 ;
awl:endLine 116 ;
awl:file "tensile_test.py" ;
awl:startCol 6 ;
awl:startLine 116 ] ] ) ;
awl:func [ awl:span [ awl:endCol 5 ;
awl:endLine 116 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 116 ] ;
awl:var "print" ] ;
awl:order 17 ;
awl:span [ awl:endCol 49 ;
awl:endLine 116 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 116 ] .
<https://w3id.org/awl/py/real.tensile_test/step#2> a awl:ImportFrom ;
awl:level 0 ;
awl:module "typing" ;
awl:names "List",
"Optional" ;
awl:order 1 ;
awl:span [ awl:endCol 33 ;
awl:endLine 3 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 3 ] .
<https://w3id.org/awl/py/real.tensile_test/step#3> a awl:ImportFrom ;
awl:level 0 ;
awl:module "scipy.stats" ;
awl:names "linregress" ;
awl:order 2 ;
awl:span [ awl:endCol 34 ;
awl:endLine 5 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 5 ] .
<https://w3id.org/awl/py/real.tensile_test/step#4> a awl:ImportFrom ;
awl:level 0 ;
awl:module "opensemantic" ;
awl:names "OswBaseModel" ;
awl:order 3 ;
awl:span [ awl:endCol 37 ;
awl:endLine 7 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 7 ] .
<https://w3id.org/awl/py/real.tensile_test/step#5> a awl:ImportFrom ;
awl:level 0 ;
awl:module "opensemantic.characteristics.quantitative" ;
awl:names "Area",
"Force",
"ForcePerAreaUnit",
"ForceUnit",
"Length",
"LengthUnit",
"LinearStrain",
"ModulusOfElasticity",
"Stress",
"TabularData",
"Thickness",
"Width" ;
awl:order 4 ;
awl:span [ awl:endCol 1 ;
awl:endLine 21 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 8 ] .
<https://w3id.org/awl/py/real.tensile_test/step#6> a awl:Assign ;
awl:comment [ awl:span [ awl:endCol 13 ;
awl:endLine 79 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 79 ] ;
awl:text "Sample data" ;
awl:where "above" ] ;
awl:order 10 ;
awl:span [ awl:endCol 1 ;
awl:endLine 84 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 80 ] ;
awl:targets [ awl:span [ awl:endCol 8 ;
awl:endLine 80 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 80 ] ;
awl:var "specimen" ] ;
awl:value [ a <https://w3id.org/awl/py/real.tensile_test/TensileTestSpecimen> ;
ns2:length [ a awl:Call ;
awl:func [ awl:span [ awl:endCol 17 ;
awl:endLine 81 ;
awl:file "tensile_test.py" ;
awl:startCol 11 ;
awl:startLine 81 ] ;
awl:var "Length" ] ;
awl:keywordArguments [ awl:unit [ a awl:Attribute ;
awl:attr "milli_meter" ;
awl:span [ awl:endCol 56 ;
awl:endLine 81 ;
awl:file "tensile_test.py" ;
awl:startCol 34 ;
awl:startLine 81 ] ;
awl:value [ awl:span [ awl:endCol 44 ;
awl:endLine 81 ;
awl:file "tensile_test.py" ;
awl:startCol 34 ;
awl:startLine 81 ] ;
awl:var "LengthUnit" ] ] ;
awl:value [ awl:literal 100 ;
awl:span [ awl:endCol 27 ;
awl:endLine 81 ;
awl:file "tensile_test.py" ;
awl:startCol 24 ;
awl:startLine 81 ] ] ] ;
awl:span [ awl:endCol 57 ;
awl:endLine 81 ;
awl:file "tensile_test.py" ;
awl:startCol 11 ;
awl:startLine 81 ] ] ;
ns2:thickness [ a awl:Call ;
awl:func [ awl:span [ awl:endCol 23 ;
awl:endLine 83 ;
awl:file "tensile_test.py" ;
awl:startCol 14 ;
awl:startLine 83 ] ;
awl:var "Thickness" ] ;
awl:keywordArguments [ awl:unit [ a awl:Attribute ;
awl:attr "milli_meter" ;
awl:span [ awl:endCol 61 ;
awl:endLine 83 ;
awl:file "tensile_test.py" ;
awl:startCol 39 ;
awl:startLine 83 ] ;
awl:value [ awl:span [ awl:endCol 49 ;
awl:endLine 83 ;
awl:file "tensile_test.py" ;
awl:startCol 39 ;
awl:startLine 83 ] ;
awl:var "LengthUnit" ] ] ;
awl:value [ awl:literal 10 ;
awl:span [ awl:endCol 32 ;
awl:endLine 83 ;
awl:file "tensile_test.py" ;
awl:startCol 30 ;
awl:startLine 83 ] ] ] ;
awl:span [ awl:endCol 62 ;
awl:endLine 83 ;
awl:file "tensile_test.py" ;
awl:startCol 14 ;
awl:startLine 83 ] ] ;
ns2:width [ a awl:Call ;
awl:func [ awl:span [ awl:endCol 15 ;
awl:endLine 82 ;
awl:file "tensile_test.py" ;
awl:startCol 10 ;
awl:startLine 82 ] ;
awl:var "Width" ] ;
awl:keywordArguments [ awl:unit [ a awl:Attribute ;
awl:attr "milli_meter" ;
awl:span [ awl:endCol 53 ;
awl:endLine 82 ;
awl:file "tensile_test.py" ;
awl:startCol 31 ;
awl:startLine 82 ] ;
awl:value [ awl:span [ awl:endCol 41 ;
awl:endLine 82 ;
awl:file "tensile_test.py" ;
awl:startCol 31 ;
awl:startLine 82 ] ;
awl:var "LengthUnit" ] ] ;
awl:value [ awl:literal 10 ;
awl:span [ awl:endCol 24 ;
awl:endLine 82 ;
awl:file "tensile_test.py" ;
awl:startCol 22 ;
awl:startLine 82 ] ] ] ;
awl:span [ awl:endCol 54 ;
awl:endLine 82 ;
awl:file "tensile_test.py" ;
awl:startCol 10 ;
awl:startLine 82 ] ] ;
awl:span [ awl:endCol 1 ;
awl:endLine 84 ;
awl:file "tensile_test.py" ;
awl:startCol 11 ;
awl:startLine 80 ] ] .
<https://w3id.org/awl/py/real.tensile_test/step#7> a awl:Assign ;
awl:order 11 ;
awl:span [ awl:endCol 1 ;
awl:endLine 100 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 85 ] ;
awl:targets [ awl:span [ awl:endCol 6 ;
awl:endLine 85 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 85 ] ;
awl:var "result" ] ;
awl:value [ a <https://w3id.org/awl/py/real.tensile_test/TensileTestResult> ;
ns1:rows [ a awl:List ;
awl:elts [ a <https://w3id.org/awl/py/real.tensile_test/TensileTestResultRow> ;
ns3:elongation [ a awl:Call ;
awl:func [ awl:span [ awl:endCol 29 ;
awl:endLine 89 ;
awl:file "tensile_test.py" ;
awl:startCol 23 ;
awl:startLine 89 ] ;
awl:var "Length" ] ;
awl:keywordArguments [ awl:unit [ a awl:Attribute ;
awl:attr "milli_meter" ;
awl:span [ awl:endCol 69 ;
awl:endLine 89 ;
awl:file "tensile_test.py" ;
awl:startCol 47 ;
awl:startLine 89 ] ;
awl:value [ awl:span [ awl:endCol 57 ;
awl:endLine 89 ;
awl:file "tensile_test.py" ;
awl:startCol 47 ;
awl:startLine 89 ] ;
awl:var "LengthUnit" ] ] ;
awl:value [ awl:literal 1e-01 ;
awl:span [ awl:endCol 40 ;
awl:endLine 89 ;
awl:file "tensile_test.py" ;
awl:startCol 36 ;
awl:startLine 89 ] ] ] ;
awl:span [ awl:endCol 70 ;
awl:endLine 89 ;
awl:file "tensile_test.py" ;
awl:startCol 23 ;
awl:startLine 89 ] ] ;
ns3:force [ a awl:Call ;
awl:func [ awl:span [ awl:endCol 23 ;
awl:endLine 88 ;
awl:file "tensile_test.py" ;
awl:startCol 18 ;
awl:startLine 88 ] ;
awl:var "Force" ] ;
awl:keywordArguments [ awl:unit [ a awl:Attribute ;
awl:attr "kilo_newton" ;
awl:span [ awl:endCol 61 ;
awl:endLine 88 ;
awl:file "tensile_test.py" ;
awl:startCol 40 ;
awl:startLine 88 ] ;
awl:value [ awl:span [ awl:endCol 49 ;
awl:endLine 88 ;
awl:file "tensile_test.py" ;
awl:startCol 40 ;
awl:startLine 88 ] ;
awl:var "ForceUnit" ] ] ;
awl:value [ awl:literal 1e+00 ;
awl:span [ awl:endCol 33 ;
awl:endLine 88 ;
awl:file "tensile_test.py" ;
awl:startCol 30 ;
awl:startLine 88 ] ] ] ;
awl:span [ awl:endCol 62 ;
awl:endLine 88 ;
awl:file "tensile_test.py" ;
awl:startCol 18 ;
awl:startLine 88 ] ] ;
awl:span [ awl:endCol 9 ;
awl:endLine 90 ;
awl:file "tensile_test.py" ;
awl:startCol 8 ;
awl:startLine 87 ] ],
[ a <https://w3id.org/awl/py/real.tensile_test/TensileTestResultRow> ;
ns3:elongation [ a awl:Call ;
awl:func [ awl:span [ awl:endCol 29 ;
awl:endLine 93 ;
awl:file "tensile_test.py" ;
awl:startCol 23 ;
awl:startLine 93 ] ;
awl:var "Length" ] ;
awl:keywordArguments [ awl:unit [ a awl:Attribute ;
awl:attr "milli_meter" ;
awl:span [ awl:endCol 69 ;
awl:endLine 93 ;
awl:file "tensile_test.py" ;
awl:startCol 47 ;
awl:startLine 93 ] ;
awl:value [ awl:span [ awl:endCol 57 ;
awl:endLine 93 ;
awl:file "tensile_test.py" ;
awl:startCol 47 ;
awl:startLine 93 ] ;
awl:var "LengthUnit" ] ] ;
awl:value [ awl:literal 1.5e-01 ;
awl:span [ awl:endCol 40 ;
awl:endLine 93 ;
awl:file "tensile_test.py" ;
awl:startCol 36 ;
awl:startLine 93 ] ] ] ;
awl:span [ awl:endCol 70 ;
awl:endLine 93 ;
awl:file "tensile_test.py" ;
awl:startCol 23 ;
awl:startLine 93 ] ] ;
ns3:force [ a awl:Call ;
awl:func [ awl:span [ awl:endCol 23 ;
awl:endLine 92 ;
awl:file "tensile_test.py" ;
awl:startCol 18 ;
awl:startLine 92 ] ;
awl:var "Force" ] ;
awl:keywordArguments [ awl:unit [ a awl:Attribute ;
awl:attr "kilo_newton" ;
awl:span [ awl:endCol 63 ;
awl:endLine 92 ;
awl:file "tensile_test.py" ;
awl:startCol 42 ;
awl:startLine 92 ] ;
awl:value [ awl:span [ awl:endCol 51 ;
awl:endLine 92 ;
awl:file "tensile_test.py" ;
awl:startCol 42 ;
awl:startLine 92 ] ;
awl:var "ForceUnit" ] ] ;
awl:value [ awl:literal 1.505e+00 ;
awl:span [ awl:endCol 35 ;
awl:endLine 92 ;
awl:file "tensile_test.py" ;
awl:startCol 30 ;
awl:startLine 92 ] ] ] ;
awl:span [ awl:endCol 64 ;
awl:endLine 92 ;
awl:file "tensile_test.py" ;
awl:startCol 18 ;
awl:startLine 92 ] ] ;
awl:span [ awl:endCol 9 ;
awl:endLine 94 ;
awl:file "tensile_test.py" ;
awl:startCol 8 ;
awl:startLine 91 ] ],
[ a <https://w3id.org/awl/py/real.tensile_test/TensileTestResultRow> ;
ns3:elongation [ a awl:Call ;
awl:func [ awl:span [ awl:endCol 29 ;
awl:endLine 97 ;
awl:file "tensile_test.py" ;
awl:startCol 23 ;
awl:startLine 97 ] ;
awl:var "Length" ] ;
awl:keywordArguments [ awl:unit [ a awl:Attribute ;
awl:attr "milli_meter" ;
awl:span [ awl:endCol 69 ;
awl:endLine 97 ;
awl:file "tensile_test.py" ;
awl:startCol 47 ;
awl:startLine 97 ] ;
awl:value [ awl:span [ awl:endCol 57 ;
awl:endLine 97 ;
awl:file "tensile_test.py" ;
awl:startCol 47 ;
awl:startLine 97 ] ;
awl:var "LengthUnit" ] ] ;
awl:value [ awl:literal 2e-01 ;
awl:span [ awl:endCol 40 ;
awl:endLine 97 ;
awl:file "tensile_test.py" ;
awl:startCol 36 ;
awl:startLine 97 ] ] ] ;
awl:span [ awl:endCol 70 ;
awl:endLine 97 ;
awl:file "tensile_test.py" ;
awl:startCol 23 ;
awl:startLine 97 ] ] ;
ns3:force [ a awl:Call ;
awl:func [ awl:span [ awl:endCol 23 ;
awl:endLine 96 ;
awl:file "tensile_test.py" ;
awl:startCol 18 ;
awl:startLine 96 ] ;
awl:var "Force" ] ;
awl:keywordArguments [ awl:unit [ a awl:Attribute ;
awl:attr "kilo_newton" ;
awl:span [ awl:endCol 61 ;
awl:endLine 96 ;
awl:file "tensile_test.py" ;
awl:startCol 40 ;
awl:startLine 96 ] ;
awl:value [ awl:span [ awl:endCol 49 ;
awl:endLine 96 ;
awl:file "tensile_test.py" ;
awl:startCol 40 ;
awl:startLine 96 ] ;
awl:var "ForceUnit" ] ] ;
awl:value [ awl:literal 2e+00 ;
awl:span [ awl:endCol 33 ;
awl:endLine 96 ;
awl:file "tensile_test.py" ;
awl:startCol 30 ;
awl:startLine 96 ] ] ] ;
awl:span [ awl:endCol 62 ;
awl:endLine 96 ;
awl:file "tensile_test.py" ;
awl:startCol 18 ;
awl:startLine 96 ] ] ;
awl:span [ awl:endCol 9 ;
awl:endLine 98 ;
awl:file "tensile_test.py" ;
awl:startCol 8 ;
awl:startLine 95 ] ] ;
awl:span [ awl:endCol 5 ;
awl:endLine 99 ;
awl:file "tensile_test.py" ;
awl:startCol 9 ;
awl:startLine 86 ] ] ;
awl:span [ awl:endCol 1 ;
awl:endLine 100 ;
awl:file "tensile_test.py" ;
awl:startCol 9 ;
awl:startLine 85 ] ] .
<https://w3id.org/awl/py/real.tensile_test/step#8> a awl:Assign ;
awl:order 12 ;
awl:span [ awl:endCol 62 ;
awl:endLine 102 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 102 ] ;
awl:targets [ awl:span [ awl:endCol 7 ;
awl:endLine 102 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 102 ] ;
awl:var "dataset" ] ;
awl:value [ a <https://w3id.org/awl/py/real.tensile_test/TensileTestDataset> ;
ns4:result [ awl:span [ awl:endCol 61 ;
awl:endLine 102 ;
awl:file "tensile_test.py" ;
awl:startCol 55 ;
awl:startLine 102 ] ;
awl:var "result" ] ;
ns4:specimen [ awl:span [ awl:endCol 46 ;
awl:endLine 102 ;
awl:file "tensile_test.py" ;
awl:startCol 38 ;
awl:startLine 102 ] ;
awl:var "specimen" ] ;
awl:span [ awl:endCol 62 ;
awl:endLine 102 ;
awl:file "tensile_test.py" ;
awl:startCol 10 ;
awl:startLine 102 ] ] .
<https://w3id.org/awl/py/real.tensile_test/step#9> a awl:Assign ;
awl:order 13 ;
awl:span [ awl:endCol 41 ;
awl:endLine 103 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 103 ] ;
awl:targets [ awl:span [ awl:endCol 8 ;
awl:endLine 103 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 103 ] ;
awl:var "analyzed" ] ;
awl:value [ a awl:Call ;
awl:argument ( [ awl:span [ awl:endCol 40 ;
awl:endLine 103 ;
awl:file "tensile_test.py" ;
awl:startCol 33 ;
awl:startLine 103 ] ;
awl:var "dataset" ] ) ;
awl:func [ awl:span [ awl:endCol 32 ;
awl:endLine 103 ;
awl:file "tensile_test.py" ;
awl:startCol 11 ;
awl:startLine 103 ] ;
awl:var "tensile_test_analysis" ] ;
awl:span [ awl:endCol 41 ;
awl:endLine 103 ;
awl:file "tensile_test.py" ;
awl:startCol 11 ;
awl:startLine 103 ] ] .
<https://w3id.org/awl/py/real.tensile_test/tensile_test_analysis.step#14> awl:literal "Compute stress, strain, and modulus of elasticity from raw test data." ;
awl:order 0 ;
awl:span [ awl:endCol 79 ;
awl:endLine 51 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 51 ] .
<https://w3id.org/awl/py/real.tensile_test/tensile_test_analysis.step#15> a awl:If ;
awl:body ( <https://w3id.org/awl/py/real.tensile_test/tensile_test_analysis.step#16> ) ;
awl:comment [ awl:span [ awl:endCol 24 ;
awl:endLine 52 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 52 ] ;
awl:text "Cross section area" ;
awl:where "above" ] ;
awl:order 1 ;
awl:span [ awl:endCol 9 ;
awl:endLine 56 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 53 ] ;
awl:test [ a awl:Compare ;
awl:comparators [ awl:span [ awl:endCol 50 ;
awl:endLine 53 ;
awl:file "tensile_test.py" ;
awl:startCol 46 ;
awl:startLine 53 ] ] ;
awl:left [ a awl:Attribute ;
awl:attr "cross_section_area" ;
awl:span [ awl:endCol 42 ;
awl:endLine 53 ;
awl:file "tensile_test.py" ;
awl:startCol 7 ;
awl:startLine 53 ] ;
awl:value [ a awl:Attribute ;
awl:attr "specimen" ;
awl:span [ awl:endCol 23 ;
awl:endLine 53 ;
awl:file "tensile_test.py" ;
awl:startCol 7 ;
awl:startLine 53 ] ;
awl:value [ awl:span [ awl:endCol 14 ;
awl:endLine 53 ;
awl:file "tensile_test.py" ;
awl:startCol 7 ;
awl:startLine 53 ] ;
awl:var "dataset" ] ] ] ;
awl:ops "Is" ;
awl:span [ awl:endCol 50 ;
awl:endLine 53 ;
awl:file "tensile_test.py" ;
awl:startCol 7 ;
awl:startLine 53 ] ] .
<https://w3id.org/awl/py/real.tensile_test/tensile_test_analysis.step#16> a awl:Assign ;
awl:order 0 ;
awl:span [ awl:endCol 9 ;
awl:endLine 56 ;
awl:file "tensile_test.py" ;
awl:startCol 8 ;
awl:startLine 54 ] ;
awl:targets [ a awl:Attribute ;
awl:attr "cross_section_area" ;
awl:span [ awl:endCol 43 ;
awl:endLine 54 ;
awl:file "tensile_test.py" ;
awl:startCol 8 ;
awl:startLine 54 ] ;
awl:value [ a awl:Attribute ;
awl:attr "specimen" ;
awl:span [ awl:endCol 24 ;
awl:endLine 54 ;
awl:file "tensile_test.py" ;
awl:startCol 8 ;
awl:startLine 54 ] ;
awl:value [ awl:span [ awl:endCol 15 ;
awl:endLine 54 ;
awl:file "tensile_test.py" ;
awl:startCol 8 ;
awl:startLine 54 ] ;
awl:var "dataset" ] ] ] ;
awl:value [ a awl:BinOp ;
awl:left [ a awl:Attribute ;
awl:attr "width" ;
awl:span [ awl:endCol 34 ;
awl:endLine 55 ;
awl:file "tensile_test.py" ;
awl:startCol 12 ;
awl:startLine 55 ] ;
awl:value [ a awl:Attribute ;
awl:attr "specimen" ;
awl:span [ awl:endCol 28 ;
awl:endLine 55 ;
awl:file "tensile_test.py" ;
awl:startCol 12 ;
awl:startLine 55 ] ;
awl:value [ awl:span [ awl:endCol 19 ;
awl:endLine 55 ;
awl:file "tensile_test.py" ;
awl:startCol 12 ;
awl:startLine 55 ] ;
awl:var "dataset" ] ] ] ;
awl:op "Mult" ;
awl:right [ a awl:Attribute ;
awl:attr "thickness" ;
awl:span [ awl:endCol 63 ;
awl:endLine 55 ;
awl:file "tensile_test.py" ;
awl:startCol 37 ;
awl:startLine 55 ] ;
awl:value [ a awl:Attribute ;
awl:attr "specimen" ;
awl:span [ awl:endCol 53 ;
awl:endLine 55 ;
awl:file "tensile_test.py" ;
awl:startCol 37 ;
awl:startLine 55 ] ;
awl:value [ awl:span [ awl:endCol 44 ;
awl:endLine 55 ;
awl:file "tensile_test.py" ;
awl:startCol 37 ;
awl:startLine 55 ] ;
awl:var "dataset" ] ] ] ;
awl:span [ awl:endCol 63 ;
awl:endLine 55 ;
awl:file "tensile_test.py" ;
awl:startCol 12 ;
awl:startLine 55 ] ] .
<https://w3id.org/awl/py/real.tensile_test/tensile_test_analysis.step#17> a awl:Assign ;
awl:comment [ awl:span [ awl:endCol 46 ;
awl:endLine 58 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 58 ] ;
awl:text "Vectorized stress/strain via pint-pandas" ;
awl:where "above" ] ;
awl:order 2 ;
awl:span [ awl:endCol 31 ;
awl:endLine 59 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 59 ] ;
awl:targets [ awl:span [ awl:endCol 6 ;
awl:endLine 59 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 59 ] ;
awl:var "df" ] ;
awl:value [ a awl:Call ;
awl:func [ a awl:Attribute ;
awl:attr "to_df" ;
awl:span [ awl:endCol 29 ;
awl:endLine 59 ;
awl:file "tensile_test.py" ;
awl:startCol 9 ;
awl:startLine 59 ] ;
awl:value [ a awl:Attribute ;
awl:attr "result" ;
awl:span [ awl:endCol 23 ;
awl:endLine 59 ;
awl:file "tensile_test.py" ;
awl:startCol 9 ;
awl:startLine 59 ] ;
awl:value [ awl:span [ awl:endCol 16 ;
awl:endLine 59 ;
awl:file "tensile_test.py" ;
awl:startCol 9 ;
awl:startLine 59 ] ;
awl:var "dataset" ] ] ] ;
awl:span [ awl:endCol 31 ;
awl:endLine 59 ;
awl:file "tensile_test.py" ;
awl:startCol 9 ;
awl:startLine 59 ] ] .
<https://w3id.org/awl/py/real.tensile_test/tensile_test_analysis.step#18> a awl:Assign ;
awl:order 3 ;
awl:span [ awl:endCol 71 ;
awl:endLine 60 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 60 ] ;
awl:targets [ a awl:Subscript ;
awl:slice [ awl:literal "strain" ;
awl:span [ awl:endCol 15 ;
awl:endLine 60 ;
awl:file "tensile_test.py" ;
awl:startCol 7 ;
awl:startLine 60 ] ] ;
awl:span [ awl:endCol 16 ;
awl:endLine 60 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 60 ] ;
awl:value [ awl:span [ awl:endCol 6 ;
awl:endLine 60 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 60 ] ;
awl:var "df" ] ] ;
awl:value [ a awl:BinOp ;
awl:left [ a awl:Subscript ;
awl:slice [ awl:literal "elongation" ;
awl:span [ awl:endCol 34 ;
awl:endLine 60 ;
awl:file "tensile_test.py" ;
awl:startCol 22 ;
awl:startLine 60 ] ] ;
awl:span [ awl:endCol 35 ;
awl:endLine 60 ;
awl:file "tensile_test.py" ;
awl:startCol 19 ;
awl:startLine 60 ] ;
awl:value [ awl:span [ awl:endCol 21 ;
awl:endLine 60 ;
awl:file "tensile_test.py" ;
awl:startCol 19 ;
awl:startLine 60 ] ;
awl:var "df" ] ] ;
awl:op "Div" ;
awl:right [ a awl:Call ;
awl:func [ a awl:Attribute ;
awl:attr "to_pint" ;
awl:span [ awl:endCol 69 ;
awl:endLine 60 ;
awl:file "tensile_test.py" ;
awl:startCol 38 ;
awl:startLine 60 ] ;
awl:value [ a awl:Attribute ;
awl:attr "length" ;
awl:span [ awl:endCol 61 ;
awl:endLine 60 ;
awl:file "tensile_test.py" ;
awl:startCol 38 ;
awl:startLine 60 ] ;
awl:value [ a awl:Attribute ;
awl:attr "specimen" ;
awl:span [ awl:endCol 54 ;
awl:endLine 60 ;
awl:file "tensile_test.py" ;
awl:startCol 38 ;
awl:startLine 60 ] ;
awl:value [ awl:span [ awl:endCol 45 ;
awl:endLine 60 ;
awl:file "tensile_test.py" ;
awl:startCol 38 ;
awl:startLine 60 ] ;
awl:var "dataset" ] ] ] ] ;
awl:span [ awl:endCol 71 ;
awl:endLine 60 ;
awl:file "tensile_test.py" ;
awl:startCol 38 ;
awl:startLine 60 ] ] ;
awl:span [ awl:endCol 71 ;
awl:endLine 60 ;
awl:file "tensile_test.py" ;
awl:startCol 19 ;
awl:startLine 60 ] ] .
<https://w3id.org/awl/py/real.tensile_test/tensile_test_analysis.step#19> a awl:Assign ;
awl:order 4 ;
awl:span [ awl:endCol 78 ;
awl:endLine 61 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 61 ] ;
awl:targets [ a awl:Subscript ;
awl:slice [ awl:literal "stress" ;
awl:span [ awl:endCol 15 ;
awl:endLine 61 ;
awl:file "tensile_test.py" ;
awl:startCol 7 ;
awl:startLine 61 ] ] ;
awl:span [ awl:endCol 16 ;
awl:endLine 61 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 61 ] ;
awl:value [ awl:span [ awl:endCol 6 ;
awl:endLine 61 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 61 ] ;
awl:var "df" ] ] ;
awl:value [ a awl:BinOp ;
awl:left [ a awl:Subscript ;
awl:slice [ awl:literal "force" ;
awl:span [ awl:endCol 29 ;
awl:endLine 61 ;
awl:file "tensile_test.py" ;
awl:startCol 22 ;
awl:startLine 61 ] ] ;
awl:span [ awl:endCol 30 ;
awl:endLine 61 ;
awl:file "tensile_test.py" ;
awl:startCol 19 ;
awl:startLine 61 ] ;
awl:value [ awl:span [ awl:endCol 21 ;
awl:endLine 61 ;
awl:file "tensile_test.py" ;
awl:startCol 19 ;
awl:startLine 61 ] ;
awl:var "df" ] ] ;
awl:op "Div" ;
awl:right [ a awl:Call ;
awl:func [ a awl:Attribute ;
awl:attr "to_pint" ;
awl:span [ awl:endCol 76 ;
awl:endLine 61 ;
awl:file "tensile_test.py" ;
awl:startCol 33 ;
awl:startLine 61 ] ;
awl:value [ a awl:Attribute ;
awl:attr "cross_section_area" ;
awl:span [ awl:endCol 68 ;
awl:endLine 61 ;
awl:file "tensile_test.py" ;
awl:startCol 33 ;
awl:startLine 61 ] ;
awl:value [ a awl:Attribute ;
awl:attr "specimen" ;
awl:span [ awl:endCol 49 ;
awl:endLine 61 ;
awl:file "tensile_test.py" ;
awl:startCol 33 ;
awl:startLine 61 ] ;
awl:value [ awl:span [ awl:endCol 40 ;
awl:endLine 61 ;
awl:file "tensile_test.py" ;
awl:startCol 33 ;
awl:startLine 61 ] ;
awl:var "dataset" ] ] ] ] ;
awl:span [ awl:endCol 78 ;
awl:endLine 61 ;
awl:file "tensile_test.py" ;
awl:startCol 33 ;
awl:startLine 61 ] ] ;
awl:span [ awl:endCol 78 ;
awl:endLine 61 ;
awl:file "tensile_test.py" ;
awl:startCol 19 ;
awl:startLine 61 ] ] .
<https://w3id.org/awl/py/real.tensile_test/tensile_test_analysis.step#20> a awl:Assign ;
awl:comment [ awl:span [ awl:endCol 45 ;
awl:endLine 63 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 63 ] ;
awl:text "Linear regression on the elastic region" ;
awl:where "above" ] ;
awl:order 5 ;
awl:span [ awl:endCol 71 ;
awl:endLine 64 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 64 ] ;
awl:targets [ awl:span [ awl:endCol 10 ;
awl:endLine 64 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 64 ] ;
awl:var "linear" ] ;
awl:value [ a awl:Subscript ;
awl:slice [ a awl:Compare ;
awl:comparators [ a awl:Call ;
awl:func [ a awl:Attribute ;
awl:attr "to_pint" ;
awl:span [ awl:endCol 68 ;
awl:endLine 64 ;
awl:file "tensile_test.py" ;
awl:startCol 32 ;
awl:startLine 64 ] ;
awl:value [ a awl:Attribute ;
awl:attr "linear_region" ;
awl:span [ awl:endCol 60 ;
awl:endLine 64 ;
awl:file "tensile_test.py" ;
awl:startCol 32 ;
awl:startLine 64 ] ;
awl:value [ a awl:Attribute ;
awl:attr "result" ;
awl:span [ awl:endCol 46 ;
awl:endLine 64 ;
awl:file "tensile_test.py" ;
awl:startCol 32 ;
awl:startLine 64 ] ;
awl:value [ awl:span [ awl:endCol 39 ;
awl:endLine 64 ;
awl:file "tensile_test.py" ;
awl:startCol 32 ;
awl:startLine 64 ] ;
awl:var "dataset" ] ] ] ] ;
awl:span [ awl:endCol 70 ;
awl:endLine 64 ;
awl:file "tensile_test.py" ;
awl:startCol 32 ;
awl:startLine 64 ] ] ;
awl:left [ a awl:Subscript ;
awl:slice [ awl:literal "strain" ;
awl:span [ awl:endCol 27 ;
awl:endLine 64 ;
awl:file "tensile_test.py" ;
awl:startCol 19 ;
awl:startLine 64 ] ] ;
awl:span [ awl:endCol 28 ;
awl:endLine 64 ;
awl:file "tensile_test.py" ;
awl:startCol 16 ;
awl:startLine 64 ] ;
awl:value [ awl:span [ awl:endCol 18 ;
awl:endLine 64 ;
awl:file "tensile_test.py" ;
awl:startCol 16 ;
awl:startLine 64 ] ;
awl:var "df" ] ] ;
awl:ops "LtE" ;
awl:span [ awl:endCol 70 ;
awl:endLine 64 ;
awl:file "tensile_test.py" ;
awl:startCol 16 ;
awl:startLine 64 ] ] ;
awl:span [ awl:endCol 71 ;
awl:endLine 64 ;
awl:file "tensile_test.py" ;
awl:startCol 13 ;
awl:startLine 64 ] ;
awl:value [ awl:span [ awl:endCol 15 ;
awl:endLine 64 ;
awl:file "tensile_test.py" ;
awl:startCol 13 ;
awl:startLine 64 ] ;
awl:var "df" ] ] .
<https://w3id.org/awl/py/real.tensile_test/tensile_test_analysis.step#21> a awl:Assign ;
awl:order 6 ;
awl:span [ awl:endCol 5 ;
awl:endLine 68 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 65 ] ;
awl:targets [ a awl:Tuple ;
awl:elts [ a awl:Starred ;
awl:span [ awl:endCol 13 ;
awl:endLine 65 ;
awl:file "tensile_test.py" ;
awl:startCol 11 ;
awl:startLine 65 ] ;
awl:value [ awl:span [ awl:endCol 13 ;
awl:endLine 65 ;
awl:file "tensile_test.py" ;
awl:startCol 12 ;
awl:startLine 65 ] ;
awl:var "_" ] ],
[ awl:span [ awl:endCol 9 ;
awl:endLine 65 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 65 ] ;
awl:var "slope" ] ;
awl:span [ awl:endCol 13 ;
awl:endLine 65 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 65 ] ] ;
awl:value [ a awl:Call ;
awl:argument ( [ a awl:Attribute ;
awl:attr "magnitude" ;
awl:span [ awl:endCol 60 ;
awl:endLine 66 ;
awl:file "tensile_test.py" ;
awl:startCol 8 ;
awl:startLine 66 ] ;
awl:value [ a awl:Attribute ;
awl:attr "pint" ;
awl:span [ awl:endCol 50 ;
awl:endLine 66 ;
awl:file "tensile_test.py" ;
awl:startCol 8 ;
awl:startLine 66 ] ;
awl:value [ a awl:Call ;
awl:func [ a awl:Attribute ;
awl:attr "to_base_units" ;
awl:span [ awl:endCol 43 ;
awl:endLine 66 ;
awl:file "tensile_test.py" ;
awl:startCol 8 ;
awl:startLine 66 ] ;
awl:value [ a awl:Attribute ;
awl:attr "pint" ;
awl:span [ awl:endCol 29 ;
awl:endLine 66 ;
awl:file "tensile_test.py" ;
awl:startCol 8 ;
awl:startLine 66 ] ;
awl:value [ a awl:Subscript ;
awl:slice [ awl:literal "strain" ;
awl:span [ awl:endCol 23 ;
awl:endLine 66 ;
awl:file "tensile_test.py" ;
awl:startCol 15 ;
awl:startLine 66 ] ] ;
awl:span [ awl:endCol 24 ;
awl:endLine 66 ;
awl:file "tensile_test.py" ;
awl:startCol 8 ;
awl:startLine 66 ] ;
awl:value [ awl:span [ awl:endCol 14 ;
awl:endLine 66 ;
awl:file "tensile_test.py" ;
awl:startCol 8 ;
awl:startLine 66 ] ;
awl:var "linear" ] ] ] ] ;
awl:span [ awl:endCol 45 ;
awl:endLine 66 ;
awl:file "tensile_test.py" ;
awl:startCol 8 ;
awl:startLine 66 ] ] ] ] [ a awl:Attribute ;
awl:attr "magnitude" ;
awl:span [ awl:endCol 60 ;
awl:endLine 67 ;
awl:file "tensile_test.py" ;
awl:startCol 8 ;
awl:startLine 67 ] ;
awl:value [ a awl:Attribute ;
awl:attr "pint" ;
awl:span [ awl:endCol 50 ;
awl:endLine 67 ;
awl:file "tensile_test.py" ;
awl:startCol 8 ;
awl:startLine 67 ] ;
awl:value [ a awl:Call ;
awl:func [ a awl:Attribute ;
awl:attr "to_base_units" ;
awl:span [ awl:endCol 43 ;
awl:endLine 67 ;
awl:file "tensile_test.py" ;
awl:startCol 8 ;
awl:startLine 67 ] ;
awl:value [ a awl:Attribute ;
awl:attr "pint" ;
awl:span [ awl:endCol 29 ;
awl:endLine 67 ;
awl:file "tensile_test.py" ;
awl:startCol 8 ;
awl:startLine 67 ] ;
awl:value [ a awl:Subscript ;
awl:slice [ awl:literal "stress" ;
awl:span [ awl:endCol 23 ;
awl:endLine 67 ;
awl:file "tensile_test.py" ;
awl:startCol 15 ;
awl:startLine 67 ] ] ;
awl:span [ awl:endCol 24 ;
awl:endLine 67 ;
awl:file "tensile_test.py" ;
awl:startCol 8 ;
awl:startLine 67 ] ;
awl:value [ awl:span [ awl:endCol 14 ;
awl:endLine 67 ;
awl:file "tensile_test.py" ;
awl:startCol 8 ;
awl:startLine 67 ] ;
awl:var "linear" ] ] ] ] ;
awl:span [ awl:endCol 45 ;
awl:endLine 67 ;
awl:file "tensile_test.py" ;
awl:startCol 8 ;
awl:startLine 67 ] ] ] ] ) ;
awl:func [ awl:span [ awl:endCol 26 ;
awl:endLine 65 ;
awl:file "tensile_test.py" ;
awl:startCol 16 ;
awl:startLine 65 ] ;
awl:var "linregress" ] ;
awl:span [ awl:endCol 5 ;
awl:endLine 68 ;
awl:file "tensile_test.py" ;
awl:startCol 16 ;
awl:startLine 65 ] ] .
<https://w3id.org/awl/py/real.tensile_test/tensile_test_analysis.step#22> a awl:Assign ;
awl:order 7 ;
awl:span [ awl:endCol 5 ;
awl:endLine 73 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 69 ] ;
awl:targets [ awl:span [ awl:endCol 9 ;
awl:endLine 69 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 69 ] ;
awl:var "slope" ] ;
awl:value [ a awl:BinOp ;
awl:left [ a awl:BinOp ;
awl:left [ awl:span [ awl:endCol 13 ;
awl:endLine 70 ;
awl:file "tensile_test.py" ;
awl:startCol 8 ;
awl:startLine 70 ] ;
awl:var "slope" ] ;
awl:op "Mult" ;
awl:right [ a awl:Attribute ;
awl:attr "units" ;
awl:span [ awl:endCol 58 ;
awl:endLine 71 ;
awl:file "tensile_test.py" ;
awl:startCol 10 ;
awl:startLine 71 ] ;
awl:value [ a awl:Attribute ;
awl:attr "pint" ;
awl:span [ awl:endCol 52 ;
awl:endLine 71 ;
awl:file "tensile_test.py" ;
awl:startCol 10 ;
awl:startLine 71 ] ;
awl:value [ a awl:Call ;
awl:func [ a awl:Attribute ;
awl:attr "to_base_units" ;
awl:span [ awl:endCol 45 ;
awl:endLine 71 ;
awl:file "tensile_test.py" ;
awl:startCol 10 ;
awl:startLine 71 ] ;
awl:value [ a awl:Attribute ;
awl:attr "pint" ;
awl:span [ awl:endCol 31 ;
awl:endLine 71 ;
awl:file "tensile_test.py" ;
awl:startCol 10 ;
awl:startLine 71 ] ;
awl:value [ a awl:Subscript ;
awl:slice [ awl:literal "stress" ;
awl:span [ awl:endCol 25 ;
awl:endLine 71 ;
awl:file "tensile_test.py" ;
awl:startCol 17 ;
awl:startLine 71 ] ] ;
awl:span [ awl:endCol 26 ;
awl:endLine 71 ;
awl:file "tensile_test.py" ;
awl:startCol 10 ;
awl:startLine 71 ] ;
awl:value [ awl:span [ awl:endCol 16 ;
awl:endLine 71 ;
awl:file "tensile_test.py" ;
awl:startCol 10 ;
awl:startLine 71 ] ;
awl:var "linear" ] ] ] ] ;
awl:span [ awl:endCol 47 ;
awl:endLine 71 ;
awl:file "tensile_test.py" ;
awl:startCol 10 ;
awl:startLine 71 ] ] ] ] ;
awl:span [ awl:endCol 58 ;
awl:endLine 71 ;
awl:file "tensile_test.py" ;
awl:startCol 8 ;
awl:startLine 70 ] ] ;
awl:op "Div" ;
awl:right [ a awl:Attribute ;
awl:attr "units" ;
awl:span [ awl:endCol 58 ;
awl:endLine 72 ;
awl:file "tensile_test.py" ;
awl:startCol 10 ;
awl:startLine 72 ] ;
awl:value [ a awl:Attribute ;
awl:attr "pint" ;
awl:span [ awl:endCol 52 ;
awl:endLine 72 ;
awl:file "tensile_test.py" ;
awl:startCol 10 ;
awl:startLine 72 ] ;
awl:value [ a awl:Call ;
awl:func [ a awl:Attribute ;
awl:attr "to_base_units" ;
awl:span [ awl:endCol 45 ;
awl:endLine 72 ;
awl:file "tensile_test.py" ;
awl:startCol 10 ;
awl:startLine 72 ] ;
awl:value [ a awl:Attribute ;
awl:attr "pint" ;
awl:span [ awl:endCol 31 ;
awl:endLine 72 ;
awl:file "tensile_test.py" ;
awl:startCol 10 ;
awl:startLine 72 ] ;
awl:value [ a awl:Subscript ;
awl:slice [ awl:literal "strain" ;
awl:span [ awl:endCol 25 ;
awl:endLine 72 ;
awl:file "tensile_test.py" ;
awl:startCol 17 ;
awl:startLine 72 ] ] ;
awl:span [ awl:endCol 26 ;
awl:endLine 72 ;
awl:file "tensile_test.py" ;
awl:startCol 10 ;
awl:startLine 72 ] ;
awl:value [ awl:span [ awl:endCol 16 ;
awl:endLine 72 ;
awl:file "tensile_test.py" ;
awl:startCol 10 ;
awl:startLine 72 ] ;
awl:var "linear" ] ] ] ] ;
awl:span [ awl:endCol 47 ;
awl:endLine 72 ;
awl:file "tensile_test.py" ;
awl:startCol 10 ;
awl:startLine 72 ] ] ] ] ;
awl:span [ awl:endCol 58 ;
awl:endLine 72 ;
awl:file "tensile_test.py" ;
awl:startCol 8 ;
awl:startLine 70 ] ] .
<https://w3id.org/awl/py/real.tensile_test/tensile_test_analysis.step#23> a awl:Assign ;
awl:order 8 ;
awl:span [ awl:endCol 74 ;
awl:endLine 74 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 74 ] ;
awl:targets [ a awl:Attribute ;
awl:attr "e_mod" ;
awl:span [ awl:endCol 26 ;
awl:endLine 74 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 74 ] ;
awl:value [ a awl:Attribute ;
awl:attr "specimen" ;
awl:span [ awl:endCol 20 ;
awl:endLine 74 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 74 ] ;
awl:value [ awl:span [ awl:endCol 11 ;
awl:endLine 74 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 74 ] ;
awl:var "dataset" ] ] ] ;
awl:value [ a awl:Call ;
awl:argument ( [ a awl:Call ;
awl:argument ( [ awl:literal "Pa" ;
awl:span [ awl:endCol 72 ;
awl:endLine 74 ;
awl:file "tensile_test.py" ;
awl:startCol 68 ;
awl:startLine 74 ] ] ) ;
awl:func [ a awl:Attribute ;
awl:attr "to" ;
awl:span [ awl:endCol 67 ;
awl:endLine 74 ;
awl:file "tensile_test.py" ;
awl:startCol 59 ;
awl:startLine 74 ] ;
awl:value [ awl:span [ awl:endCol 64 ;
awl:endLine 74 ;
awl:file "tensile_test.py" ;
awl:startCol 59 ;
awl:startLine 74 ] ;
awl:var "slope" ] ] ;
awl:span [ awl:endCol 73 ;
awl:endLine 74 ;
awl:file "tensile_test.py" ;
awl:startCol 59 ;
awl:startLine 74 ] ] ) ;
awl:func [ a awl:Attribute ;
awl:attr "from_pint" ;
awl:span [ awl:endCol 58 ;
awl:endLine 74 ;
awl:file "tensile_test.py" ;
awl:startCol 29 ;
awl:startLine 74 ] ;
awl:value [ awl:span [ awl:endCol 48 ;
awl:endLine 74 ;
awl:file "tensile_test.py" ;
awl:startCol 29 ;
awl:startLine 74 ] ;
awl:var "ModulusOfElasticity" ] ] ;
awl:span [ awl:endCol 74 ;
awl:endLine 74 ;
awl:file "tensile_test.py" ;
awl:startCol 29 ;
awl:startLine 74 ] ] .
<https://w3id.org/awl/py/real.tensile_test/tensile_test_analysis.step#24> a awl:Assign ;
awl:order 9 ;
awl:span [ awl:endCol 50 ;
awl:endLine 75 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 75 ] ;
awl:targets [ a awl:Attribute ;
awl:attr "result" ;
awl:span [ awl:endCol 18 ;
awl:endLine 75 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 75 ] ;
awl:value [ awl:span [ awl:endCol 11 ;
awl:endLine 75 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 75 ] ;
awl:var "dataset" ] ] ;
awl:value [ a awl:Call ;
awl:argument ( [ awl:span [ awl:endCol 49 ;
awl:endLine 75 ;
awl:file "tensile_test.py" ;
awl:startCol 47 ;
awl:startLine 75 ] ;
awl:var "df" ] ) ;
awl:func [ a awl:Attribute ;
awl:attr "from_df" ;
awl:span [ awl:endCol 46 ;
awl:endLine 75 ;
awl:file "tensile_test.py" ;
awl:startCol 21 ;
awl:startLine 75 ] ;
awl:value [ awl:span [ awl:endCol 38 ;
awl:endLine 75 ;
awl:file "tensile_test.py" ;
awl:startCol 21 ;
awl:startLine 75 ] ;
awl:var "TensileTestResult" ] ] ;
awl:span [ awl:endCol 50 ;
awl:endLine 75 ;
awl:file "tensile_test.py" ;
awl:startCol 21 ;
awl:startLine 75 ] ] .
<https://w3id.org/awl/py/real.tensile_test/tensile_test_analysis.step#25> a awl:Return ;
awl:order 10 ;
awl:span [ awl:endCol 18 ;
awl:endLine 76 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 76 ] ;
awl:value [ awl:span [ awl:endCol 18 ;
awl:endLine 76 ;
awl:file "tensile_test.py" ;
awl:startCol 11 ;
awl:startLine 76 ] ;
awl:var "dataset" ] .
[] a awl:Module ;
awl:body ( <https://w3id.org/awl/py/real.tensile_test/step#1> <https://w3id.org/awl/py/real.tensile_test/step#2> <https://w3id.org/awl/py/real.tensile_test/step#3> <https://w3id.org/awl/py/real.tensile_test/step#4> <https://w3id.org/awl/py/real.tensile_test/step#5> [ a awl:ClassDef ;
awl:bases [ awl:span [ awl:endCol 38 ;
awl:endLine 25 ;
awl:file "tensile_test.py" ;
awl:startCol 26 ;
awl:startLine 25 ] ;
awl:var "OswBaseModel" ] ;
awl:body ( [ a awl:AnnAssign ;
awl:annotation [ awl:span [ awl:endCol 18 ;
awl:endLine 26 ;
awl:file "tensile_test.py" ;
awl:startCol 12 ;
awl:startLine 26 ] ;
awl:var "Length" ] ;
awl:order 0 ;
awl:simple 1 ;
awl:span [ awl:endCol 18 ;
awl:endLine 26 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 26 ] ;
awl:target [ awl:span [ awl:endCol 10 ;
awl:endLine 26 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 26 ] ;
awl:var "length" ] ] [ a awl:AnnAssign ;
awl:annotation [ awl:span [ awl:endCol 16 ;
awl:endLine 27 ;
awl:file "tensile_test.py" ;
awl:startCol 11 ;
awl:startLine 27 ] ;
awl:var "Width" ] ;
awl:order 1 ;
awl:simple 1 ;
awl:span [ awl:endCol 16 ;
awl:endLine 27 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 27 ] ;
awl:target [ awl:span [ awl:endCol 9 ;
awl:endLine 27 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 27 ] ;
awl:var "width" ] ] [ a awl:AnnAssign ;
awl:annotation [ awl:span [ awl:endCol 21 ;
awl:endLine 28 ;
awl:file "tensile_test.py" ;
awl:startCol 15 ;
awl:startLine 28 ] ;
awl:var "Length" ] ;
awl:order 2 ;
awl:simple 1 ;
awl:span [ awl:endCol 21 ;
awl:endLine 28 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 28 ] ;
awl:target [ awl:span [ awl:endCol 13 ;
awl:endLine 28 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 28 ] ;
awl:var "thickness" ] ] [ a awl:AnnAssign ;
awl:annotation [ a awl:Subscript ;
awl:slice [ awl:span [ awl:endCol 37 ;
awl:endLine 29 ;
awl:file "tensile_test.py" ;
awl:startCol 33 ;
awl:startLine 29 ] ;
awl:var "Area" ] ;
awl:span [ awl:endCol 38 ;
awl:endLine 29 ;
awl:file "tensile_test.py" ;
awl:startCol 24 ;
awl:startLine 29 ] ;
awl:value [ awl:span [ awl:endCol 32 ;
awl:endLine 29 ;
awl:file "tensile_test.py" ;
awl:startCol 24 ;
awl:startLine 29 ] ;
awl:var "Optional" ] ] ;
awl:order 3 ;
awl:simple 1 ;
awl:span [ awl:endCol 45 ;
awl:endLine 29 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 29 ] ;
awl:target [ awl:span [ awl:endCol 22 ;
awl:endLine 29 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 29 ] ;
awl:var "cross_section_area" ] ;
awl:value [ awl:span [ awl:endCol 45 ;
awl:endLine 29 ;
awl:file "tensile_test.py" ;
awl:startCol 41 ;
awl:startLine 29 ] ] ] [ a awl:AnnAssign ;
awl:annotation [ a awl:Subscript ;
awl:slice [ awl:span [ awl:endCol 39 ;
awl:endLine 30 ;
awl:file "tensile_test.py" ;
awl:startCol 20 ;
awl:startLine 30 ] ;
awl:var "ModulusOfElasticity" ] ;
awl:span [ awl:endCol 40 ;
awl:endLine 30 ;
awl:file "tensile_test.py" ;
awl:startCol 11 ;
awl:startLine 30 ] ;
awl:value [ awl:span [ awl:endCol 19 ;
awl:endLine 30 ;
awl:file "tensile_test.py" ;
awl:startCol 11 ;
awl:startLine 30 ] ;
awl:var "Optional" ] ] ;
awl:order 4 ;
awl:simple 1 ;
awl:span [ awl:endCol 47 ;
awl:endLine 30 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 30 ] ;
awl:target [ awl:span [ awl:endCol 9 ;
awl:endLine 30 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 30 ] ;
awl:var "e_mod" ] ;
awl:value [ awl:span [ awl:endCol 47 ;
awl:endLine 30 ;
awl:file "tensile_test.py" ;
awl:startCol 43 ;
awl:startLine 30 ] ] ] ) ;
awl:comment [ awl:span [ awl:endCol 23 ;
awl:endLine 24 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 24 ] ;
awl:text "Define the data model" ;
awl:where "above" ] ;
awl:name "TensileTestSpecimen" ;
awl:order 5 ;
awl:span [ awl:endCol 47 ;
awl:endLine 30 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 25 ] ] [ a awl:ClassDef ;
awl:bases [ awl:span [ awl:endCol 39 ;
awl:endLine 33 ;
awl:file "tensile_test.py" ;
awl:startCol 27 ;
awl:startLine 33 ] ;
awl:var "OswBaseModel" ] ;
awl:body ( [ a awl:AnnAssign ;
awl:annotation [ awl:span [ awl:endCol 22 ;
awl:endLine 34 ;
awl:file "tensile_test.py" ;
awl:startCol 16 ;
awl:startLine 34 ] ;
awl:var "Length" ] ;
awl:order 0 ;
awl:simple 1 ;
awl:span [ awl:endCol 22 ;
awl:endLine 34 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 34 ] ;
awl:target [ awl:span [ awl:endCol 14 ;
awl:endLine 34 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 34 ] ;
awl:var "elongation" ] ] [ a awl:AnnAssign ;
awl:annotation [ awl:span [ awl:endCol 16 ;
awl:endLine 35 ;
awl:file "tensile_test.py" ;
awl:startCol 11 ;
awl:startLine 35 ] ;
awl:var "Force" ] ;
awl:order 1 ;
awl:simple 1 ;
awl:span [ awl:endCol 16 ;
awl:endLine 35 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 35 ] ;
awl:target [ awl:span [ awl:endCol 9 ;
awl:endLine 35 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 35 ] ;
awl:var "force" ] ] [ a awl:AnnAssign ;
awl:annotation [ a awl:Subscript ;
awl:slice [ awl:span [ awl:endCol 33 ;
awl:endLine 36 ;
awl:file "tensile_test.py" ;
awl:startCol 21 ;
awl:startLine 36 ] ;
awl:var "LinearStrain" ] ;
awl:span [ awl:endCol 34 ;
awl:endLine 36 ;
awl:file "tensile_test.py" ;
awl:startCol 12 ;
awl:startLine 36 ] ;
awl:value [ awl:span [ awl:endCol 20 ;
awl:endLine 36 ;
awl:file "tensile_test.py" ;
awl:startCol 12 ;
awl:startLine 36 ] ;
awl:var "Optional" ] ] ;
awl:order 2 ;
awl:simple 1 ;
awl:span [ awl:endCol 41 ;
awl:endLine 36 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 36 ] ;
awl:target [ awl:span [ awl:endCol 10 ;
awl:endLine 36 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 36 ] ;
awl:var "strain" ] ;
awl:value [ awl:span [ awl:endCol 41 ;
awl:endLine 36 ;
awl:file "tensile_test.py" ;
awl:startCol 37 ;
awl:startLine 36 ] ] ] [ a awl:AnnAssign ;
awl:annotation [ a awl:Subscript ;
awl:slice [ awl:span [ awl:endCol 27 ;
awl:endLine 37 ;
awl:file "tensile_test.py" ;
awl:startCol 21 ;
awl:startLine 37 ] ;
awl:var "Stress" ] ;
awl:span [ awl:endCol 28 ;
awl:endLine 37 ;
awl:file "tensile_test.py" ;
awl:startCol 12 ;
awl:startLine 37 ] ;
awl:value [ awl:span [ awl:endCol 20 ;
awl:endLine 37 ;
awl:file "tensile_test.py" ;
awl:startCol 12 ;
awl:startLine 37 ] ;
awl:var "Optional" ] ] ;
awl:order 3 ;
awl:simple 1 ;
awl:span [ awl:endCol 35 ;
awl:endLine 37 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 37 ] ;
awl:target [ awl:span [ awl:endCol 10 ;
awl:endLine 37 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 37 ] ;
awl:var "stress" ] ;
awl:value [ awl:span [ awl:endCol 35 ;
awl:endLine 37 ;
awl:file "tensile_test.py" ;
awl:startCol 31 ;
awl:startLine 37 ] ] ] ) ;
awl:name "TensileTestResultRow" ;
awl:order 6 ;
awl:span [ awl:endCol 35 ;
awl:endLine 37 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 33 ] ] [ a awl:ClassDef ;
awl:bases [ awl:span [ awl:endCol 35 ;
awl:endLine 40 ;
awl:file "tensile_test.py" ;
awl:startCol 24 ;
awl:startLine 40 ] ;
awl:var "TabularData" ] ;
awl:body ( [ a awl:AnnAssign ;
awl:annotation [ a awl:Subscript ;
awl:slice [ awl:span [ awl:endCol 35 ;
awl:endLine 41 ;
awl:file "tensile_test.py" ;
awl:startCol 15 ;
awl:startLine 41 ] ;
awl:var "TensileTestResultRow" ] ;
awl:span [ awl:endCol 36 ;
awl:endLine 41 ;
awl:file "tensile_test.py" ;
awl:startCol 10 ;
awl:startLine 41 ] ;
awl:value [ awl:span [ awl:endCol 14 ;
awl:endLine 41 ;
awl:file "tensile_test.py" ;
awl:startCol 10 ;
awl:startLine 41 ] ;
awl:var "List" ] ] ;
awl:order 0 ;
awl:simple 1 ;
awl:span [ awl:endCol 36 ;
awl:endLine 41 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 41 ] ;
awl:target [ awl:span [ awl:endCol 8 ;
awl:endLine 41 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 41 ] ;
awl:var "rows" ] ] [ a awl:AnnAssign ;
awl:annotation [ a awl:Subscript ;
awl:slice [ awl:span [ awl:endCol 40 ;
awl:endLine 42 ;
awl:file "tensile_test.py" ;
awl:startCol 28 ;
awl:startLine 42 ] ;
awl:var "LinearStrain" ] ;
awl:span [ awl:endCol 41 ;
awl:endLine 42 ;
awl:file "tensile_test.py" ;
awl:startCol 19 ;
awl:startLine 42 ] ;
awl:value [ awl:span [ awl:endCol 27 ;
awl:endLine 42 ;
awl:file "tensile_test.py" ;
awl:startCol 19 ;
awl:startLine 42 ] ;
awl:var "Optional" ] ] ;
awl:order 1 ;
awl:simple 1 ;
awl:span [ awl:endCol 69 ;
awl:endLine 42 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 42 ] ;
awl:target [ awl:span [ awl:endCol 17 ;
awl:endLine 42 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 42 ] ;
awl:var "linear_region" ] ;
awl:value [ a awl:Call ;
awl:func [ awl:span [ awl:endCol 56 ;
awl:endLine 42 ;
awl:file "tensile_test.py" ;
awl:startCol 44 ;
awl:startLine 42 ] ;
awl:var "LinearStrain" ] ;
awl:keywordArguments [ awl:value [ awl:literal 2e-03 ;
awl:span [ awl:endCol 68 ;
awl:endLine 42 ;
awl:file "tensile_test.py" ;
awl:startCol 63 ;
awl:startLine 42 ] ] ] ;
awl:span [ awl:endCol 69 ;
awl:endLine 42 ;
awl:file "tensile_test.py" ;
awl:startCol 44 ;
awl:startLine 42 ] ] ] ) ;
awl:name "TensileTestResult" ;
awl:order 7 ;
awl:span [ awl:endCol 69 ;
awl:endLine 42 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 40 ] ] [ a awl:ClassDef ;
awl:bases [ awl:span [ awl:endCol 37 ;
awl:endLine 45 ;
awl:file "tensile_test.py" ;
awl:startCol 25 ;
awl:startLine 45 ] ;
awl:var "OswBaseModel" ] ;
awl:body ( [ a awl:AnnAssign ;
awl:annotation [ awl:span [ awl:endCol 33 ;
awl:endLine 46 ;
awl:file "tensile_test.py" ;
awl:startCol 14 ;
awl:startLine 46 ] ;
awl:var "TensileTestSpecimen" ] ;
awl:order 0 ;
awl:simple 1 ;
awl:span [ awl:endCol 33 ;
awl:endLine 46 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 46 ] ;
awl:target [ awl:span [ awl:endCol 12 ;
awl:endLine 46 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 46 ] ;
awl:var "specimen" ] ] [ a awl:AnnAssign ;
awl:annotation [ awl:span [ awl:endCol 29 ;
awl:endLine 47 ;
awl:file "tensile_test.py" ;
awl:startCol 12 ;
awl:startLine 47 ] ;
awl:var "TensileTestResult" ] ;
awl:order 1 ;
awl:simple 1 ;
awl:span [ awl:endCol 29 ;
awl:endLine 47 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 47 ] ;
awl:target [ awl:span [ awl:endCol 10 ;
awl:endLine 47 ;
awl:file "tensile_test.py" ;
awl:startCol 4 ;
awl:startLine 47 ] ;
awl:var "result" ] ] ) ;
awl:name "TensileTestDataset" ;
awl:order 8 ;
awl:span [ awl:endCol 29 ;
awl:endLine 47 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 45 ] ] [ a awl:FunctionDef ;
awl:args [ awl:annotation [ awl:span [ awl:endCol 53 ;
awl:endLine 50 ;
awl:file "tensile_test.py" ;
awl:startCol 35 ;
awl:startLine 50 ] ;
awl:var "TensileTestDataset" ] ;
awl:arg "dataset" ] ;
awl:body ( <https://w3id.org/awl/py/real.tensile_test/tensile_test_analysis.step#14> <https://w3id.org/awl/py/real.tensile_test/tensile_test_analysis.step#15> <https://w3id.org/awl/py/real.tensile_test/tensile_test_analysis.step#17> <https://w3id.org/awl/py/real.tensile_test/tensile_test_analysis.step#18> <https://w3id.org/awl/py/real.tensile_test/tensile_test_analysis.step#19> <https://w3id.org/awl/py/real.tensile_test/tensile_test_analysis.step#20> <https://w3id.org/awl/py/real.tensile_test/tensile_test_analysis.step#21> <https://w3id.org/awl/py/real.tensile_test/tensile_test_analysis.step#22> <https://w3id.org/awl/py/real.tensile_test/tensile_test_analysis.step#23> <https://w3id.org/awl/py/real.tensile_test/tensile_test_analysis.step#24> <https://w3id.org/awl/py/real.tensile_test/tensile_test_analysis.step#25> ) ;
awl:name "tensile_test_analysis" ;
awl:order 9 ;
awl:returns [ awl:span [ awl:endCol 76 ;
awl:endLine 50 ;
awl:file "tensile_test.py" ;
awl:startCol 58 ;
awl:startLine 50 ] ;
awl:var "TensileTestDataset" ] ;
awl:span [ awl:endCol 18 ;
awl:endLine 76 ;
awl:file "tensile_test.py" ;
awl:startCol 0 ;
awl:startLine 50 ] ] <https://w3id.org/awl/py/real.tensile_test/step#6> <https://w3id.org/awl/py/real.tensile_test/step#7> <https://w3id.org/awl/py/real.tensile_test/step#8> <https://w3id.org/awl/py/real.tensile_test/step#9> <https://w3id.org/awl/py/real.tensile_test/step#10> <https://w3id.org/awl/py/real.tensile_test/step#11> <https://w3id.org/awl/py/real.tensile_test/step#12> <https://w3id.org/awl/py/real.tensile_test/step#13> ) .