-
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 26 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 |
---|---|---|
|
@@ -44,13 +44,14 @@ class P11DetectorCover(AbstractShutter): | |
|
||
@unique | ||
class BaseValueEnum(Enum): | ||
"""Defines only the compulsory values.""" | ||
OPEN = "OPEN" | ||
CLOSED = "CLOSED" | ||
MOVING = "MOVING" | ||
UNKNOWN = "UNKNOWN" | ||
|
||
VALUES=BaseValueEnum | ||
"""Defines only the compulsory values.""" | ||
|
||
OPEN = "OPEN" | ||
CLOSED = "CLOSED" | ||
MOVING = "MOVING" | ||
UNKNOWN = "UNKNOWN" | ||
|
||
VALUES = BaseValueEnum | ||
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. As it inherits from AbstractShutter, no need to do this. Please see my comment comment below |
||
|
||
def __init__(self, name): | ||
|
||
|
@@ -196,14 +197,8 @@ def simulated_update(self): | |
|
||
self.update_value(value) | ||
return value | ||
|
||
def is_open(self): | ||
"""Check if the shutter is open. | ||
Returns: | ||
(bool): True if open, False otherwise. | ||
""" | ||
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. 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. |
||
"""Check if the shutter is closed. | ||
Returns: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,23 @@ def __init__(self, name): | |
self.edna_default_file = None | ||
self.start_edna_command = None | ||
|
||
def _run_edna(self, input_file, results_file, process_directory): | ||
"""Starts EDNA""" | ||
msg = "Starting EDNA characterisation using xml file %s" % input_file | ||
logging.getLogger("queue_exec").info(msg) | ||
|
||
args = (self.start_edna_command, input_file, results_file, process_directory) | ||
# subprocess.call("%s %s %s %s" % args, shell=True) | ||
|
||
# Test run DESY | ||
self.edna_maxwell(process_directory, input_file, results_file) | ||
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. Whats edna_maxwell ? 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 is the way to start EDNA on the cluster with proper path substitution. Is there a better way? In xml is the path to the edna bash script i assume? Is it run locally? |
||
|
||
self.result = None | ||
if os.path.exists(results_file): | ||
self.result = XSDataResultMXCuBE.parseFile(results_file) | ||
|
||
return self.result | ||
|
||
def edna_maxwell(self, process_directory, inputxml, outputxml): | ||
""" | ||
The function `edna_maxwell` is used to execute a command on a remote cluster using SSH and SBATCH. | ||
|
@@ -105,6 +122,12 @@ def edna_maxwell(self, process_directory, inputxml, outputxml): | |
) | ||
) | ||
|
||
print( | ||
'{ssh:s} "{sbatch:s} --wrap \\"{cmd:s}"\\"'.format( | ||
ssh=ssh, sbatch=sbatch, cmd=cmd | ||
) | ||
) | ||
|
||
os.system( | ||
'{ssh:s} "{sbatch:s} --wrap \\"{cmd:s}"\\"'.format( | ||
ssh=ssh, sbatch=sbatch, cmd=cmd | ||
|
@@ -236,15 +259,24 @@ def input_from_params(self, data_collection, char_params): | |
acquisition_parameters = data_collection.acquisitions[0].acquisition_parameters | ||
path_template = data_collection.acquisitions[0].path_template | ||
|
||
# Make sure there is a proper path conversion between different mount points | ||
print( | ||
"======= Characterisation path template ====", path_template.directory | ||
) # /gpfs/current/raw | ||
|
||
image_dir = path_template.directory.replace( | ||
"/gpfs/current", triggerUtils.get_beamtime_metadata()[2] | ||
) | ||
|
||
print(image_dir) | ||
|
||
path_str = os.path.join(image_dir, path_template.get_image_file_name()) | ||
print(path_template.xds_dir) | ||
|
||
characterisation_dir = path_template.xds_dir.replace( | ||
"/autoprocessing_", "/characterisation_" | ||
) | ||
|
||
os.makedirs(characterisation_dir, mode=0o755, exist_ok=True) | ||
|
||
for img_num in range(int(acquisition_parameters.num_images)): | ||
|
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 |
||
|
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.
Just out of curiosity what did this do ?
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.
Looks interesting :)
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.
It was the "plug" for creation of the snapshots before i realized that probably EDNA is doing that. But it is still pending. I've removed it for now as it was for the test.