def load_instrument_config(self): fname = f'default_{self.instrument.lower()}_config.yml' with resource_loader.resource_path(hexrd.ui.resources.calibration, fname) as f: for overlay in HexrdConfig().overlays: overlay['visible'] = False HexrdConfig().load_instrument_config(f)
def create_shape(self, module, file_name): with resource_loader.resource_path(module, file_name) as f: data = np.loadtxt(f) verts = self.panels['default'].cartToPixel(data) verts[:, [0, 1]] = verts[:, [1, 0]] self.shape = patches.Polygon(verts, fill=False, lw=1) self.connect_translate() self.raw_axes.add_patch(self.shape) self.redraw()
def load_instrument_config(self): temp = tempfile.NamedTemporaryFile(delete=False, suffix='.yml') self.config_file = temp.name HexrdConfig().save_instrument_config(self.config_file) fname = f'default_{self.instrument.lower()}_config.yml' with resource_loader.resource_path( hexrd.ui.resources.calibration, fname) as f: for overlay in HexrdConfig().overlays: overlay['visible'] = False HexrdConfig().load_instrument_config(f, import_raw=True)
def create_shape(self, module, file_name, det): with resource_loader.resource_path(module, file_name) as f: data = np.loadtxt(f) verts = self.panels[det].cartToPixel(data) verts[:, [0, 1]] = verts[:, [1, 0]] self.shape = patches.Polygon(verts, fill=False, lw=1, color='cyan') self.center = self.get_midpoint() self.connect_translate() self.raw_axes.add_patch(self.shape) self.redraw()
def create_shape(self, module, file_name, det, instr): with resource_loader.resource_path(module, file_name) as f: data = np.loadtxt(f) verts = self.panels['default'].cartToPixel(data) verts[:, [0, 1]] = verts[:, [1, 0]] self.shape = patches.Polygon(verts, fill=False, lw=1, color='cyan') self.shape_styles.append({'line': '-', 'width': 1, 'color': 'cyan'}) self.center = self.get_midpoint() self.update_position(instr, det) self.connect_translate() self.raw_axes = self.parent.raw_axes[0] self.raw_axes.add_patch(self.shape) self.redraw()
def load_instrument_config(self, name): fname = 'default_' + name.lower() + '_config.yml' with resource_loader.resource_path(hexrd.ui.resources.calibration, fname) as f: HexrdConfig().load_instrument_config(f)