Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
finesse
pykat
Commits
2cea3562
Commit
2cea3562
authored
Dec 18, 2013
by
Andreas Freise
Browse files
starting to add scale as attribute for detectors.
parent
445bb049
Changes
2
Hide whitespace changes
Inline
Side-by-side
pykat/detectors.py
View file @
2cea3562
...
...
@@ -10,6 +10,8 @@ import pykat.gui.resources
from
pykat.utils
import
*
from
pykat.gui.graphics
import
*
from
pykat.node_network
import
*
from
pykat.param
import
Param
,
ScaleParam
class
Detector
(
object
)
:
def
__init__
(
self
,
name
,
node
):
...
...
@@ -22,6 +24,7 @@ class Detector(object) :
self
.
__node
=
None
self
.
_params
=
[]
self
.
_mask
=
{}
self
.
__scale
=
ScaleParam
(
"scale"
,
self
,
SIfloat
(
1.0
))
if
node
.
find
(
'*'
):
self
.
_alternate_beam
=
True
...
...
@@ -46,6 +49,13 @@ class Detector(object) :
def
getQGraphicsItem
(
self
):
return
None
@
property
def
scale
(
self
):
return
self
.
__scale
@
scale
.
setter
def
sclae
(
self
,
value
):
self
.
__scale
=
SIfloat
(
value
)
@
property
def
node
(
self
):
return
self
.
__node
@
node
.
setter
...
...
pykat/param.py
View file @
2cea3562
...
...
@@ -165,3 +165,24 @@ class AttrParam(Param):
rtn
.
extend
(
super
(
AttrParam
,
self
).
getFinesseText
())
return
rtn
class
ScaleParam
(
Param
):
"""
The scale parameter of a detector is set using the Finesse `scale` command.
This inherits directly from a Param object so can be set whether this attribute
is putable or a putter.
If the value pf the parameter is not 1.0 the scale command will be printed.
"""
def
getFinesseText
(
self
):
rtn
=
[]
if
self
.
value
!=
1.0
:
rtn
.
append
(
"scale {0} {1}"
.
format
(
self
.
_owner
.
name
,
self
.
value
))
rtn
.
extend
(
super
(
ScaleParam
,
self
).
getFinesseText
())
return
rtn
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment