def save_file(self, file): self.widgets.status.configure(text='Saving Spectra...') self.widgets.elapsed_real.configure(text=' ') self.med.write_file(file) self.widgets.status.configure(text='Ready') self.next_file = Xrf.increment_filename(file) self.widgets.file.entryconfigure('Save Next*', label='Save Next = ' + self.next_file) self.widgets.save_next.configure(text='Save Next = ' + self.next_file)
def spectra_scan(self, first_file, scan_record): """ Collects Mca spectra and saves them to disk in conjunction with an EPICS scan record. Inputs: first_file: The name of the first spectrum file to save. Subsequent files will be named using the Xrf.increment_filename()function. The filename must end in a numeric extension for this to work. scan_record: The name of the EPICS scan record which is controlling the scan. This scan record must be configure to start epicsMca data collection by writing "1" into the ERST field if the EPICS MCA. Procedure: 1) Waits for scan.EXSC = 1, meaning scan has started 2) Waits for ClientWait=1, meaning acquisition has started 3) Waits for Acquiring=0, meaning acquisition has completed 4) Writes data to disk with epicsMca::write_file, increment file name 5) Resets ClientWait to 0 so scan will continue 6) If scan.EXSC is still 1 go to 2. """ file = first_file # Enable waiting for client self.pvs['acquire']['enable_wait'].putw(1) # Create PV for scan record executing scanPV = epicsPV.epicsPV(scan_record + '.EXSC') # Wait for scan to start while (scanPV.getw() == 0): time.sleep(.1) while (1): # If scan is complete, exit if (scanPV.getw() == 0): return # Wait for acquisition to start self.wait(start=1, stop=0) # Wait for acquisition to complete self.wait(start=0, stop=1) # Write file. This will reset the client wait flag. self.write_file(file) print 'Saved file: ', file file = Xrf.increment_filename(file)
def spectra_scan(self, first_file, scan_record): """ PURPOSE: This procedures collects Med spectra and saves them to disk in conjunction with an EPICS scan record. epics_med.spectra_scan(first_file, scan_record) INPUTS: first_file: The name of the first spectrum file to save. Subsequent files will be named using the INCREMENT_FILENAME()function. The filename must end in a numeric extension for this to work. scan_record: The name of the EPICS scan record which is controlling the scan. This scan record must be configure to start epicsMed data collection by writing "1" into the EraseStart record of the EPICS MED database. PROCEDURE: 1) Wait for scan.EXSC = 1, meaning scan has started 2) Wait for ClientWait=1, meaning acquisition has started 3) Wait for Acquiring=0, meaning acquisition has completed 4) Write data to disk with MED::WRITE_FILE, increment file name 5) Reset ClientWait to 0 so scan will continue 6) If scan.EXSC is still 1 go to 2. """ file = first_file # Enable waiting for client self.pvs.enable_client_wait.putw(1) # Create PV for scan record executing scanPV = epicsPV.epicsPV(scan_record + '.EXSC') # Wait for scan to start while (scanPV.getw() == 0): time.sleep(.1) while (1): # If scan is complete, exit if (scanPV.getw() == 0): return # Wait for acquisition to start self.wait(start=1, stop=0) # Wait for acquisition to complete self.wait(start=0, stop=1) # Write file. This resets the client wait flag self.write_file(file) print 'Saved file: ', file file = Xrf.increment_filename(file)
try: self.foreground.scan.write_file(file) except Exception, e: reply = tkMessageBox.showerror(title='scanDisplay error', message = 'Unable to open file: ' + file + ' ' + e) return self.options.save_done = 1 if (self.options.inform_save): top = self.widgets.save_file_top = Toplevel() Pmw.MessageDialog(top, buttons=('OK',), defaultbutton=0, message_text='Successfully saved as file: ' + file, command=self.save_file_acknowledge) top.after(2000,self.save_file_acknowledge) self.file.next_filename = Xrf.increment_filename(file) self.widgets.file.entryconfigure('Save Next*', label='Save Next = ' + self.file.next_filename) def save_file_acknowledge(self, button=None): self.widdgets.save_file_top.after_cancel() self.widgets.save_file_top.destroy() ############################################################ def update_marker_text(self, marker): if (marker == 'cursor'): chan = self.display.cursor pos_widget = self.widgets.cur_pos count_widget = self.widgets.cur_counts elif (marker == 'left'): chan = self.display.lmarker