-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrefine.py
43 lines (33 loc) · 1.14 KB
/
refine.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
43
import logging
logger = logging.getLogger()
import time
from simemc import utils
from dials.algorithms.refinement import RefinerFactory
def refine(phil, experiments, centroids):
params = utils.stills_process_params_from_file(phil)
st = time.time()
logger.info("*" * 80)
logger.info("Refining Model")
logger.info("*" * 80)
refiner = RefinerFactory.from_parameters_data_experiments(
params, centroids, experiments
)
refiner.run()
experiments = refiner.get_experiments()
predicted = refiner.predict_for_indexed()
centroids["xyzcal.mm"] = predicted["xyzcal.mm"]
centroids["entering"] = predicted["entering"]
centroids = centroids.select(refiner.selection_used_for_refinement())
# Re-estimate mosaic estimates
from dials.algorithms.indexing.nave_parameters import NaveParameters
nv = NaveParameters(
params=params,
experiments=experiments,
reflections=centroids,
refinery=refiner,
graph_verbose=False,
)
nv()
acceptance_flags_nv = nv.nv_acceptance_flags
centroids = centroids.select(acceptance_flags_nv)
return experiments, centroids