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
Snippets
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
Sean Leavey
pykat
Commits
0e08d581
Commit
0e08d581
authored
9 years ago
by
Daniel Brown
Browse files
Options
Downloads
Patches
Plain Diff
fixing lens issues
parent
66c2a0df
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pykat/__init__.py
+1
-1
1 addition, 1 deletion
pykat/__init__.py
pykat/components.py
+17
-16
17 additions, 16 deletions
pykat/components.py
with
18 additions
and
17 deletions
pykat/__init__.py
+
1
−
1
View file @
0e08d581
...
...
@@ -3,7 +3,7 @@ from __future__ import division
from
__future__
import
print_function
from
__future__
import
unicode_literals
__version__
=
"
1.0.
7
"
__version__
=
"
1.0.
8
"
# This flag is used to switch on the gui features in pkat at import time
USE_GUI
=
False
...
...
This diff is collapsed.
Click to expand it.
pykat/components.py
+
17
−
16
View file @
0e08d581
...
...
@@ -987,34 +987,30 @@ class isolator(Component):
return
self
.
_svgItem
class
lens
(
Component
):
def
__init__
(
self
,
name
,
node1
,
node2
,
f
=
1
):
def
__init__
(
self
,
name
,
node1
,
node2
,
f
=
1
,
p
=
None
):
Component
.
__init__
(
self
,
name
)
if
not
((
f
is
None
)
^
(
p
is
None
)):
raise
pkex
.
BasePyKatException
(
"
Specify either a focal length or power, not both.
"
)
self
.
_requested_node_names
.
append
(
node1
)
self
.
_requested_node_names
.
append
(
node2
)
self
.
_svgItem
=
None
self
.
__f
=
Param
(
"
f
"
,
self
,
SIfloat
(
f
))
self
.
__p
=
Param
(
"
p
"
,
self
,
None
)
self
.
__p
=
Param
(
"
p
"
,
self
,
SIfloat
(
p
)
)
@property
def
f
(
self
):
if
self
.
__f
is
not
None
:
return
self
.
__f
else
:
return
1
/
self
.
__p
def
f
(
self
):
return
self
.
__f
@f.setter
def
f
(
self
,
value
):
self
.
__f
.
value
=
SIfloat
(
value
)
self
.
__p
.
value
=
None
@property
def
p
(
self
):
if
self
.
__p
is
not
None
:
return
self
.
__p
else
:
return
1
/
self
.
__f
def
p
(
self
):
return
self
.
__p
@
f
.setter
@
p
.setter
def
p
(
self
,
value
):
self
.
__p
.
value
=
SIfloat
(
value
)
self
.
__f
.
value
=
None
...
...
@@ -1023,18 +1019,23 @@ class lens(Component):
def
parseFinesseText
(
text
):
values
=
text
.
split
()
if
values
[
0
]
!=
"
lens
"
:
if
not
values
[
0
]
.
startswith
(
"
lens
"
)
:
raise
pkex
.
BasePyKatException
(
"'
{0}
'
not a valid Finesse lens command
"
.
format
(
text
))
alt
=
values
[
0
].
endswith
(
"
*
"
)
values
.
pop
(
0
)
# remove initial value
if
len
(
values
)
==
4
:
return
lens
(
values
[
0
],
values
[
2
],
values
[
3
],
values
[
1
])
if
not
alt
:
return
lens
(
values
[
0
],
values
[
2
],
values
[
3
],
f
=
values
[
1
],
p
=
None
)
else
:
return
lens
(
values
[
0
],
values
[
2
],
values
[
3
],
f
=
None
,
p
=
values
[
1
])
else
:
raise
pkex
.
BasePyKatException
(
"
Lens Finesse code format incorrect
'
{0}
'"
.
format
(
text
))
def
getFinesseText
(
self
):
if
self
.
__p
is
None
:
if
self
.
__p
.
value
is
None
:
rtn
=
[
'
lens {0} {1} {2} {3}
'
.
format
(
self
.
name
,
self
.
f
.
value
,
self
.
nodes
[
0
].
name
,
self
.
nodes
[
1
].
name
)]
else
:
rtn
=
[
'
lens* {0} {1} {2} {3}
'
.
format
(
self
.
name
,
self
.
p
.
value
,
self
.
nodes
[
0
].
name
,
self
.
nodes
[
1
].
name
)]
...
...
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