Skip to content

Commit

Permalink
refs #10530. Apply scaling.
Browse files Browse the repository at this point in the history
This wan't right first time round.
  • Loading branch information
OwenArnold committed Nov 19, 2014
1 parent df6eb0b commit 9295c92
Showing 1 changed file with 7 additions and 4 deletions.
Expand Up @@ -208,20 +208,23 @@ def __scale_projection(self, (u, v, w), origin_units, target_units, to_cut):
if set(origin_units) == set(target_units):
return (u,v,w) # Nothing to do.

ol = to_cut.getExperimentInfo(0).run().sample().getOrientedLattice()
ol = to_cut.getExperimentInfo(0).sample().getOrientedLattice()

d_star_w = 2 * np.pi * ol.dstar(u, v, w)
projection_scaled = [u, v, w]

to_from_pairs = zip(origin_units, target_units)
for i in range(len(to_from_pairs)) :

proj = projection_scaled[i]
d_star = 2 * np.pi * ol.dstar( float(proj[0]), float(proj[1]), float(proj[2]) )

from_unit, to_unit = to_from_pairs[i]
if from_unit == to_unit:
continue
elif from_unit == ProjectionUnit.a: # From inverse Angstroms to rlu
projection_scaled[i] *= d_star_w
projection_scaled[i] *= d_star
else: # From rlu to inverse Anstroms
projection_scaled[i] /= d_star_w
projection_scaled[i] /= d_star
return projection_scaled


Expand Down

0 comments on commit 9295c92

Please sign in to comment.