Skip to content

Commit

Permalink
2016.08.11. Added changing machine current to MachineInfoMockup
Browse files Browse the repository at this point in the history
	* Added print in ISPyBClient2Mockup to print values that will be sent to ispyb
	* Added missing methods if ispyb used
	* deleted Qt4_DiffractometerMockup.py
  • Loading branch information
IvarsKarpics committed Aug 11, 2016
1 parent 48e4c68 commit 41a9144
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 285 deletions.
3 changes: 3 additions & 0 deletions BeamInfoMockup.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,6 @@ def get_aperture_pos_name(self):

def get_focus_mode(self):
return

def get_shape(self):
return self.beam_info_dict["shape"]
6 changes: 4 additions & 2 deletions DetectorMockup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ def get_distance_limits(self):
return [100, 1000]

def has_shutterless(self):
"""
Descript. :
"""Returns always True
"""
return True

def get_beam_centre(self):
return 0, 0
7 changes: 6 additions & 1 deletion ISPyBClient2Mockup.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def isInhouseUser(self, proposal_code, proposal_number):



def store_data_collection(self, mx_collection, beamline_setup = None):
def store_data_collection(self, mx_collection, beamline_setup=None):
"""
Stores the data collection mx_collection, and the beamline setup
if provided.
Expand All @@ -163,6 +163,11 @@ def store_data_collection(self, mx_collection, beamline_setup = None):
:returns: None
"""
logging.getLogger("HWR").debug("Data collection parameters stored " + \
"in ISPyB: %s" % str(mx_collection))
logging.getLogger("HWR").debug("Beamline setup stored in ISPyB: %s" % \
str(beamline_setup))

return None, None


Expand Down
26 changes: 21 additions & 5 deletions MachineInfoMockup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
# You should have received a copy of the GNU General Public License
# along with MXCuBE. If not, see <http://www.gnu.org/licenses/>.

import logging
import time
from datetime import datetime, timedelta
from gevent import spawn
from random import uniform

from HardwareRepository.BaseHardwareObjects import HardwareObject


Expand All @@ -41,10 +42,13 @@ def __init__(self, name):
#Intensity current ranges
self.values_list = []
temp_dict = {}
temp_dict['value'] = 100.1
temp_dict['value'] = 90.1
temp_dict['value_str'] = "90.1 mA"
temp_dict['in_range'] = True
temp_dict['title'] = "Machine current"
temp_dict['bold'] = True
temp_dict['font'] = 14
temp_dict['history'] = True
self.values_list.append(temp_dict)

temp_dict = {}
Expand All @@ -55,19 +59,22 @@ def __init__(self, name):

temp_dict = {}
temp_dict['value'] = 24.4
temp_dict['value_str'] = "24.4 C"
temp_dict['in_range'] = True
temp_dict['title'] = "Hutch temperature"
self.values_list.append(temp_dict)

temp_dict = {}
temp_dict['value'] = 64.4
temp_dict['value_str'] = "64.4 %"
temp_dict['in_range'] = True
temp_dict['title'] = "Hutch humidity"
self.values_list.append(temp_dict)

temp_dict = {}
temp_dict['value'] = 4e11
temp_dict['in_range'] = None
temp_dict['value_str'] = "4e+11 ph/s"
temp_dict['in_range'] = False
temp_dict['title'] = "Flux"
self.values_list.append(temp_dict)

Expand All @@ -76,7 +83,8 @@ def init(self):
Descript.
"""
self.update_values()

spawn(self.change_mach_current)

def update_values(self):
"""
Descript. : Updates storage disc information, detects if intensity
Expand All @@ -101,3 +109,11 @@ def get_message(self):
Descript :
"""
return self.values_list[1]['value']

def change_mach_current(self):
while True:
self.values_list[0]['value'] = uniform(80.1, 90.1)
self.values_list[0]['value_str'] = "%.1f mA" % \
self.values_list[0]['value']
self.update_values()
time.sleep(5)
277 changes: 0 additions & 277 deletions Qt4_DiffractometerMockup.py

This file was deleted.

0 comments on commit 41a9144

Please sign in to comment.