-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcppxfel.py
42 lines (35 loc) · 1.44 KB
/
cppxfel.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from __future__ import division
import boost.python
from os import path
ext = boost.python.import_ext("cppxfel_ext")
from cppxfel_ext import *
class Parser:
def __init__(self, commandFile):
self.parser = ext.cppParser(commandFile)
# file provided under keyword ORIENTATION_MATRIX_LIST
def loadImagesFromFile(self):
# def loadImages(self, experimentList):
# import dxtbx
# import array
#
# firstExp = experimentList[0]
# imageNameLong = str(firstExp.imageset)[2:-2]
# imageName = path.basename(imageNameLong)
# db = dxtbx.load(imageName).get_detectorbase()
# imageData = db.get_raw_data()
# data_array = array.array('i')
#
# for i in range(0, len(imageData)):
# data_array.append(imageData[i])
#
# length = len(imageData)
# distance = firstExp.detector[0].get_distance()
# wavelength = firstExp.beam.get_wavelength()
# self.parser.loadImage(imageName, data_array.tostring(), distance, wavelength)
#
# for experiment in experimentList:
# unit_cell = list(experiment.crystal.get_B().as_mat3())
# rotation = list(experiment.crystal.get_U().as_mat3())
# self.parser.addMatrixToLastImage(unit_cell, rotation)
def integrate(self):
self.parser.integrate()