-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
P11 develop #800
P11 develop #800
Changes from 23 commits
e80379d
5f29dc6
d2b8c35
ba7d34c
9585b03
df5dfd3
de981e7
24c07c7
d22d705
4a38247
480ec3e
56d2cad
a07b2ec
be6c170
3e58e8d
2a6a21e
5d7ca11
c20ec81
7574477
b4b8f9b
4a192df
f3bd7d5
6fe81ab
75621a3
30ddf3a
e878dfb
7a11684
3fe9dff
2d31d70
8011a9c
7def003
0451f47
f4ea552
3f16e79
832f6e7
0dc5d28
d62e6bf
44491ab
d652b9c
8a03c76
14e9de0
fb4f534
d002f93
3575ae9
4dafa5b
b807078
ae9588f
62ccaba
5dabc0f
7e3188b
75ad89c
b2f3c7c
2fd8ad5
3d4f0d2
2b7e1fa
9476766
77fe447
b7c2e64
47c6c2c
0177daf
cf28f6c
1e62320
dd41e29
b7e7294
abb9df8
b3c2ec3
33b70bf
3b56eaf
07a6e6a
69f7734
72d1966
518f517
a3a645d
732d330
dbf92d1
2b0d5e9
2475e32
738f981
d0bec06
9a07a93
4112629
ab9ec24
f86bc95
7c64161
349bda9
8037795
8ee4cc4
50be287
888ec97
a091d6f
a01d46e
8414e3f
3d8eaa8
2d02ae3
988c3c5
ead7953
40250bd
ae8b878
13f14b8
b021661
f31ed83
9aa5e33
859bbf8
e095b64
3965257
41adec3
3956097
c3b5452
5d45193
81f2018
dbbe6d4
a801746
9f87b9d
d5230fc
fa994b1
deb07e9
1aeb1f7
23922d2
5fd5872
55100bc
73c9a05
a8d8fdf
32c0666
2e722cc
8f1755e
2a41443
198be99
554d003
4d320cc
22f4a2a
0076681
4f0dc72
e9e7f7b
f6dc76d
e7aa787
01a26e9
1c72ab6
bd966b3
a25eaf7
0f434cb
e3fe513
50c6b83
8dcf8b4
1c872e6
46b4fe5
dfb0cb4
13bfad3
85c4862
85bc098
f03f779
37b6915
b35f10f
31cd0b8
1bba3ed
8686c65
c3a2a03
3f63381
1a0b15e
44d8f09
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,9 +67,11 @@ def init(self): | |
def get_value(self): | ||
return self.update_fast_shutter() | ||
|
||
@property | ||
def is_open(self): | ||
return self.get_value() == self.VALUES.OPEN | ||
|
||
@property | ||
def is_closed(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this needed? |
||
return self.get_value() == self.VALUES.CLOSED | ||
|
||
Comment on lines
66
to
76
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to define FastShutterVakue enum. As it inherits from AbstractNState, uou can simply do it in your xml file, like this: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the comment. What is best way to adress it from the code? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you, please, be more explicit. The above comment means, that your self.VALUES.OPEN.value is "Open", as you probably need. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here is my xml: FastShutter
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And mxcube is not happy: File "/mxcubecore/mxcubecore/HardwareRepository.py", line 545, in parse_xml |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,8 +26,6 @@ def init(self): | |
"PROPOSAL NUMBER is %s" % self.simulated_prop_number | ||
) | ||
|
||
self.loginType = "user" | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How come that you need a P11ISpyBClieant, do you have some extra stuff to handle ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It inherits from the IspybClient and adds for example simulated proposal option used for the testing with ISPyB instance. Maybe it can be replaced later once the system is completely up. |
||
def update_data_collection(self, mx_collection, wait=False): | ||
mx_collection["beamline_name"] = "P11" | ||
ISPyBClient.update_data_collection(self, mx_collection, wait) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ | |
import gevent | ||
import urllib | ||
from mxcubecore.HardwareObjects.abstract.AbstractShutter import AbstractShutter | ||
import mxcubecore.HardwareObjects.abstract.AbstractShutter as absshut | ||
from mxcubecore.BaseHardwareObjects import HardwareObjectState | ||
from enum import Enum, unique | ||
|
||
|
@@ -85,6 +86,8 @@ def init(self): | |
else: | ||
self.simulated_update() | ||
|
||
self.update_state(self.STATES.READY) | ||
|
||
super(AbstractShutter, self).init() | ||
|
||
def get_value(self): | ||
|
@@ -105,25 +108,39 @@ def _set_value(self, value): | |
if self.simulation: | ||
self.simulated_opened = open_it | ||
self.simulated_moving = True | ||
gevent.spawn(self.simul_do) | ||
self.t1 = gevent.spawn(self.simul_do) | ||
self.t1.link(self.do_finish) | ||
self.t1.link_exception(self.do_finish_exc) | ||
else: | ||
if open_it: | ||
self.do_open() | ||
else: | ||
self.do_close() | ||
self.cmd_started = time.time() | ||
self.log.debug(" ### setting value value for shutter done") | ||
|
||
def do_open(self, timeout=3): | ||
self.log.debug(" OPENING SHUTTER (web request)") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will you be removing these when you have finished testing? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess its fine as its site specific code ? :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah. it was a gentle nudge, not a precondition for anything. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those are actually quite usefull for the debug on site. We have not yet recovered after the upgrate to the latest version. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. This is a minor style thing anyway, so if you still need them of course you should keep them. |
||
result = urllib.request.urlopen(self.url_open, None, timeout).readlines() | ||
self.log.debug(" OPENING SHUTTER (web request) retured") | ||
|
||
def do_close(self, timeout=3): | ||
self.log.debug(" CLOSING SHUTTER (web request)") | ||
result = urllib.request.urlopen(self.url_close, None, timeout).readlines() | ||
self.log.debug(" CLOSING SHUTTER (web request) retured") | ||
|
||
def simul_do(self): | ||
self.log.debug("### starting simulated shutter move") | ||
gevent.sleep(1) | ||
self.simulated_moving = False | ||
self.log.debug("### updating simulated shutter") | ||
self.simulated_update() | ||
self.log.debug("### ending simulated shutter move") | ||
|
||
def do_finish(self, t=None): | ||
self.log.debug("### simulated finished") | ||
def do_finish_exc(self, exc=None): | ||
self.log.debug("### simulated finished with exception") | ||
|
||
def update_shutter_state(self, state=None): | ||
"""Updates shutter state | ||
|
@@ -133,9 +150,13 @@ def update_shutter_state(self, state=None): | |
if state is None: | ||
state = self.chan_state.get_value() | ||
|
||
self.log.debug(" SHUTTER state changed") | ||
|
||
if state[0] == 3: | ||
self.log.debug(" P11SHUTTER IS OPEN") | ||
value = self.VALUES.OPEN | ||
else: | ||
self.log.debug(" P11SHUTTER IS CLOSED") | ||
value = self.VALUES.CLOSED | ||
|
||
# else: | ||
|
@@ -146,6 +167,7 @@ def update_shutter_state(self, state=None): | |
|
||
self.update_value(value) | ||
|
||
self.log.debug(" update shutter state done") | ||
return value | ||
|
||
def simulated_update(self): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,7 +121,7 @@ def load_positions(self): | |
def get_position_list(self): | ||
return list(self._positions.keys()) | ||
|
||
def get_properties_(self, position_index, property_name): | ||
def get_properties(self, position_index, property_name): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I am not mistaken, there is already a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the comment. Changed. |
||
""" | ||
returns property with name property_name for position_index | ||
if position_index is None returns OrderedDict with property_name for all positions | ||
|
@@ -161,7 +161,7 @@ def set_position(self, posname): | |
posidx = -1 | ||
for name in self._positions: | ||
posidx += 1 | ||
if posname == self.get_properties_(posidx, "posname"): | ||
if posname == self.get_properties(posidx, "posname"): | ||
self._set_value(posidx) | ||
return | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we get rid of is_closed altogether? If you just write 'not is_open' everywhere that would mean one function less - and arguably a duplication less.