def __init__(self, grid_data, linewidth): self.grid_data = grid_data self.linewidth = linewidth Grid_Data.__init__(self, grid_data.size, origin = grid_data.origin, step = grid_data.step)
def __init__(self, hdf_data, size, value_type, origin, step, cell_angles, rotation, symmetries, image_name, array_paths): self.hdf_data = hdf_data self.array_paths = array_paths from os.path import basename name = basename(hdf_data.path) if image_name and image_name != name.rsplit('.', 1)[0]: name += ' ' + image_name Grid_Data.__init__(self, size, value_type, origin, step, cell_angles, rotation, name=name, path=hdf_data.path, file_type='cmap', grid_id=sorted(array_paths)[0]) if not symmetries is None and len(symmetries) > 0: self.symmetries = symmetries
def __init__(self, priism_data, wd): self.wavelength_data = wd from os.path import basename if wd.wavelength == 0: name = basename(priism_data.path) else: name = '%s %d' % (basename(priism_data.path), wd.wavelength) size = priism_data.data_size xyz_step = priism_data.data_step xyz_origin = map(lambda a, b: a * b, priism_data.data_origin, xyz_step) value_type = wd.element_type wavelength = wd.wavelength opacity = 1 wcolors = {460: (0, .7, .7, opacity), # cyan 535: (0, .7, 0, opacity), # green 605: (.7, 0, 0, opacity), # red 690: (0, 0, .7, opacity), # blue } if wavelength in wcolors: initial_color = wcolors[wavelength] else: initial_color = (.7, .7, .7, opacity) # white Grid_Data.__init__(self, size, value_type, xyz_origin, xyz_step, name = name, path = priism_data.path, file_type = 'priism', grid_id = str(wd.wave_index), default_color = initial_color) self.num_times = priism_data.num_times
def __init__(self, array, origin=(0, 0, 0), step=(1, 1, 1), cell_angles=(90, 90, 90), rotation=((1, 0, 0), (0, 1, 0), (0, 0, 1)), symmetries=(), name=''): self.array = array path = '' file_type = '' component_name = '' grid_size = list(array.shape) grid_size.reverse() value_type = array.dtype Grid_Data.__init__(self, grid_size, value_type, origin, step, cell_angles=cell_angles, rotation=rotation, symmetries=symmetries, name=name, path=path, file_type=file_type) self.writable = True
def __init__(self, grid_data, axis_order): self.grid_data = g = grid_data self.axis_order = ao = axis_order Grid_Data.__init__(self, permute(g.size,ao), g.value_type, permute(g.origin,ao), permute(g.step,ao), g.cell_angles, g.rotation, g.symmetries, name = g.name + ' permuted', default_color = g.rgba)
def __init__(self, grid_data): from numpy import int8 size = map(lambda s: s-2, grid_data.size) xyz_origin = map(lambda o, s: o + s, grid_data.origin, grid_data.step) Grid_Data.__init__(self, size, int8, xyz_origin, grid_data.step, default_color = grid_data.rgba)
def __init__(self, paths): import imagestack_format d = imagestack_format.Image_Stack_Data(paths) self.image_stack = d Grid_Data.__init__(self, d.data_size, d.value_type, d.data_origin, d.data_step, path = d.paths, file_type = 'imagestack')
def __init__(self, grid_data, scale, shift, value_type): self.grid_data = g = grid_data self.scale = scale self.shift = shift self.value_type = vt = (value_type or g.value_type) Grid_Data.__init__(self, g.size, vt, g.origin, g.step, g.cell_angles, g.rotation, g.symmetries, name = g.name + ' scaled', default_color = g.rgba)
def __init__(self, path): import em_format d = em_format.EM_Data(path) self.em_data = d Grid_Data.__init__(self, d.data_size, d.element_type, d.data_origin, d.data_step, path = path, file_type = 'tom_em')
def __init__(self, grid_data, linewidth): self.grid_data = grid_data self.linewidth = linewidth Grid_Data.__init__(self, grid_data.size, origin=grid_data.origin, step=grid_data.step)
def __init__(self, path): import macmolplt_format md = macmolplt_format.MacMolPlt_Data(path) self.macmolplt_data = md Grid_Data.__init__(self, md.grid_size, origin = md.origin, step = md.step, path = path, file_type = 'macmolplt')
def __init__(self, grid_data, array_func): self.array_func = array_func Grid_Data.__init__(self, grid_data.size, grid_data.value_type, grid_data.origin, grid_data.step, name=grid_data.name, default_color=grid_data.rgba)
def __init__(self, data, t): self.data = data self.time = t Grid_Data.__init__(self, data.size, data.value_type, data.origin, data.step, name = '%s t=%d' % (data.name, t), file_type = data.file_type, default_color = data.rgba)
def __init__(self, path, file_type = 'mrc'): import mrc_format d = mrc_format.MRC_Data(path, file_type) self.mrc_data = d Grid_Data.__init__(self, d.data_size, d.element_type, d.data_origin, d.data_step, d.cell_angles, d.rotation, path = path, file_type = file_type)
def __init__(self, path): import situs_format sm = situs_format.SITUS_Density_Map(path) self.density_map = sm step = (sm.voxel_size, sm.voxel_size, sm.voxel_size) Grid_Data.__init__(self, sm.grid_size, origin = sm.origin, step = step, path = path, file_type = 'situs')
def __init__(self, path): import spider_format d = spider_format.SPIDER_Data(path) self.spider_data = d origin = map(lambda a, b: a * b, d.data_origin, d.data_step) Grid_Data.__init__(self, d.data_size, origin = origin, step = d.data_step, path = path, file_type = 'spider')
def __init__(self, grid_data, bin_size): self.grid_data = g = grid_data self.bin_size = bin_size size = [s/b for s,b in zip(g.size, bin_size)] step = [s*b for s,b in zip(g.step, bin_size)] origin = [o+0.5*(s-gs) for o,s,gs in zip(g.origin, step, g.step)] Grid_Data.__init__(self, size, g.value_type, origin, step, g.cell_angles, g.rotation, g.symmetries, name = g.name + ' binned', default_color = g.rgba)
def __init__(self, eman_hdf_data, size, value_type, origin, step, array_path): self.eman_hdf_data = eman_hdf_data self.array_path = array_path Grid_Data.__init__(self, size, value_type, origin, step, path = eman_hdf_data.path, file_type = 'emanhdf', grid_id = array_path)
def __init__(self, path): import delphi_format dd = delphi_format.DelPhi_Data(path) self.delphi_data = dd Grid_Data.__init__(self, dd.size, dd.value_type, origin = dd.xyz_origin, step = dd.xyz_step, path = path, file_type = 'delphi') self.polar_values = True
def __init__(self, primary_grid_data): pg = primary_grid_data self.available_subsamplings = {(1,1,1): pg} Grid_Data.__init__(self, pg.size, pg.value_type, pg.origin, pg.step, pg.cell_angles, pg.rotation, pg.symmetries, name = pg.name, path = pg.path, file_type = pg.file_type, grid_id = pg.grid_id, default_color = pg.rgba) self.data_cache = None # Caching done by underlying grid objects.
def __init__(self, path): import pif_format d = pif_format.PIF_Data(path) self.pif_data = d Grid_Data.__init__(self, d.data_size, d.element_type, d.data_origin, d.data_step, d.cell_angles, path = path, file_type = 'pif') self.polar_values = True # These maps are frequently inverted.
def __init__(self, path): import profec_format eg = profec_format.PROFEC_Potential(path) self.energy_grid = eg import Matrix r = Matrix.orthogonalize(eg.rotation) Grid_Data.__init__(self, eg.grid_size, origin = eg.origin, step = eg.step, rotation = r, path = path, file_type = 'profec')
def __init__(self, path): import uhbd_format d = uhbd_format.UHBD_Data(path) self.uhbd_data = d Grid_Data.__init__(self, d.data_size, origin = d.data_origin, step = d.data_step, path = path, file_type = 'uhbd') self.polar_values = True
def __init__(self, path): import apbs_format ad = apbs_format.APBS_Data(path) self.apbs_data = ad Grid_Data.__init__(self, ad.grid_size, origin = ad.xyz_origin, step = ad.xyz_step, path = path, file_type = 'apbs') self.polar_values = True
def __init__(self, path): import macmolplt_format md = macmolplt_format.MacMolPlt_Data(path) self.macmolplt_data = md Grid_Data.__init__(self, md.grid_size, origin=md.origin, step=md.step, path=path, file_type='macmolplt')
def __init__(self, grid_data): d = grid_data self.data = d Grid_Data.__init__(self, d.size, d.value_type, d.origin, d.step, d.cell_angles, d.rotation, d.symmetries, name = d.name + ' z flip', file_type = d.file_type, default_color = d.rgba) self.data_cache = None # Caching done by underlying grid.
def __init__(self, path): import plt_format dm = plt_format.Plt_map(path) self.density_map = dm size = dm.extent Grid_Data.__init__(self, size, origin = dm.origin, step = dm.grid, path = path, file_type = 'gopenmol') self.polar_values = True
def __init__(self, path): """__init__(path) - wraps RawIV data as grid data. """ rawiv_data = rawiv_format.RawIV_Data(path) self.rawiv_data = rawiv_data size = rawiv_data.data_size xyz_step = rawiv_data.data_step xyz_origin = rawiv_data.data_origin Grid_Data.__init__(self, size, rawiv_data.element_type, xyz_origin, xyz_step, path = path, file_type = 'rawiv')
def __init__(self, data, t): self.data = data self.time = t Grid_Data.__init__(self, data.size, data.value_type, data.origin, data.step, name='%s t=%d' % (data.name, t), file_type=data.file_type, default_color=data.rgba)
def __init__(self, paths): import imagestack_format d = imagestack_format.Image_Stack_Data(paths) self.image_stack = d Grid_Data.__init__(self, d.data_size, d.value_type, d.data_origin, d.data_step, path=d.paths, file_type='imagestack')
def __init__(self, path): import xplor_format xm = xplor_format.XPLOR_Density_Map(path) self.density_map = xm step = map(lambda cs, gs: cs / gs, xm.cell_size, (xm.na, xm.nb, xm.nc)) from VolumeData.griddata import scale_and_skew origin = scale_and_skew((xm.amin, xm.bmin, xm.cmin), step, xm.cell_angles) Grid_Data.__init__(self, xm.grid_size, origin = origin, step = step, cell_angles = xm.cell_angles, path = path, file_type = 'xplor')
def __init__(self, path): import uhbd_format d = uhbd_format.UHBD_Data(path) self.uhbd_data = d Grid_Data.__init__(self, d.data_size, origin=d.data_origin, step=d.data_step, path=path, file_type='uhbd') self.polar_values = True
def __init__(self, eman_hdf_data, size, value_type, origin, step, array_path): self.eman_hdf_data = eman_hdf_data self.array_path = array_path Grid_Data.__init__(self, size, value_type, origin, step, path=eman_hdf_data.path, file_type='emanhdf', grid_id=array_path)
def __init__(self, path): import profec_format eg = profec_format.PROFEC_Potential(path) self.energy_grid = eg import Matrix r = Matrix.orthogonalize(eg.rotation) Grid_Data.__init__(self, eg.grid_size, origin=eg.origin, step=eg.step, rotation=r, path=path, file_type='profec')
def __init__(self, grid_data, axis_order): self.grid_data = g = grid_data self.axis_order = ao = axis_order Grid_Data.__init__(self, permute(g.size, ao), g.value_type, permute(g.origin, ao), permute(g.step, ao), g.cell_angles, g.rotation, g.symmetries, name=g.name + ' permuted', default_color=g.rgba)
def __init__(self, path): import apbs_format ad = apbs_format.APBS_Data(path) self.apbs_data = ad Grid_Data.__init__(self, ad.grid_size, origin=ad.xyz_origin, step=ad.xyz_step, path=path, file_type='apbs') self.polar_values = True
def __init__(self, path): import dsn6_format dm = dsn6_format.dsn6_map(path) self.density_map = dm size = dm.extent step = dm.cell[:3] / dm.grid cell_angles = tuple(dm.cell[3:]) from VolumeData.griddata import scale_and_skew origin = scale_and_skew(dm.origin, step, cell_angles) from numpy import float32 Grid_Data.__init__(self, size, float32, origin, step, cell_angles, path = path, file_type = 'dsn6')
def __init__(self, path): import delphi_format dd = delphi_format.DelPhi_Data(path) self.delphi_data = dd Grid_Data.__init__(self, dd.size, dd.value_type, origin=dd.xyz_origin, step=dd.xyz_step, path=path, file_type='delphi') self.polar_values = True
def __init__(self, path): import plt_format dm = plt_format.Plt_map(path) self.density_map = dm size = dm.extent Grid_Data.__init__(self, size, origin=dm.origin, step=dm.grid, path=path, file_type='gopenmol') self.polar_values = True
def __init__(self, dock_data, component_name): d = dock_data self.dock_data = d self.component_name = component_name path = d.path from os.path import basename name = basename(path) + ' ' + component_name Grid_Data.__init__(self, d.data_size, d.value_type(component_name), d.data_origin, d.data_step, name = name, path = path, file_type = 'dock', grid_id = component_name, default_color = d.color(component_name))
def __init__(self, gc, component_number): self.gc = gc self.component_number = component_number # TODO: Axes need not be a rotation. Use cell_angles and rotation. axes = gc.grid_axes rot = tuple([tuple([axes[a][b] for a in (0,1,2)]) for b in (0,1,2)]) Grid_Data.__init__(self, gc.grid_size, origin = gc.origin, step = gc.step, rotation = rot, path = gc.path, file_type = 'gaussian', grid_id = str(component_number)) self.polar_values = True
def __init__(self, grid_data, mode, cell_size): self.grid_data = grid_data self.mode = mode self.cell_size = cell_size size = map(lambda s, cs: s / cs, grid_data.size, cell_size) if mode == 'sample': xyz_origin = grid_data.origin else: xyz_origin = map(lambda a, b, c: a + b * 0.5 * (c - 1), grid_data.origin, grid_data.step, cell_size) xyz_step = map(lambda step, cs: step * cs, grid_data.step, cell_size) value_type = grid_data.value_type Grid_Data.__init__(self, size, value_type, xyz_origin, xyz_step)
def __init__(self, grid_data, mode, cell_size): self.grid_data = grid_data self.mode = mode self.cell_size = cell_size size = map(lambda s, cs: s / cs, grid_data.size, cell_size) if mode == 'sample': xyz_origin = grid_data.origin else: xyz_origin = map(lambda a,b,c: a + b*0.5*(c-1), grid_data.origin, grid_data.step, cell_size) xyz_step = map(lambda step, cs: step*cs, grid_data.step, cell_size) value_type = grid_data.value_type Grid_Data.__init__(self, size, value_type, xyz_origin, xyz_step)
def __init__(self, path, file_type='mrc'): import mrc_format d = mrc_format.MRC_Data(path, file_type) self.mrc_data = d Grid_Data.__init__(self, d.data_size, d.element_type, d.data_origin, d.data_step, d.cell_angles, d.rotation, path=path, file_type=file_type)
def __init__(self, grid_data, scale, shift, value_type): self.grid_data = g = grid_data self.scale = scale self.shift = shift self.value_type = vt = (value_type or g.value_type) Grid_Data.__init__(self, g.size, vt, g.origin, g.step, g.cell_angles, g.rotation, g.symmetries, name=g.name + ' scaled', default_color=g.rgba)
def __init__(self, grid_data): d = grid_data self.data = d Grid_Data.__init__(self, d.size, d.value_type, d.origin, d.step, d.cell_angles, d.rotation, d.symmetries, name=d.name + ' z flip', file_type=d.file_type, default_color=d.rgba) self.data_cache = None # Caching done by underlying grid.
def __init__(self, mode, grid_data_1, grid_data_2): if grid_data_1.size != grid_data_2.size: sys.stderr.write('Grid sizes %s %s differ\n' % (str(grid_data_1.size), str(grid_data_2.size))) sys.exit(1) self.mode = mode self.grid_data_1 = grid_data_1 self.grid_data_2 = grid_data_2 Grid_Data.__init__(self, grid_data_1.size, grid_data_1.value_type, grid_data_1.origin, grid_data_1.step, default_color=grid_data_1.rgba)
def __init__(self, path): import xplor_format xm = xplor_format.XPLOR_Density_Map(path) self.density_map = xm step = map(lambda cs, gs: cs / gs, xm.cell_size, (xm.na, xm.nb, xm.nc)) from VolumeData.griddata import scale_and_skew origin = scale_and_skew((xm.amin, xm.bmin, xm.cmin), step, xm.cell_angles) Grid_Data.__init__(self, xm.grid_size, origin=origin, step=step, cell_angles=xm.cell_angles, path=path, file_type='xplor')
def __init__(self, dock_data, component_name): d = dock_data self.dock_data = d self.component_name = component_name path = d.path from os.path import basename name = basename(path) + ' ' + component_name Grid_Data.__init__(self, d.data_size, d.value_type(component_name), d.data_origin, d.data_step, name=name, path=path, file_type='dock', grid_id=component_name, default_color=d.color(component_name))
def __init__(self, gc, component_number): self.gc = gc self.component_number = component_number # TODO: Axes need not be a rotation. Use cell_angles and rotation. axes = gc.grid_axes rot = tuple( [tuple([axes[a][b] for a in (0, 1, 2)]) for b in (0, 1, 2)]) Grid_Data.__init__(self, gc.grid_size, origin=gc.origin, step=gc.step, rotation=rot, path=gc.path, file_type='gaussian', grid_id=str(component_number)) self.polar_values = True
def __init__(self, path): import dsn6_format dm = dsn6_format.dsn6_map(path) self.density_map = dm size = dm.extent step = dm.cell[:3] / dm.grid cell_angles = tuple(dm.cell[3:]) from VolumeData.griddata import scale_and_skew origin = scale_and_skew(dm.origin, step, cell_angles) from numpy import float32 Grid_Data.__init__(self, size, float32, origin, step, cell_angles, path=path, file_type='dsn6')
def __init__(self, priism_data, wd): self.wavelength_data = wd from os.path import basename if wd.wavelength == 0: name = basename(priism_data.path) else: name = '%s %d' % (basename(priism_data.path), wd.wavelength) size = priism_data.data_size xyz_step = priism_data.data_step xyz_origin = map(lambda a, b: a * b, priism_data.data_origin, xyz_step) value_type = wd.element_type wavelength = wd.wavelength opacity = 1 wcolors = { 460: (0, .7, .7, opacity), # cyan 535: (0, .7, 0, opacity), # green 605: (.7, 0, 0, opacity), # red 690: (0, 0, .7, opacity), # blue } if wavelength in wcolors: initial_color = wcolors[wavelength] else: initial_color = (.7, .7, .7, opacity) # white Grid_Data.__init__(self, size, value_type, xyz_origin, xyz_step, name=name, path=priism_data.path, file_type='priism', grid_id=str(wd.wave_index), default_color=initial_color) self.num_times = priism_data.num_times
def __init__(self, path, grid_size, origin, step, cell_angles, rotation, netcdf_array): self.netcdf_array = netcdf_array from os.path import basename if netcdf_array.descriptive_name in ('', '0'): name = basename(path) else: name = '%s %s' % (basename(path), netcdf_array.descriptive_name) Grid_Data.__init__(self, grid_size, netcdf_array.dtype, origin, step, cell_angles, rotation, name=name, path=path, file_type='netcdf', grid_id=netcdf_array.variable_name, default_color=netcdf_array.color)
def __init__(self, array, origin = (0,0,0), step = (1,1,1), cell_angles = (90,90,90), rotation = ((1,0,0),(0,1,0),(0,0,1)), symmetries = (), name = ''): self.array = array path = '' file_type = '' component_name = '' grid_size = list(array.shape) grid_size.reverse() value_type = array.dtype Grid_Data.__init__(self, grid_size, value_type, origin, step, cell_angles = cell_angles, rotation = rotation, symmetries = symmetries, name = name, path = path, file_type = file_type) self.writable = True
def __init__(self, grid_data, array_func): self.array_func = array_func Grid_Data.__init__(self, grid_data.size, grid_data.value_type, grid_data.origin, grid_data.step, name = grid_data.name, default_color = grid_data.rgba)