예제 #1
0
 def validate_IPTS(self, s):
     ipts1 = self.text.value.encode()
     facility = self.context.config.facility
     instrument = self.context.config.instrument
     path = os.path.abspath('/%s/%s/IPTS-%s' %
                            (facility, instrument, ipts1))
     if not os.path.exists(path):
         s = "Cannot open directory %s ! Please check IPTS number" % path
         js_alert(s)
     else:
         self.context.config.ipts = ipts = ipts1
         # use your experiment IPTS number
         self.context.config.iptsdir = iptsdir = path
         # path to the directory with ct, ob, and df data files or subdirs
         datadir = self.context.config.datadir = os.path.join(
             iptsdir, "raw/")
         # make sure there is ct scan directory
         self.context.config.ct_scan_root = ct_scan_root = os.path.join(
             datadir, 'ct_scans')
         ct_scan_subdirs = [
             d for d in os.listdir(ct_scan_root)
             if os.path.isdir(os.path.join(ct_scan_root, d))
         ]
         self.context.config.ct_scan_subdirs = ct_scan_subdirs
         self.nextStep()
     return
예제 #2
0
 def validate(self, s):
     v = [i.encode() for i in self.select.value]
     if not v:
         js_alert("Please select at least one DF file")
         return
     config = self.context.config
     config.df_files = [os.path.join(config.df_dir, f) for f in v]
     self.remove()
     self.nextStep()
     return
예제 #3
0
 def validate(self, s):
     instrument = self.text.value.encode()
     if instrument.lower() not in self.instruments.keys():
         s = "instrument %s not supported!" % instrument
         js_alert(s)
     else:
         self.context.config.instrument = instrument.upper()
         self.context.config.facility = self.instruments[
             instrument.lower()].upper()
         self.nextStep()
     return
예제 #4
0
 def validate(self, s):
     v = self.text.value
     if not v:
         s = 'Please specify a name for your tomography scan'
         js_alert(s)
     else:
         self.context.config.scan = v.encode()
         self.remove()
         wd_panel = WorkDirPanel(self.context, self.context.config.scan)
         wd_panel.show()
     return
예제 #5
0
 def removeSelectedDir(self, s):
     self.remove()
     wait = ipyw.HTML(value="<p>Removing. Please wait...</p>")
     display(wait)
     time.sleep(0.2)
     import shutil
     if os.path.islink(self.path_candidate):
         os.unlink(self.path_candidate)
     else:
         try:
             shutil.rmtree(self.path_candidate)
         except:
             wait.close()
             js_alert("Unable to remove directory tree %s" %
                      self.path_candidate)
             self.askForDir(s)
             return
     wait.close()
     self.selected = self.path_candidate
     self.nextStep()
     return
예제 #6
0
 def _check_space(self):
     free_in_G = get_space(self.root)
     if free_in_G < 200:
         js_alert(
             "%s only has %s GB left. Reconstruction may encounter problems."
             % (self.root, int(free_in_G)))