Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pykat
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
finesse
pykat
Commits
aa064dfb
Commit
aa064dfb
authored
11 years ago
by
Andreas Freise
Browse files
Options
Downloads
Patches
Plain Diff
trying to make more example files work:
- extending SIfloat to work with lists - adding SIfloat to axis conversion.
parent
a77ef735
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
pykat/SIfloat.py
+7
-9
7 additions, 9 deletions
pykat/SIfloat.py
pykat/commands.py
+2
-2
2 additions, 2 deletions
pykat/commands.py
pykat/components.py
+1
-1
1 addition, 1 deletion
pykat/components.py
pykat/finesse.py
+1
-1
1 addition, 1 deletion
pykat/finesse.py
with
11 additions
and
13 deletions
pykat/SIfloat.py
+
7
−
9
View file @
aa064dfb
import
os
import
re
"""
class SIfloat(value):
def __init__(self, value):
self.__value = value
"""
#staticmethod
def
SIfloat
(
value
):
value
=
str
(
value
)
if
type
(
value
)
==
list
:
return
[
convertToFloat
(
s
)
for
s
in
value
]
else
:
return
convertToFloat
(
value
)
def
convertToFloat
(
value
):
__prefix
=
{
'
y
'
:
1e-24
,
# yocto
'
z
'
:
1e-21
,
# zepto
'
a
'
:
1e-18
,
# atto
...
...
@@ -30,7 +28,7 @@ def SIfloat(value):
'
Z
'
:
1e21
,
# zetta
'
Y
'
:
1e24
,
# yotta
}
value
=
str
(
value
)
for
i
,
j
in
__prefix
.
iteritems
():
value
=
value
.
replace
(
i
,
str
(
j
))
return
float
(
value
)
This diff is collapsed.
Click to expand it.
pykat/commands.py
+
2
−
2
View file @
aa064dfb
...
...
@@ -83,7 +83,7 @@ class xaxis(Command):
if
numpy
.
size
(
limits
)
!=
2
:
raise
exceptions
.
ValueError
(
"
limits input should be a 2x1 vector of limits for the xaxis
"
)
self
.
limits
=
numpy
.
array
(
limits
).
astype
(
float
)
self
.
limits
=
numpy
.
array
(
SIfloat
(
limits
)
)
.
astype
(
float
)
if
steps
<=
0
:
raise
exceptions
.
ValueError
(
"
steps value should be > 0
"
)
...
...
This diff is collapsed.
Click to expand it.
pykat/components.py
+
1
−
1
View file @
aa064dfb
...
...
@@ -71,7 +71,7 @@ class Component(object) :
class
Param
(
float
):
def
__new__
(
self
,
name
,
value
):
return
float
.
__new__
(
self
,
value
)
return
float
.
__new__
(
self
,
SIfloat
(
value
)
)
def
__init__
(
self
,
name
,
value
):
self
.
__name
=
name
...
...
This diff is collapsed.
Click to expand it.
pykat/finesse.py
+
1
−
1
View file @
aa064dfb
...
...
@@ -122,7 +122,7 @@ class kat(object):
def
parseKatCode
(
self
,
code
):
#commands = code.split("\n")
self
.
parseCommands
(
co
mmands
)
self
.
parseCommands
(
co
de
)
def
parseCommands
(
self
,
commands
):
blockComment
=
False
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment