def test_imagesetfactory(centroid_files, dials_regression): from dxtbx.imageset import ImageSetFactory, ImageSweep filenames = centroid_files sweep = ImageSetFactory.new(filenames) assert isinstance(sweep[0], ImageSweep) template = os.path.join(dials_regression, "centroid_test_data", "centroid_####.cbf") image_range = (3, 6) sweep = ImageSetFactory.from_template(template, image_range) assert isinstance(sweep[0], ImageSweep) assert len(sweep[0]) == 4 assert sweep[0].paths()[0].endswith("3.cbf") assert sweep[0].paths()[-1].endswith("6.cbf") imageset = ImageSetFactory.make_imageset(filenames) assert len(imageset) == 9 imageset = ImageSetFactory.make_imageset(filenames, check_format=False) assert len(imageset) == 9 sweep = ImageSetFactory.make_sweep(template, list(range(1, 9 + 1))) assert len(sweep) == 9 sweep = ImageSetFactory.make_sweep(template, list(range(3, 6 + 1))) assert len(sweep) == 4
def test_imagesetfactory(centroid_files, dials_data): sequence = ImageSetFactory.new(centroid_files) assert isinstance(sequence[0], ImageSequence) template = dials_data("centroid_test_data").join( "centroid_####.cbf").strpath image_range = (3, 6) sequence = ImageSetFactory.from_template(template, image_range) assert isinstance(sequence[0], ImageSequence) assert len(sequence[0]) == 4 assert sequence[0].paths()[0].endswith("3.cbf") assert sequence[0].paths()[-1].endswith("6.cbf") imageset = ImageSetFactory.make_imageset(centroid_files) assert len(imageset) == 9 imageset = ImageSetFactory.make_imageset(centroid_files, check_format=False) assert len(imageset) == 9 sequence = ImageSetFactory.make_sequence(template, list(range(1, 9 + 1))) assert len(sequence) == 9 sequence = ImageSetFactory.make_sequence(template, list(range(3, 6 + 1))) assert len(sequence) == 4
def run(self): from dxtbx.imageset import ImageSetFactory, ImageSweep from os.path import join filenames = self.get_file_list() sweep = ImageSetFactory.new(filenames) assert(isinstance(sweep[0], ImageSweep) == True) print 'OK' template = join(dials_regression, "centroid_test_data", "centroid_####.cbf") image_range = (3, 6) sweep = ImageSetFactory.from_template(template, image_range) assert(isinstance(sweep[0], ImageSweep) == True) assert len(sweep[0]) == 4 assert sweep[0].paths()[0].endswith("3.cbf") assert sweep[0].paths()[-1].endswith("6.cbf") print 'OK' imageset = ImageSetFactory.make_imageset(filenames) assert len(imageset) == 9 print 'OK' imageset = ImageSetFactory.make_imageset( filenames, check_format=False) assert len(imageset) == 9 print 'OK' sweep = ImageSetFactory.make_sweep( template, list(range(1, 9+1))) assert len(sweep) == 9 print 'OK' sweep = ImageSetFactory.make_sweep( template, list(range(3, 6+1))) assert len(sweep) == 4 print 'OK'
def _make_stills(self, imageset): ''' Make a still imageset. ''' from dxtbx.imageset import ImageSetFactory from dxtbx.serialize.filename import load_path filenames = [load_path(p) for p in imageset['images']] return ImageSetFactory.make_imageset( filenames, None, check_format=self._check_format)
def run(self, experiments, reflections): from dials.util import log self.logger.log_step_time("INTEGRATE") logfile = os.path.splitext( self.logger.rank_log_file_path)[0] + "_integrate.log" log.config(logfile=logfile) processor = integrate_only_processor(self.params) # Re-generate the image sets using their format classes so we can read the raw data # Integrate the experiments one at a time to not use up memory all_integrated = flex.reflection_table() for expt_id, expt in enumerate(experiments): expt.imageset = ImageSetFactory.make_imageset( expt.imageset.paths(), single_file_indices=expt.imageset.indices()) refls = reflections.select( reflections['exp_id'] == expt.identifier) idents = refls.experiment_identifiers() del idents[expt_id] idents[0] = expt.identifier refls['id'] = flex.int(len(refls), 0) integrated = processor.integrate(experiments[expt_id:expt_id + 1], refls) idents = integrated.experiment_identifiers() del idents[0] idents[expt_id] = expt.identifier integrated['id'] = flex.int(len(integrated), expt_id) all_integrated.extend(integrated) expt.imageset.clear_cache() return experiments, reflections
def lunus_integrate(self, experiments, is_reference=False): assert len(experiments) == 1 experiment_params = get_experiment_params(experiments) p = self.processor # self.logger.log("LUNUS_INTEGRATE: Passed %s %d" % (experiments[0].imageset.paths()[0],experiments[0].imageset.indices()[0])) if self.current_path != experiments[0].imageset.paths()[0]: self.current_imageset = ImageSetFactory.make_imageset( experiments[0].imageset.paths()) idx = experiments[0].imageset.indices()[0] experiments[0].imageset = self.current_imageset[idx:idx + 1] self.logger.log("LUNUS_INTEGRATE: Processing image %s %d" % (experiments[0].imageset.paths()[0], experiments[0].imageset.indices()[0])) data = experiments[0].imageset[0] if not isinstance(data, tuple): data = data, for panel_idx, panel in enumerate(data): self.processor.set_image(panel_idx, panel) # self.logger.log("LUNUS_INTEGRATE: file %s panel_idx %d panel[0:10] = %s " % (experiments[0].imageset.paths()[0],panel_idx,str(list(panel[0:10])))) for pidx in range(len(experiment_params)): deck_and_extras = self.deck + experiment_params[pidx] p.LunusSetparamsim(pidx, deck_and_extras) # self.logger.log("LUNUS: Processing image") if is_reference: x = get_experiment_xvectors(experiments) for pidx in range(len(x)): p.set_xvectors(pidx, x[pidx]) # We need an amatrix for the next call, to set up the lattice size if self.params.merging.set_average_unit_cell: assert 'average_unit_cell' in (self.params.statistics).__dict__ uc = self.params.statistics.__phil_get__('average_unit_cell') else: uc = self.params.scaling.unit_cell assert uc is not None, "Lunus needs a target unit cell" A_matrix = matrix.sqr(uc.orthogonalization_matrix()) At_flex = A_matrix.transpose().as_flex_double_matrix() p.set_amatrix(At_flex) p.LunusProcimlt(0) else: crystal = experiments[0].crystal A_matrix = matrix.sqr(crystal.get_A()).inverse() At_flex = A_matrix.transpose().as_flex_double_matrix() p.set_amatrix(At_flex) p.LunusProcimlt(1)
def _make_stills(self, imageset, format_kwargs=None): ''' Make a still imageset. ''' from dxtbx.imageset import ImageSetFactory from dxtbx.serialize.filename import load_path filenames = [load_path(p) for p in imageset['images']] indices = None if "single_file_indices" in imageset: indices = imageset['single_file_indices'] assert len(indices) == len(filenames) return ImageSetFactory.make_imageset( filenames, None, check_format=self._check_format, single_file_indices=indices, format_kwargs=format_kwargs)
def _make_stills(self, imageset, format_kwargs=None): ''' Make a still imageset. ''' from dxtbx.imageset import ImageSetFactory from dxtbx.serialize.filename import load_path filenames = [load_path(p) for p in imageset['images']] indices = None if "single_file_indices" in imageset: indices = imageset['single_file_indices'] assert len(indices) == len(filenames) return ImageSetFactory.make_imageset( filenames, None, check_format=self._check_format, single_file_indices=indices, format_kwargs=format_kwargs)
def run(self, experiments, reflections): self.logger.log_step_time("INTEGRATE") # Re-generate the image sets using their format classes so we can read the raw data for expt in experiments: expt.imageset = ImageSetFactory.make_imageset( expt.imageset.paths(), single_file_indices=expt.imageset.indices()) processor = integrate_only_processor(self.params) reflections = processor.integrate(experiments, reflections) return experiments, reflections
def run(self, experiments, reflections): from dials.util import log self.logger.log_step_time("INTEGRATE") logfile = os.path.splitext( self.logger.rank_log_file_path)[0] + "_integrate.log" log.config(logfile=logfile) processor = integrate_only_processor(self.params) # Re-generate the image sets using their format classes so we can read the raw data # Integrate the experiments one at a time to not use up memory all_integrated_expts = ExperimentList() all_integrated_refls = flex.reflection_table() current_imageset = None current_imageset_path = None for expt_id, expt in enumerate(experiments): assert len(expt.imageset.paths()) == 1 and len(expt.imageset) == 1 self.logger.log("Starting integration experiment %d" % expt_id) refls = reflections.select( reflections['exp_id'] == expt.identifier) if expt.imageset.paths()[0] != current_imageset_path: current_imageset_path = expt.imageset.paths()[0] current_imageset = ImageSetFactory.make_imageset( expt.imageset.paths()) idx = expt.imageset.indices()[0] expt.imageset = current_imageset[idx:idx + 1] idents = refls.experiment_identifiers() del idents[expt_id] idents[0] = expt.identifier refls['id'] = flex.int(len(refls), 0) try: integrated = processor.integrate( experiments[expt_id:expt_id + 1], refls) except RuntimeError: self.logger.log("Error integrating expt %d" % expt_id) continue all_integrated_expts.append(expt) idents = integrated.experiment_identifiers() del idents[0] idents[expt_id] = expt.identifier integrated['id'] = flex.int(len(integrated), len(all_integrated_expts) - 1) all_integrated_refls.extend(integrated) self.logger.log("Integration done, %d experiments, %d reflections" % (len(all_integrated_expts), len(all_integrated_refls))) return all_integrated_expts, all_integrated_refls
def _make_stills(self, imageset, format_kwargs=None): """ Make a still imageset. """ filenames = [ load_path(p, directory=self._directory) for p in imageset["images"] ] indices = None if "single_file_indices" in imageset: indices = imageset["single_file_indices"] assert len(indices) == len(filenames) return ImageSetFactory.make_imageset( filenames, None, check_format=self._check_format, single_file_indices=indices, format_kwargs=format_kwargs, )
def _create_multi_file_imageset(self, format_class, records, format_kwargs=None): ''' Create a multi file sweep or imageset. ''' from dxtbx.imageset import ImageSetFactory from os.path import abspath # Make either an imageset or sweep if len(records) == 1 and records[0].template is not None: # Get the image range image_range = records[0].scan.get_image_range() image_range = (image_range[0], image_range[1]+1) # Create the sweep imageset = ImageSetFactory.make_sweep( abspath(records[0].template), range(*image_range), format_class, records[0].beam, records[0].detector, records[0].goniometer, records[0].scan, format_kwargs=format_kwargs) else: # Get the filenames filenames = [] for r in records: assert(r.template is None) filenames.append(r.filename) # make an imageset imageset = ImageSetFactory.make_imageset( map(abspath, filenames), format_class, format_kwargs=format_kwargs) for i, r in enumerate(records): imageset.set_beam(r.beam, i) imageset.set_detector(r.detector, i) imageset.set_goniometer(r.goniometer, i) imageset.set_scan(r.scan, i) # Return the imageset return imageset
img = dxtbx.load(imgname) # detector = img.get_detector() # beam = img.get_beam() scan = img.get_scan() gonio = img.get_goniometer() print "s0 from ",imgname,": ",beam.get_s0() print "wavelength from ",imgname,": ",beam.get_wavelength() crystal = copy.deepcopy(experiments.crystals()[0]) axis = gonio.get_rotation_axis() start_angle, delta_angle = scan.get_oscillation() crystal.rotate_around_origin(axis, start_angle + (delta_angle/2), deg=True) if (output_format == "json"): exp_list = ExperimentList() exp_list.append(Experiment(imageset=ImageSetFactory.make_imageset(list([imgname])), beam=beam, detector=detector, goniometer=gonio, scan=scan, crystal=crystal)) if (add_background_images==True): if (len(bkglist) != 1): bkgname=bkglist[i] else: bkgname=bkglist[0] exp_list[0].imageset.external_lookup.pedestal.filename=os.path.abspath(bkgname) dump.experiment_list(exp_list,json_dir+"/experiments_for_lunus_{0:05d}.json".format(imnum)) else: from scitbx import matrix A_matrix = matrix.sqr(crystal.get_A()).inverse()
def _load_datablocks(self, obj, check_format=True): ''' Create the datablock from a dictionary. ''' from libtbx.containers import OrderedDict from dxtbx.format.Registry import Registry from dxtbx.model import Beam, Detector, Scan from dxtbx.model import Detector from dxtbx.serialize.filename import load_path from dxtbx.imageset import ImageSetFactory, ImageGrid # If we have a list, extract for each dictionary in the list if isinstance(obj, list): return [self._load_datablocks(dd, check_format) for dd in obj] elif not isinstance(obj, dict): raise RuntimeError('unknown datablock dictionary type') assert(obj['__id__'] == 'DataBlock') # Get the list of models blist = obj.get('beam', []) dlist = obj.get('detector', []) glist = obj.get('goniometer', []) slist = obj.get('scan', []) def load_models(obj): try: beam = Beam.from_dict(blist[obj['beam']]) except Exception: beam = None try: dobj = dlist[obj['detector']] detector = Detector.from_dict(dobj) except Exception: detector = None try: from dxtbx.serialize import goniometer gonio = goniometer.from_dict(glist[obj['goniometer']]) except Exception: gonio = None try: scan = Scan.from_dict(slist[obj['scan']]) except Exception: scan = None return beam, detector, gonio, scan # Loop through all the imagesets imagesets = [] for imageset in obj['imageset']: ident = imageset['__id__'] if "params" in imageset: format_kwargs = imageset['params'] else: format_kwargs = {} if ident == 'ImageSweep': beam, detector, gonio, scan = load_models(imageset) if "template" in imageset: template = load_path(imageset['template']) i0, i1 = scan.get_image_range() iset = ImageSetFactory.make_sweep( template, range(i0, i1+1), None, beam, detector, gonio, scan, check_format, format_kwargs=format_kwargs) if 'mask' in imageset and imageset['mask'] is not None: imageset['mask'] = load_path(imageset['mask']) iset.external_lookup.mask.filename = imageset['mask'] if check_format: with open(imageset['mask']) as infile: iset.external_lookup.mask.data = pickle.load(infile) if 'gain' in imageset and imageset['gain'] is not None: imageset['gain'] = load_path(imageset['gain']) iset.external_lookup.gain.filename = imageset['gain'] if check_format: with open(imageset['gain']) as infile: iset.external_lookup.gain.data = pickle.load(infile) if 'pedestal' in imageset and imageset['pedestal'] is not None: imageset['pedestal'] = load_path(imageset['pedestal']) iset.external_lookup.pedestal.filename = imageset['pedestal'] if check_format: with open(imageset['pedestal']) as infile: iset.external_lookup.pedestal.data = pickle.load(infile) elif "master" in imageset: template = load_path(imageset['master']) i0, i1 = scan.get_image_range() indices = imageset['images'] assert min(indices) == i0-1 and max(indices) == i1-1 iset = ImageSetFactory.make_sweep( template, range(i0, i1+1), None, beam, detector, gonio, scan, check_format, format_kwargs=format_kwargs) if 'mask' in imageset and imageset['mask'] is not None: imageset['mask'] = load_path(imageset['mask']) iset.external_lookup.mask.filename = imageset['mask'] if check_format: with open(imageset['mask']) as infile: iset.external_lookup.mask.data = pickle.load(infile) if 'gain' in imageset and imageset['gain'] is not None: imageset['gain'] = load_path(imageset['gain']) iset.external_lookup.gain.filename = imageset['gain'] if check_format: with open(imageset['gain']) as infile: iset.external_lookup.gain.data = pickle.load(infile) if 'pedestal' in imageset and imageset['pedestal'] is not None: imageset['pedestal'] = load_path(imageset['pedestal']) iset.external_lookup.pedestal.filename = imageset['pedestal'] if check_format: with open(imageset['pedestal']) as infile: iset.external_lookup.pedestal.data = pickle.load(infile) imagesets.append(iset) elif ident == 'ImageSet' or ident == "ImageGrid": filenames = [image['filename'] for image in imageset['images']] indices = [image['image'] for image in imageset['images'] if 'image' in image] assert len(indices) == 0 or len(indices) == len(filenames) iset = ImageSetFactory.make_imageset( filenames, None, check_format, indices, format_kwargs=format_kwargs) if ident == "ImageGrid": grid_size = imageset['grid_size'] iset = ImageGrid.from_imageset(iset, grid_size) for i, image in enumerate(imageset['images']): beam, detector, gonio, scan = load_models(image) iset.set_beam(beam, i) iset.set_detector(detector, i) iset.set_goniometer(gonio, i) iset.set_scan(scan, i) if 'mask' in imageset and imageset['mask'] is not None: imageset['mask'] = load_path(imageset['mask']) iset.external_lookup.mask.filename = imageset['mask'] if check_format: with open(imageset['mask']) as infile: iset.external_lookup.mask.data = pickle.load(infile) if 'gain' in imageset and imageset['gain'] is not None: imageset['gain'] = load_path(imageset['gain']) iset.external_lookup.gain.filename = imageset['gain'] if check_format: with open(imageset['gain']) as infile: iset.external_lookup.gain.data = pickle.load(infile) if 'pedestal' in imageset and imageset['pedestal'] is not None: imageset['pedestal'] = load_path(imageset['pedestal']) iset.external_lookup.pedestal.filename = imageset['pedestal'] if check_format: with open(imageset['pedestal']) as infile: iset.external_lookup.pedestal.data = pickle.load(infile) imagesets.append(iset) else: raise RuntimeError('expected ImageSet/ImageSweep, got %s' % ident) # Return the datablock return DataBlock(imagesets)
def _load_datablocks(self, obj, check_format=True): ''' Create the datablock from a dictionary. ''' from libtbx.containers import OrderedDict from dxtbx.format.Registry import Registry from dxtbx.model import Beam, Detector, Goniometer, Scan from dxtbx.model import HierarchicalDetector from dxtbx.serialize.filename import load_path from dxtbx.imageset import ImageSetFactory import pickle # If we have a list, extract for each dictionary in the list if isinstance(obj, list): return [self._load_datablocks(dd, check_format) for dd in obj] elif not isinstance(obj, dict): raise RuntimeError('unknown datablock dictionary type') assert(obj['__id__'] == 'DataBlock') # Get the list of models blist = obj.get('beam', []) dlist = obj.get('detector', []) glist = obj.get('goniometer', []) slist = obj.get('scan', []) def load_models(obj): try: beam = Beam.from_dict(blist[obj['beam']]) except Exception: beam = None try: dobj = dlist[obj['detector']] if 'hierarchy' in dobj: detector = HierarchicalDetector.from_dict(dobj) else: detector = Detector.from_dict(dobj) except Exception: detector = None try: gonio = Goniometer.from_dict(glist[obj['goniometer']]) except Exception: gonio = None try: scan = Scan.from_dict(slist[obj['scan']]) except Exception: scan = None return beam, detector, gonio, scan # Loop through all the imagesets imagesets = [] for imageset in obj['imageset']: ident = imageset['__id__'] if ident == 'ImageSweep': beam, detector, gonio, scan = load_models(imageset) template = load_path(imageset['template']) i0, i1 = scan.get_image_range() iset = ImageSetFactory.make_sweep( template, range(i0, i1+1), None, beam, detector, gonio, scan, check_format) if 'mask' in imageset and imageset['mask'] is not None: imageset['mask'] = load_path(imageset['mask']) iset.external_lookup.mask.filename = imageset['mask'] if check_format: with open(imageset['mask']) as infile: iset.external_lookup.mask.data = pickle.load(infile) if 'gain' in imageset and imageset['gain'] is not None: imageset['gain'] = load_path(imageset['gain']) iset.external_lookup.gain.filename = imageset['gain'] if check_format: with open(imageset['gain']) as infile: iset.external_lookup.gain.data = pickle.load(infile) if 'pedestal' in imageset and imageset['pedestal'] is not None: imageset['pedestal'] = load_path(imageset['pedestal']) iset.external_lookup.pedestal.filename = imageset['pedestal'] if check_format: with open(imageset['pedestal']) as infile: iset.external_lookup.pedestal.data = pickle.load(infile) imagesets.append(iset) elif ident == 'ImageSet': filenames = [image['filename'] for image in imageset['images']] iset = ImageSetFactory.make_imageset( filenames, None, check_format) for i, image in enumerate(imageset['images']): beam, detector, gonio, scan = load_models(image) iset.set_beam(beam, i) iset.set_detector(detector, i) if gonio: iset.set_goniometer(gonio, i) if scan: iset.set_scan(scan, i) if 'mask' in imageset and imageset['mask'] is not None: imageset['mask'] = load_path(imageset['mask']) iset.external_lookup.mask.filename = imageset['mask'] if check_format: with open(imageset['mask']) as infile: iset.external_lookup.mask.data = pickle.load(infile) if 'gain' in imageset and imageset['gain'] is not None: imageset['gain'] = load_path(imageset['gain']) iset.external_lookup.gain.filename = imageset['gain'] if check_format: with open(imageset['gain']) as infile: iset.external_lookup.gain.data = pickle.load(infile) if 'pedestal' in imageset and imageset['pedestal'] is not None: imageset['pedestal'] = load_path(imageset['pedestal']) iset.external_lookup.pedestal.filename = imageset['pedestal'] if check_format: with open(imageset['pedestal']) as infile: iset.external_lookup.pedestal.data = pickle.load(infile) imagesets.append(iset) else: raise RuntimeError('expected ImageSet/ImageSweep, got %s' % ident) # Return the datablock return DataBlock(imagesets)
img = dxtbx.load(imgname) detector = img.get_detector() beam = img.get_beam() scan = img.get_scan() gonio = img.get_goniometer() print "s0 from ",imgname,": ",beam.get_s0() print "wavelength from ",imgname,": ",beam.get_wavelength() crystal = copy.deepcopy(experiments.crystals()[0]) axis = gonio.get_rotation_axis() start_angle, delta_angle = scan.get_oscillation() crystal.rotate_around_origin(axis, start_angle + (delta_angle/2), deg=True) if (output_format == "json"): exp_list = ExperimentList() exp_list.append(Experiment(imageset=ImageSetFactory.make_imageset(list([imgname])), beam=beam, detector=detector, goniometer=gonio, scan=scan, crystal=crystal)) if (add_background_images==True): if (len(bkglist) != 1): bkgname=bkglist[i] exp_list[0].imageset.external_lookup.pedestal.filename=os.path.abspath(bkgname) dump.experiment_list(exp_list,json_dir+"/experiments_for_lunus_{0:05d}.json".format(imnum)) else: from scitbx import matrix A_matrix = matrix.sqr(crystal.get_A()).inverse() At = np.asarray(A_matrix.transpose()).reshape((3,3)) print At
def import_xds_as_still(xdsinp, xparm_in): #from dxtbx.serialize import xds from dxtbx.datablock import DataBlockFactory # Get the sweep from the XDS files #sweep = xds.to_imageset(xds_inp, xds_other) from iotbx.xds import xds_inp from dxtbx.imageset import ImageSetFactory import dxtbx # Read the input filename handle = xds_inp.reader() handle.read_file(xdsinp) # Get the template template = handle.name_template_of_data_frames[0] image_range = handle.data_range detector_name = handle.detector #assert image_range[0] == image_range[1] im_nr = int((image_range[1] - image_range[0] + 1) / 2) from yamtbx.dataproc.dataset import template_to_filenames # Create the imageset #imageset = ImageSetFactory.from_template(template, image_range=image_range, check_format=False)[0] imageset = ImageSetFactory.make_imageset( [os.path.realpath(template_to_filenames(template, im_nr, im_nr)[0])]) models = dxtbx.load(xparm_in) detector = models.get_detector() if detector_name.strip() in ('PILATUS', 'EIGER') or handle.silicon is not None: from dxtbx.model import ParallaxCorrectedPxMmStrategy from cctbx.eltbx import attenuation_coefficient if handle.silicon is None: table = attenuation_coefficient.get_table("Si") wavelength = models.get_beam().get_wavelength() mu = table.mu_at_angstrom(wavelength) / 10.0 else: mu = handle.silicon t0 = handle.sensor_thickness for panel in detector: panel.set_px_mm_strategy(ParallaxCorrectedPxMmStrategy(mu, t0)) panel.set_trusted_range( (handle.minimum_valid_pixel_value, handle.overload)) imageset.set_beam(models.get_beam()) imageset.set_detector(detector) imageset.set_goniometer(None) imageset.set_scan(None) #imageset.set_goniometer(models.get_goniometer()) # take the image range from XDS.INP #scan = models.get_scan() #scan.set_image_range(image_range) #imageset.set_scan(scan) from dxtbx.serialize import xds # Get the crystal from the XDS files crystal = xds.to_crystal(xparm_in) # Create the experiment list experiments = ExperimentListFactory.from_imageset_and_crystal( imageset, crystal) # Set the crystal in the experiment list assert (len(experiments) == 1) # Return the experiment list return experiments