def observation(): from dials.model.data import Observation obs = Observation() obs.panel = 1 obs.centroid.px.position = (100, 200, 300) obs.centroid.px.variance = (10, 20, 30) obs.centroid.px.std_err_sq = (1, 2, 3) obs.centroid.mm.position = (100.1, 200.1, 300.1) obs.centroid.mm.variance = (10.1, 20.1, 30.1) obs.centroid.mm.std_err_sq = (1.1, 2.1, 3.1) obs.intensity.observed.value = 1234 obs.intensity.observed.variance = 42 obs.intensity.corrected.value = 1234.1 obs.intensity.corrected.variance = 42.1 return obs
def get_dials_obs(px_positions, px_var, px_sq_err, mm_positions, mm_var, mm_sq_err): ''' gets obs array used to create shoeboxes ''' from dials.model.data import Intensity, Centroid, CentroidData, Observation obs = flex.observation() for iobs in range(len(px_positions)): obs.append( Observation( panel=0, centroid=Centroid( px=CentroidData(position=(px_positions[iobs][0], px_positions[iobs][1], 0), variance=(px_var[iobs][0], px_var[iobs][1], px_var[iobs][2]), std_err_sq=(px_sq_err[iobs][0], px_sq_err[iobs][1], px_sq_err[iobs][2])), mm=CentroidData(position=(mm_positions[iobs][0], mm_positions[iobs][1], 0), variance=(mm_var[iobs][0], mm_var[iobs][1], mm_var[iobs][2]), std_err_sq=(px_sq_err[iobs][0], px_sq_err[iobs][1], px_sq_err[iobs][2]))), intensity=Intensity(observed_value=1.0, observed_variance=1.0, observed_success=True))) return obs
def __init__(self): from dials.model.data import Observation self.obs = Observation() self.obs.panel = 1 self.obs.centroid.px.position = (100, 200, 300) self.obs.centroid.px.variance = (10, 20, 30) self.obs.centroid.px.std_err_sq = (1, 2, 3) self.obs.centroid.mm.position = (100.1, 200.1, 300.1) self.obs.centroid.mm.variance = (10.1, 20.1, 30.1) self.obs.centroid.mm.std_err_sq = (1.1, 2.1, 3.1) self.obs.intensity.observed.value = 1234 self.obs.intensity.observed.variance = 42 self.obs.intensity.corrected.value = 1234.1 self.obs.intensity.corrected.variance = 42.1
def test_equality(observation): from dials.model.data import Observation obs2 = Observation(observation) assert obs2 == observation obs2.panel += 1 assert obs2 != observation obs2 = Observation(observation) obs2.centroid.px.position = (0, 0, 0) assert obs2 != observation obs2 = Observation(observation) obs2.centroid.px.variance = (0, 0, 0) assert obs2 != observation obs2 = Observation(observation) obs2.centroid.px.std_err_sq = (0, 0, 0) assert obs2 != observation obs2 = Observation(observation) obs2.centroid.mm.position = (0, 0, 0) assert obs2 != observation obs2 = Observation(observation) obs2.centroid.mm.variance = (0, 0, 0) assert obs2 != observation obs2 = Observation(observation) obs2.centroid.mm.std_err_sq = (0, 0, 0) assert obs2 != observation obs2 = Observation(observation) obs2.intensity.observed.value = 0 assert obs2 != observation obs2 = Observation(observation) obs2.intensity.observed.variance = 0 assert obs2 != observation obs2 = Observation(observation) obs2.intensity.corrected.value = 0 assert obs2 != observation obs2 = Observation(observation) obs2.intensity.corrected.variance = 0 assert obs2 != observation
def tst_equality(self): from dials.model.data import Observation obs2 = Observation(self.obs) assert (obs2 == self.obs) obs2.panel += 1 assert (obs2 != self.obs) obs2 = Observation(self.obs) obs2.centroid.px.position = (0, 0, 0) assert (obs2 != self.obs) obs2 = Observation(self.obs) obs2.centroid.px.variance = (0, 0, 0) assert (obs2 != self.obs) obs2 = Observation(self.obs) obs2.centroid.px.std_err_sq = (0, 0, 0) assert (obs2 != self.obs) obs2 = Observation(self.obs) obs2.centroid.mm.position = (0, 0, 0) assert (obs2 != self.obs) obs2 = Observation(self.obs) obs2.centroid.mm.variance = (0, 0, 0) assert (obs2 != self.obs) obs2 = Observation(self.obs) obs2.centroid.mm.std_err_sq = (0, 0, 0) assert (obs2 != self.obs) obs2 = Observation(self.obs) obs2.intensity.observed.value = 0 assert (obs2 != self.obs) obs2 = Observation(self.obs) obs2.intensity.observed.variance = 0 assert (obs2 != self.obs) obs2 = Observation(self.obs) obs2.intensity.corrected.value = 0 assert (obs2 != self.obs) obs2 = Observation(self.obs) obs2.intensity.corrected.variance = 0 assert (obs2 != self.obs) print 'OK'