@@ -102,6 +102,7 @@ def quantify_single_pattern(
102102 plot_correlation_radius = False ,
103103 scale_markers_experiment = 40 ,
104104 scale_markers_calculated = 200 ,
105+ max_marker_size = 400 ,
105106 crystal_inds_plot = None ,
106107 phase_colors = None ,
107108 figsize = (10 , 7 ),
@@ -615,16 +616,23 @@ def quantify_single_pattern(
615616 qy0 ,
616617 qx0 ,
617618 # s = scale_markers_experiment * intensity0,
618- s = scale_markers_experiment
619- * bragg_peaks .data ["intensity" ][np .logical_not (keep )],
619+ s = np .minimum (
620+ scale_markers_experiment
621+ * bragg_peaks .data ["intensity" ][np .logical_not (keep )],
622+ max_marker_size ,
623+ ),
620624 marker = "o" ,
621625 facecolor = [0.7 , 0.7 , 0.7 ],
622626 )
623627 ax .scatter (
624628 qy ,
625629 qx ,
626630 # s = scale_markers_experiment * intensity,
627- s = scale_markers_experiment * bragg_peaks .data ["intensity" ][keep ],
631+ s = np .minimum (
632+ scale_markers_experiment
633+ * bragg_peaks .data ["intensity" ][keep ],
634+ max_marker_size ,
635+ ),
628636 marker = "o" ,
629637 facecolor = [0.7 , 0.7 , 0.7 ],
630638 )
@@ -799,6 +807,7 @@ def quantify_phase(
799807 strain_max = 0.02 ,
800808 include_false_positives = True ,
801809 weight_false_positives = 1.0 ,
810+ weight_unmatched_peaks = 1.0 ,
802811 progress_bar = True ,
803812 ):
804813 """
@@ -899,6 +908,7 @@ def quantify_phase(
899908 strain_max = strain_max ,
900909 include_false_positives = include_false_positives ,
901910 weight_false_positives = weight_false_positives ,
911+ weight_unmatched_peaks = weight_unmatched_peaks ,
902912 plot_result = False ,
903913 verbose = False ,
904914 returnfig = False ,
@@ -1220,6 +1230,7 @@ def plot_dominant_phase(
12201230 self ,
12211231 use_correlation_scores = False ,
12221232 reliability_range = (0.0 , 1.0 ),
1233+ normalize_exp_intensity = True ,
12231234 sigma = 0.0 ,
12241235 phase_colors = None ,
12251236 ticks = True ,
@@ -1302,6 +1313,12 @@ def plot_dominant_phase(
13021313 sigma = sigma ,
13031314 mode = "nearest" ,
13041315 )
1316+ self .phase_sig = phase_sig
1317+
1318+ # # normalize the signal by the intensity of each experimental pattern
1319+ # if normalize_exp_intensity:
1320+ # phase_sig /= self.int_total[None,:,:]
1321+
13051322
13061323 # find highest correlation score for each crystal and match index
13071324 for a0 in range (self .num_crystals ):
@@ -1327,6 +1344,12 @@ def plot_dominant_phase(
13271344
13281345 # Estimate the reliability
13291346 phase_rel = phase_corr - phase_corr_2nd
1347+
1348+ # normalize the reliability by the intensity of each experimental pattern
1349+ if normalize_exp_intensity :
1350+ phase_rel /= self .int_total
1351+
1352+
13301353 phase_scale = np .clip (
13311354 (phase_rel - reliability_range [0 ])
13321355 / (reliability_range [1 ] - reliability_range [0 ]),
@@ -1351,6 +1374,8 @@ def plot_dominant_phase(
13511374 sub = phase_map == a0
13521375 for a1 in range (3 ):
13531376 self .phase_rgb [:, :, a1 ][sub ] = phase_colors [a0 , a1 ] * phase_scale [sub ]
1377+
1378+ self .phase_scale = phase_scale
13541379 # normalize
13551380 # self.phase_rgb = np.clip(
13561381 # (self.phase_rgb - rel_range[0]) / (rel_range[1] - rel_range[0]),
0 commit comments