Exemple #1
0
b.as_scitbx_matrix()
Out[50]: matrix.rec(elems=(0.0, ..., 0.0), n=(2,2))

'''

from scitbx import matrix
from dials.scratch.luiso_s import tst_prod , write_2d
from scitbx.array_family import flex
a = flex.double(flex.grid(3, 3))
#b = flex.double(flex.grid(3, 3))
import random
for xpos in range(3):
  for ypos in range(3):
    a[ypos, xpos] = random.random()
#        b[ypos, xpos] = 1.0

print "a ="
write_2d(a)

#print "b ="
#write_2d(b)

a_mat = a.as_scitbx_matrix()

print a_mat.inverse()
x_mat = a_mat.inverse()
print "inverse(a)= "
x = x_mat.as_flex_double_matrix()
write_2d(x)
from __future__ import division
from dials.scratch.luiso_s import tst_prod , write_2d
from scitbx.array_family import flex
a = flex.double(flex.grid(3, 3))
b = flex.double(flex.grid(3, 3))
import random

contr = 0
for xpos in range(3):
  for ypos in range(3):
    a[ypos, xpos] = random.random()
    b[ypos, xpos] = 1.0
    contr += 1.0

print "a ="
write_2d(a)

print "b ="
write_2d(b)



a_mat = a.as_scitbx_matrix()
b_mat = b.as_scitbx_matrix()

x_mat = a_mat * b_mat

x = x_mat.as_flex_double_matrix()

print "x = a * b ="
x_np = x.as_numpy_array()
Exemple #3
0
from __future__ import division

from scitbx.array_family import flex
from dials.scratch.luiso_s import model_2d, write_2d, test_compare_2d

from dials.algorithms.integration import add_2d

nrow = 10
ncol = 10

sumation = flex.double(flex.grid(21, 21))
descr = flex.double(flex.grid(1, 3))
descr[0, 0] = 0.5
descr[0, 1] = 5
descr[0, 2] = 5

ref2d = model_2d(5, 5, 2, 1, 0.2, 55, 0.5)

sumation = add_2d(descr, ref2d, sumation)
# sumation = test_compare_2d(descr, ref2d, sumation)

write_2d(sumation)
from dials.scratch.luiso_s import tst_prod, write_2d
from scitbx.array_family import flex

a = flex.double(flex.grid(3, 3))
b = flex.double(flex.grid(3, 3))
import random

contr = 0
for xpos in range(3):
    for ypos in range(3):
        a[ypos, xpos] = random.random()
        b[ypos, xpos] = 1.0
        contr += 1.0

print("a =")
write_2d(a)

print("b =")
write_2d(b)

a_mat = a.as_scitbx_matrix()
b_mat = b.as_scitbx_matrix()

x_mat = a_mat * b_mat

x = x_mat.as_flex_double_matrix()

print("x = a * b =")
x_np = x.as_numpy_array()
print(x_np)
print("= as_flex")
Exemple #5
0
from __future__ import division

from scitbx.array_family import flex
from dials.scratch.luiso_s import model_2d, write_2d, test_compare_2d

from dials.algorithms.integration import add_2d

nrow = 10
ncol = 10

sumation = flex.double(flex.grid(21, 21))
descr = flex.double(flex.grid(1, 3))
descr[0, 0] = .5
descr[0, 1] = 5
descr[0, 2] = 5

ref2d = model_2d(5, 5, 2, 1, 0.2, 55, 0.5)

sumation = add_2d(descr, ref2d, sumation)
#sumation = test_compare_2d(descr, ref2d, sumation)

write_2d(sumation)

Exemple #6
0
from __future__ import print_function

from scitbx.array_family import flex
from dials.scratch.luiso_s import model_2d, write_2d

from dials.algorithms.integration import add_2d

nrow = 10
ncol = 10

sumation = flex.double(flex.grid(9, 9), 1)
descr = flex.double(flex.grid(1, 3))
descr[0, 0] = 2.5
descr[0, 1] = 2.5
descr[0, 2] = 1

# double centr_col = descriptor(0,0);
# double centr_row = descriptor(0,1);
# double scale = descriptor(0,2);


ref2d = model_2d(5, 5, 2, 1, 0.2, 55, 0.5)
write_2d(ref2d)
write_2d(sumation)
print("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
sumation01 = add_2d(descr, ref2d, sumation)

write_2d(ref2d)
write_2d(sumation01)
write_2d(sumation)
Exemple #7
0
from scitbx.array_family import flex
from dials.scratch.luiso_s import model_2d, write_2d

from dials.algorithms.integration import add_2d

nrow = 10
ncol = 10

sumation = flex.double(flex.grid(9, 9),1)
descr = flex.double(flex.grid(1, 3))
descr[0, 0] = 2.5
descr[0, 1] = 2.5
descr[0, 2] = 1

#double centr_col = descriptor(0,0);
#double centr_row = descriptor(0,1);
#double scale = descriptor(0,2);


ref2d = model_2d(5, 5, 2, 1, 0.2, 55, 0.5)
write_2d(ref2d)
write_2d(sumation)
print "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
sumation01 = add_2d(descr, ref2d, sumation)

write_2d(ref2d)
write_2d(sumation01)
write_2d(sumation)

Exemple #8
0
from __future__ import division
from dials.scratch.luiso_s import tst_ref_prod , write_2d
from scitbx.array_family import flex
a = flex.double(flex.grid(3, 3))
b = flex.double(flex.grid(3, 3))
import random
for xpos in range(3):
  for ypos in range(3):
    a[ypos, xpos] = random.random()
    b[ypos, xpos] = 1.0

print "a ="
write_2d(a)

print "b ="
write_2d(b)

c = tst_ref_prod(a, b)

print "c ="
write_2d(c)

print "______________________________________"


print "a ="
write_2d(a)

print "b ="
write_2d(b)
Exemple #9
0
from __future__ import division
from __future__ import print_function
from dials.scratch.luiso_s import tst_ref_prod, write_2d
from scitbx.array_family import flex

a = flex.double(flex.grid(3, 3))
b = flex.double(flex.grid(3, 3))
import random

for xpos in range(3):
    for ypos in range(3):
        a[ypos, xpos] = random.random()
        b[ypos, xpos] = 1.0

print("a =")
write_2d(a)

print("b =")
write_2d(b)

c = tst_ref_prod(a, b)

print("c =")
write_2d(c)

print("______________________________________")


print("a =")
write_2d(a)