Repository : ssh://g18-sc-serv-04.diamond.ac.uk/dials_scratch
On branch : master
commit 6abbd99aac33cf20240f5daef86ffa15044cd82b
Author: James Beilsten-Edmands <[log in to unmask]>
Date: Thu Mar 22 14:50:09 2018 +0000
Cleaning out old code.
6abbd99aac33cf20240f5daef86ffa15044cd82b
jbe/scaling_code/scaler.py | 15 ++++-----------
jbe/scaling_code/scaling_helper.h | 12 +++++-------
2 files changed, 9 insertions(+), 18 deletions(-)
diff --git a/jbe/scaling_code/scaler.py b/jbe/scaling_code/scaler.py
index 382cca5..dc9db99 100644
--- a/jbe/scaling_code/scaler.py
+++ b/jbe/scaling_code/scaler.py
@@ -7,6 +7,7 @@ from cctbx import miller, crystal
from scitbx import sparse
from dials_scaling_helpers_ext import row_multiply
import iotbx.merging_statistics
+from libtbx.containers import OrderedSet
from dials_scratch.jbe.scaling_code.basis_functions import basis_function
from dials_scratch.jbe.scaling_code.scaling_utilities import (sph_harm_table,
reject_outliers, calculate_wilson_outliers, calc_normE2)
@@ -924,27 +925,19 @@ class TargetScaler(MultiScalerBase):
# scaling against calculated Is
self._experiments = unscaled_experiments[0]
target_Ih_table = self.Ih_table
- from libtbx.containers import OrderedSet
target_asu_Ih_dict = dict(zip(target_Ih_table.asu_miller_index,
target_Ih_table.Ih_values))
for scaler in unscaled_scalers:
- scaler.Ih_table._Ih_table['Ih_values'] = flex.double(scaler.Ih_table.size, 0.0)
- #set to zero to allow selection below
+ scaler.Ih_table._Ih_table['Ih_values'] = flex.double(
+ scaler.Ih_table.size, 0.0) # set to zero to allow selection below
location_in_unscaled_array = 0
for j, miller_idx in enumerate(OrderedSet(scaler.Ih_table.asu_miller_index)):
- #sel = target_Ih_table.asu_miller_index == miller_idx
- #Ih_values = target_Ih_table.Ih_values.select(sel)
n_in_group = scaler.Ih_table.h_index_matrix.col(j).non_zeroes
if miller_idx in target_asu_Ih_dict:
i = location_in_unscaled_array
- Ih = flex.double([target_asu_Ih_dict[miller_idx]] * n_in_group)
+ Ih = flex.double(n_in_group, target_asu_Ih_dict[miller_idx])
scaler.Ih_table.Ih_values.set_selected(
flex.size_t(range(i, i + n_in_group)), Ih)
- '''if Ih_values:
- i = location_in_unscaled_array
- Ih = flex.double([copy.copy(Ih_values[0])] * n_in_group)
- scaler.Ih_table.Ih_values.set_selected(
- flex.size_t(range(i, i + n_in_group)), Ih)'''
location_in_unscaled_array += n_in_group
sel = scaler.Ih_table.Ih_values != 0.0
scaler.Ih_table = scaler.Ih_table.select(sel)
diff --git a/jbe/scaling_code/scaling_helper.h b/jbe/scaling_code/scaling_helper.h
index 187f171..f6abbec 100644
--- a/jbe/scaling_code/scaling_helper.h
+++ b/jbe/scaling_code/scaling_helper.h
@@ -44,21 +44,19 @@ namespace dials_scratch { namespace scaling {
{
int n_cols = jacobian_transpose.n_cols();
scitbx::af::shared<double> sigmasq(n_cols);
- int n_refl = var_cov_matrix.n_rows();
for (int i=0; i < n_cols; i++){
- scitbx::af::shared<double> result(n_refl);
- for (int j=0; j < n_refl; j++){
- result[j] += jacobian_transpose.col(i) * var_cov_matrix.col(j);
- }
+ //scitbx::af::shared<double> result(n_refl);
+ //for (int j=0; j < n_refl; j++){
+ // result[j] += jacobian_transpose.col(i) * var_cov_matrix.col(j);
+ // }
for (scitbx::sparse::matrix<double>::row_iterator
p = jacobian_transpose.col(i).begin();
p != jacobian_transpose.col(i).end(); ++p){
int k = p.index();
- sigmasq[i] += *p * result[k];
+ sigmasq[i] += *p * (jacobian_transpose.col(i) * var_cov_matrix.col(k));// *p * result[k];
}
}
-
return sigmasq;
}