def complete(self):
     #print('storing', self.name, 'in', self._full_path)
     if not self._ready_to_collect:
         raise RuntimeError("must called kickoff() method before calling complete()")
     # Stop adding new data to the file.
     set_and_wait(self.enable_sel, 1)
     return NullStatus()
 def complete(self):
     print('complete', self.name, '| filepath', self._full_path)
     if not self._ready_to_collect:
         raise RuntimeError(
             "must called kickoff() method before calling complete()")
     # Stop adding new data to the file.
     set_and_wait(self.enable_sel, 1)
     return NullStatus()
 def collect(self):
     "Call adc.collect() for every encoder."
     # Stop writing data to the file in all encoders.
     for attr_name in ['adc1']: #, 'adc2', 'adc3', 'adc4']:
         set_and_wait(getattr(self, attr_name).enable_sel, 0)
     # Now collect the data accumulated by all encoders.
     for attr_name in ['adc1']: #, 'adc2', 'adc3', 'adc4']:
         yield from getattr(self, attr_name).collect()
 def collect(self):
     "Call encoder.collect() for every encoder."
     # Stop writing data to the file in all encoders.
     for attr_name in ['enc1', 'enc2', 'enc3', 'enc4']:
         set_and_wait(getattr(self, attr_name).ignore_sel, 1)
     # Now collect the data accumulated by all encoders.
     for attr_name in ['enc1', 'enc2', 'enc3', 'enc4']:
         yield from getattr(self, attr_name).collect()
 def unstage(self):
     if (self.connected):
         set_and_wait(self.enable_sel, 1)
         # either master or slave can unstage if needed, safer
         self._staged_adc = False
         self._kickoff_adc = False
         self._complete_adc = False
         return super().unstage()
 def collect(self):
     "Call adc.collect() for every encoder."
     # Stop writing data to the file in all encoders.
     for attr_name in ['adc1']:  #, 'adc2', 'adc3', 'adc4']:
         set_and_wait(getattr(self, attr_name).enable_sel, 0)
     # Now collect the data accumulated by all encoders.
     for attr_name in ['adc1']:  #, 'adc2', 'adc3', 'adc4']:
         yield from getattr(self, attr_name).collect()
 def collect(self):
     "Call encoder.collect() for every encoder."
     # Stop writing data to the file in all encoders.
     for attr_name in ['enc1', 'enc2', 'enc3', 'enc4']:
         set_and_wait(getattr(self, attr_name).ignore_sel, 1)
     # Now collect the data accumulated by all encoders.
     for attr_name in ['enc1', 'enc2', 'enc3', 'enc4']:
         yield from getattr(self, attr_name).collect()
 def complete(self):
     #print('s', self.name, 'in', self._full_path)
     if not self._ready_to_collect:
         raise RuntimeError("must called kickoff() method before calling complete()")
     # Stop adding new data to the file.
     set_and_wait(self.ignore_sel, 1)
     #while not os.path.isfile(self._full_path):
     #    ttime.sleep(.1)
     return NullStatus()
    def kickoff(self):
        print('kickoff', self.name)
        self._ready_to_collect = True
        "Start writing data into the file."

        set_and_wait(self.ignore_sel, 0)

        # Return a 'status object' that immediately reports we are 'done' ---
        # ready to collect at any time.
        return NullStatus()
    def kickoff(self):
        print('kickoff', self.name)
        self._ready_to_collect = True
        "Start writing data into the file."

        set_and_wait(self.enable_sel, 0)

        # Return a 'status object' that immediately reports we are 'done' ---
        # ready to collect at any time.
        return NullStatus()
Exemple #11
0
    def unstage(self):
        """A custom unstage method is needed to avoid these messages:

        Still capturing data .... waiting.
        Still capturing data .... waiting.
        Still capturing data .... waiting.
        Still capturing data .... giving up.
        """
        set_and_wait(self.capture, 0)
        return super().unstage()
 def complete(self):
     print('storing', self.name, 'in', self._full_path)
     if not self._ready_to_collect:
         raise RuntimeError(
             "must called kickoff() method before calling complete()")
     # Stop adding new data to the file.
     set_and_wait(self.ignore_sel, 1)
     #while not os.path.isfile(self._full_path):
     #    ttime.sleep(.1)
     return NullStatus()
Exemple #13
0
    def warmup(self):
        """
        A convenience method for 'priming' the plugin.
        The plugin has to 'see' one acquisition before it is ready to capture.
        This sets the array size, etc.
        NOTE : this comes from:
            https://github.com/NSLS-II/ophyd/blob/master/ophyd/areadetector/plugins.py
        We had to replace "cam" with "settings" here.
        Also modified the stage sigs.
        """
        print(whisper("                warming up the hdf5 plugin..."))
        set_and_wait(self.enable, 1)
        sigs = OrderedDict([(self.parent.settings.array_callbacks, 1),
                            (self.parent.settings.trigger_mode, 'Internal'),
                            # just in case the acquisition time is set very long...
                            (self.parent.settings.acquire_time, 1),
                            # (self.capture, 1),
                            (self.parent.settings.acquire, 1)])

        original_vals = {sig: sig.get() for sig in sigs}

        # Remove the hdf5.capture item here to avoid an error as it should reset back to 0 itself
        # del original_vals[self.capture]

        for sig, val in sigs.items():
            ttime.sleep(0.1)  # abundance of caution
            set_and_wait(sig, val)

        ttime.sleep(2)  # wait for acquisition

        for sig, val in reversed(list(original_vals.items())):
            ttime.sleep(0.1)
            set_and_wait(sig, val)
        print(whisper("                done"))
Exemple #14
0
    def kickoff(self, *args, **kwargs):
        set_and_wait(self.det.trig_source, 1)

        # TODO: handle it on the plan level
        # set_and_wait(self.motor, 'prepare')

        def callback(value, old_value, **kwargs):
            print(f"kickoff: {ttime.ctime()} {old_value} ---> {value}")
            if int(round(old_value)) == 0 and int(round(value)) == 1:
                # Now start mono move
                self._motor_status = self.motor.set("start")
                return True
            else:
                return False

        streaming_st = SubscriptionStatus(self.det.streaming, callback)
        self.det.stream.set(1)
        self.det.stage()
        for pb in self.pbs:
            pb.stage()
            pb.kickoff()
        return streaming_st
 def unstage(self):
     set_and_wait(self.ignore_sel, 1)
     return super().unstage()
Exemple #16
0
 def move(self, *args, **kwargs):
     if self.brake.get() == 0:
         set_and_wait(self.brake, 1)
     return super().move(*args, **kwargs)
 def unstage(self):
     if(self.connected):
         set_and_wait(self.enable_sel, 1)
         return super().unstage()
 def unstage(self):
     if (self.connected):
         set_and_wait(self.ignore_sel, 1)
         return super().unstage()
     else:
         raise RuntimeError("Not connected")
 def unstage(self):
     if (self.connected):
         set_and_wait(self.enable_sel, 1)
         return super().unstage()
"Watch for shutter to close and open."
from bluesky.plans import pchain, wait, abs_set
from ophyd import set_and_wait

# simple signal-based approach

set_and_wait(shctl1, 1)
set_and_wait(shctl1, 0)
set_and_wait(shctl1, 1)

# better Device-based approach
# RE(pchain(abs_set(shutter, 'Open'), wait(), abs_set(shutter, 'Close'), wait(),
#     abs_set(shutter, 'Open'), wait()))
 def unstage(self):
     set_and_wait(self.ignore_sel, 1)
     return super().unstage()