mmg_toolbox example¶
Peak Fitting using ROIs¶
This short notebook describes how to perform multi-peak fitting on a sequence of scans
Notebook Notes¶
This notebook will run with any modern version of python and requires mmg_toolbox, which can be installed easily using:
python -m pip install mmg_toolbox
InĀ [1]:
Copied!
import os
import numpy as np
import matplotlib.pyplot as plt
from mmg_toolbox import Experiment
import os
import numpy as np
import matplotlib.pyplot as plt
from mmg_toolbox import Experiment
InĀ [2]:
Copied!
folder = '/dls/science/groups/das/ExampleData/i16/temp_dep'
exp = Experiment(folder, instrument='i16')
print(exp)
folder = '/dls/science/groups/das/ExampleData/i16/temp_dep'
exp = Experiment(folder, instrument='i16')
print(exp)
Instrument: i16
/dls/science/groups/das/ExampleData/i16/temp_dep
Files: 153
Scans: 1160565-1160717
Defining Regions of Interest (ROIs)¶
InĀ [3]:
Copied!
# Current/ default ROIs (from default config for i16)
print(exp.config['roi'])
# ROI defined as ('name', 'centre_i', 'centre_j', 'width_i', 'width_j', 'detector name', 'peak_search', 'peak_rgn_i', 'peak_rgn_j')
# Current/ default ROIs (from default config for i16)
print(exp.config['roi'])
# ROI defined as ('name', 'centre_i', 'centre_j', 'width_i', 'width_j', 'detector name', 'peak_search', 'peak_rgn_i', 'peak_rgn_j')
[('pilroi1', 'pil3_centre_j', 'pil3_centre_i', 30, 30, 'pil3_100k', False, 101, 101)]
InĀ [4]:
Copied!
# Define ROIs
# this must be done prior to loading data to propagate ROIs from exp object to scan object
# indexes can be int or string expressions, allowing to access the stored central pixel
exp.add_roi('new_roi', cen_i='pil3_centre_j', cen_j='pil3_centre_i', wid_i=60, wid_j=40, image_name='pil3_100k')
scan = exp.scan(1160565)
# Create plot of image
ax = scan.plot.image()
# add box for ROI
box = scan('new_roi_box') # box lines
bkg = scan('new_roi_bkg_box')
ax.plot(box[:, 1], box[:, 0], color='k', linewidth=2)
ax.plot(bkg[:, 1], bkg[:, 0], color='r', linewidth=2)
# Define ROIs
# this must be done prior to loading data to propagate ROIs from exp object to scan object
# indexes can be int or string expressions, allowing to access the stored central pixel
exp.add_roi('new_roi', cen_i='pil3_centre_j', cen_j='pil3_centre_i', wid_i=60, wid_j=40, image_name='pil3_100k')
scan = exp.scan(1160565)
# Create plot of image
ax = scan.plot.image()
# add box for ROI
box = scan('new_roi_box') # box lines
bkg = scan('new_roi_bkg_box')
ax.plot(box[:, 1], box[:, 0], color='k', linewidth=2)
ax.plot(bkg[:, 1], bkg[:, 0], color='r', linewidth=2)
Out[4]:
[<matplotlib.lines.Line2D at 0x7f7825264ad0>]
InĀ [5]:
Copied!
# Access the array of the roi
roi = scan('new_roi')
print(roi.shape)
fig, ax2 = plt.subplots()
ax2.imshow(roi[40, :, :])
# Access the array of the roi
roi = scan('new_roi')
print(roi.shape)
fig, ax2 = plt.subplots()
ax2.imshow(roi[40, :, :])
(81, 60, 40)
Out[5]:
<matplotlib.image.AxesImage at 0x7f7823030c20>
InĀ [6]:
Copied!
print(scan.info(rois=True))
print(scan.info(rois=True))
Scannables Namespace:
eta_fly_fly: (81,) : /entry/measurement/eta_fly_fly
BeamOk_beamok: (81,) : /entry/instrument/BeamOk/BeamOk_beamok
wait_for_injection_scan_start_beamok: (81,) : /entry/instrument/wait_for_injection_scan_start/wait_for_injection_scan_start_beamok
wait_for_beam_scan_start_beamok: (81,) : /entry/instrument/wait_for_beam_scan_start/wait_for_beam_scan_start_beamok
roi2_max: (81,) : /entry/instrument/roi2/roi2_max
roi2_sum: (81,) : /entry/instrument/roi2/roi2_sum
roi1_max: (81,) : /entry/instrument/roi1/roi1_max
roi1_sum: (81,) : /entry/instrument/roi1/roi1_sum
kphi_: (81,) : /entry/instrument/showkap6/kphi_
kap_: (81,) : /entry/instrument/showkap6/kap_
kth_: (81,) : /entry/instrument/showkap6/kth_
mu_: (81,) : /entry/instrument/showkap6/mu_
delta_: (81,) : /entry/instrument/showkap6/delta_
gam_: (81,) : /entry/instrument/showkap6/gam_
delta_axis_offset: (81,) : /entry/measurement/delta_axis_offset
TimeSec: (81,) : /entry/instrument/atime/TimeSec
TimeFromEpoch: (81,) : /entry/instrument/atimetwo/TimeFromEpoch
ic1monitor: (81,) : /entry/measurement/ic1monitor
rc: (81,) : /entry/measurement/rc
count_time: (81,) : /entry/instrument/pil3_100k/count_time
pil_max_val: (81,) : /entry/instrument/pil3_100k/pil_max_val
pil_max_x: (81,) : /entry/instrument/pil3_100k/pil_max_x
pil_max_y: (81,) : /entry/instrument/pil3_100k/pil_max_y
pil_total: (81,) : /entry/instrument/pil3_100k/pil_total
Image Data Namespace:
pil3_100k: (81, 195, 487) : /entry/instrument/pil3_100k/data
pil3_100k_image_list: (81,) : /entry/instrument/pil3_100k/image_data
IMAGE: (81, 195, 487) : /entry/instrument/pil3_100k/data
Alternate Names for expressions:
_t: (count_time|counttime|t?(1.0))
count_time: (count_time|counttime|t?(1.0))
cmd: (cmd|user_input_command|user_command|scan_command)
pilroi1_total: d_pil3_100k[..., max(pil3_centre_j-15,0):min(pil3_centre_j+15,d_pil3_100k.shape[-2]-1), max(pil3_centre_i-15,0):min(pil3_centre_i+15,d_pil3_100k.shape[-1]-1)].sum(axis=(-1, -2))
pilroi1_max: d_pil3_100k[..., max(pil3_centre_j-15,0):min(pil3_centre_j+15,d_pil3_100k.shape[-2]-1), max(pil3_centre_i-15,0):min(pil3_centre_i+15,d_pil3_100k.shape[-1]-1)].max(axis=(-1, -2))
pilroi1_min: d_pil3_100k[..., max(pil3_centre_j-15,0):min(pil3_centre_j+15,d_pil3_100k.shape[-2]-1), max(pil3_centre_i-15,0):min(pil3_centre_i+15,d_pil3_100k.shape[-1]-1)].min(axis=(-1, -2))
pilroi1_mean: d_pil3_100k[..., max(pil3_centre_j-15,0):min(pil3_centre_j+15,d_pil3_100k.shape[-2]-1), max(pil3_centre_i-15,0):min(pil3_centre_i+15,d_pil3_100k.shape[-1]-1)].mean(axis=(-1, -2))
pilroi1_bkg: (d_pil3_100k[..., max(pil3_centre_j-30,0):min(pil3_centre_j+30,d_pil3_100k.shape[-2]-1), max(pil3_centre_i-30,0):min(pil3_centre_i+30,d_pil3_100k.shape[-1]-1)].sum(axis=(-1, -2)) - d_pil3_100k[..., max(pil3_centre_j-15,0):min(pil3_centre_j+15,d_pil3_100k.shape[-2]-1), max(pil3_centre_i-15,0):min(pil3_centre_i+15,d_pil3_100k.shape[-1]-1)].sum(axis=(-1, -2)))/3
pilroi1_rmbkg: (4 * d_pil3_100k[..., max(pil3_centre_j-15,0):min(pil3_centre_j+15,d_pil3_100k.shape[-2]-1), max(pil3_centre_i-15,0):min(pil3_centre_i+15,d_pil3_100k.shape[-1]-1)].sum(axis=(-1, -2)) - d_pil3_100k[..., max(pil3_centre_j-30,0):min(pil3_centre_j+30,d_pil3_100k.shape[-2]-1), max(pil3_centre_i-30,0):min(pil3_centre_i+30,d_pil3_100k.shape[-1]-1)].sum(axis=(-1, -2)))/3
pilroi1_box: array([[max(pil3_centre_j-15,0), max(pil3_centre_i-15,0)],[max(pil3_centre_j-15,0), min(pil3_centre_i+15,d_pil3_100k.shape[-1]-1)],[min(pil3_centre_j+15,d_pil3_100k.shape[-2]-1), min(pil3_centre_i+15,d_pil3_100k.shape[-1]-1)],[min(pil3_centre_j+15,d_pil3_100k.shape[-2]-1), max(pil3_centre_i-15,0)],[max(pil3_centre_j-15,0), max(pil3_centre_i-15,0)],])
pilroi1_bkg_box: array([[max(pil3_centre_j-30,0), max(pil3_centre_i-30,0)],[max(pil3_centre_j-30,0), min(pil3_centre_i+30,d_pil3_100k.shape[-1]-1)],[min(pil3_centre_j+30,d_pil3_100k.shape[-2]-1), min(pil3_centre_i+30,d_pil3_100k.shape[-1]-1)],[min(pil3_centre_j+30,d_pil3_100k.shape[-2]-1), max(pil3_centre_i-30,0)],[max(pil3_centre_j-30,0), max(pil3_centre_i-30,0)],])
pilroi1: d_pil3_100k[..., max(pil3_centre_j-15,0):min(pil3_centre_j+15,d_pil3_100k.shape[-2]-1), max(pil3_centre_i-15,0):min(pil3_centre_i+15,d_pil3_100k.shape[-1]-1)]
new_roi_total: d_pil3_100k[..., max(pil3_centre_j-30,0):min(pil3_centre_j+30,d_pil3_100k.shape[-2]-1), max(pil3_centre_i-20,0):min(pil3_centre_i+20,d_pil3_100k.shape[-1]-1)].sum(axis=(-1, -2))
new_roi_max: d_pil3_100k[..., max(pil3_centre_j-30,0):min(pil3_centre_j+30,d_pil3_100k.shape[-2]-1), max(pil3_centre_i-20,0):min(pil3_centre_i+20,d_pil3_100k.shape[-1]-1)].max(axis=(-1, -2))
new_roi_min: d_pil3_100k[..., max(pil3_centre_j-30,0):min(pil3_centre_j+30,d_pil3_100k.shape[-2]-1), max(pil3_centre_i-20,0):min(pil3_centre_i+20,d_pil3_100k.shape[-1]-1)].min(axis=(-1, -2))
new_roi_mean: d_pil3_100k[..., max(pil3_centre_j-30,0):min(pil3_centre_j+30,d_pil3_100k.shape[-2]-1), max(pil3_centre_i-20,0):min(pil3_centre_i+20,d_pil3_100k.shape[-1]-1)].mean(axis=(-1, -2))
new_roi_bkg: (d_pil3_100k[..., max(pil3_centre_j-60,0):min(pil3_centre_j+60,d_pil3_100k.shape[-2]-1), max(pil3_centre_i-40,0):min(pil3_centre_i+40,d_pil3_100k.shape[-1]-1)].sum(axis=(-1, -2)) - d_pil3_100k[..., max(pil3_centre_j-30,0):min(pil3_centre_j+30,d_pil3_100k.shape[-2]-1), max(pil3_centre_i-20,0):min(pil3_centre_i+20,d_pil3_100k.shape[-1]-1)].sum(axis=(-1, -2)))/3
new_roi_rmbkg: (4 * d_pil3_100k[..., max(pil3_centre_j-30,0):min(pil3_centre_j+30,d_pil3_100k.shape[-2]-1), max(pil3_centre_i-20,0):min(pil3_centre_i+20,d_pil3_100k.shape[-1]-1)].sum(axis=(-1, -2)) - d_pil3_100k[..., max(pil3_centre_j-60,0):min(pil3_centre_j+60,d_pil3_100k.shape[-2]-1), max(pil3_centre_i-40,0):min(pil3_centre_i+40,d_pil3_100k.shape[-1]-1)].sum(axis=(-1, -2)))/3
new_roi_box: array([[max(pil3_centre_j-30,0), max(pil3_centre_i-20,0)],[max(pil3_centre_j-30,0), min(pil3_centre_i+20,d_pil3_100k.shape[-1]-1)],[min(pil3_centre_j+30,d_pil3_100k.shape[-2]-1), min(pil3_centre_i+20,d_pil3_100k.shape[-1]-1)],[min(pil3_centre_j+30,d_pil3_100k.shape[-2]-1), max(pil3_centre_i-20,0)],[max(pil3_centre_j-30,0), max(pil3_centre_i-20,0)],])
new_roi_bkg_box: array([[max(pil3_centre_j-60,0), max(pil3_centre_i-40,0)],[max(pil3_centre_j-60,0), min(pil3_centre_i+40,d_pil3_100k.shape[-1]-1)],[min(pil3_centre_j+60,d_pil3_100k.shape[-2]-1), min(pil3_centre_i+40,d_pil3_100k.shape[-1]-1)],[min(pil3_centre_j+60,d_pil3_100k.shape[-2]-1), max(pil3_centre_i-40,0)],[max(pil3_centre_j-60,0), max(pil3_centre_i-40,0)],])
new_roi: d_pil3_100k[..., max(pil3_centre_j-30,0):min(pil3_centre_j+30,d_pil3_100k.shape[-2]-1), max(pil3_centre_i-20,0):min(pil3_centre_i+20,d_pil3_100k.shape[-1]-1)]
==== ROIs ===
new_roi
pilroi1
InĀ [7]:
Copied!
# Plotting integrated data from an ROI
fig, ax = plt.subplots()
scan.plot('axes', 'new_roi_total', axes=ax, label='total')
scan.plot('axes', 'new_roi_bkg', axes=ax, label='background')
scan.plot('axes', 'new_roi_rmbkg', axes=ax, label='total - background')
ax.legend()
ax.set_xlabel(scan.replace_default_names('axes'))
ax.set_ylabel('new_roi_total')
# Plotting integrated data from an ROI
fig, ax = plt.subplots()
scan.plot('axes', 'new_roi_total', axes=ax, label='total')
scan.plot('axes', 'new_roi_bkg', axes=ax, label='background')
scan.plot('axes', 'new_roi_rmbkg', axes=ax, label='total - background')
ax.legend()
ax.set_xlabel(scan.replace_default_names('axes'))
ax.set_ylabel('new_roi_total')
WARNING:hdfmap.nexus:signal 'filepath' not found in scannables, appending 'filepath' to scannables
Out[7]:
Text(0, 0.5, 'new_roi_total')
Peak searching ROIs¶
Define an ROI around the maximum pixel within a certain region of the detector
InĀ [8]:
Copied!
scan.add_peak_roi('peak_roi', wid_i=20, wid_j=20, image_name='IMAGE',
rgn_cen_i='pil3_centre_j', rgn_cen_j='pil3_centre_i',
rgn_wid_i=195, rgn_wid_j=101)
# Find peak position
pi, pj, pk = scan('peak_roi_pos')
print(f"Max pixel position: ({pi}, {pj}, {pk})")
# Create plot of image
ax = scan.plot.image(pi)
# add box for ROI
box = scan('peak_roi_box') # box lines
rgn = scan('peak_roi_rgn_box')
ax.plot(box[:, 1], box[:, 0], color='k', linewidth=2)
ax.plot(rgn[:, 1], rgn[:, 0], color='r', linewidth=2)
ax.plot([pk], [pj], 'k+', linewidth=2)
scan.add_peak_roi('peak_roi', wid_i=20, wid_j=20, image_name='IMAGE',
rgn_cen_i='pil3_centre_j', rgn_cen_j='pil3_centre_i',
rgn_wid_i=195, rgn_wid_j=101)
# Find peak position
pi, pj, pk = scan('peak_roi_pos')
print(f"Max pixel position: ({pi}, {pj}, {pk})")
# Create plot of image
ax = scan.plot.image(pi)
# add box for ROI
box = scan('peak_roi_box') # box lines
rgn = scan('peak_roi_rgn_box')
ax.plot(box[:, 1], box[:, 0], color='k', linewidth=2)
ax.plot(rgn[:, 1], rgn[:, 0], color='r', linewidth=2)
ax.plot([pk], [pj], 'k+', linewidth=2)
Max pixel position: (39, 107, 237)
Out[8]:
[<matplotlib.lines.Line2D at 0x7f78230ffa10>]
InĀ [9]:
Copied!
# Plot along each axis
vol = scan('IMAGE')
fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=[8, 4])
ax1.plot(vol[:, pj, pk])
ax1.set_xlabel('scan axis')
ax2.plot(vol[pi, :, pk])
ax2.set_xlabel('Det. Fast axis')
ax3.plot(vol[pi, pj, :])
ax3.set_xlabel('Det. Slow axis')
fig.suptitle(f"Pixel Plot ({pi}, {pj}, {pk})")
# Plot along each axis
vol = scan('IMAGE')
fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=[8, 4])
ax1.plot(vol[:, pj, pk])
ax1.set_xlabel('scan axis')
ax2.plot(vol[pi, :, pk])
ax2.set_xlabel('Det. Fast axis')
ax3.plot(vol[pi, pj, :])
ax3.set_xlabel('Det. Slow axis')
fig.suptitle(f"Pixel Plot ({pi}, {pj}, {pk})")
Out[9]:
Text(0.5, 0.98, 'Pixel Plot (39, 107, 237)')
InĀ [10]:
Copied!
# Compare different sized ROIs
fig, ax = plt.subplots()
scan.plot('axes', 'new_roi_rmbkg', axes=ax, label='new_roi')
scan.plot('axes', 'peak_roi_rmbkg', axes=ax, label='peak_roi')
ax.legend()
ax.set_xlabel(scan.replace_default_names('axes'))
ax.set_ylabel('new_roi_total')
# Compare different sized ROIs
fig, ax = plt.subplots()
scan.plot('axes', 'new_roi_rmbkg', axes=ax, label='new_roi')
scan.plot('axes', 'peak_roi_rmbkg', axes=ax, label='peak_roi')
ax.legend()
ax.set_xlabel(scan.replace_default_names('axes'))
ax.set_ylabel('new_roi_total')
Out[10]:
Text(0, 0.5, 'new_roi_total')
InĀ [11]:
Copied!
fig = scan.plot.roi('peak_roi')
fig.tight_layout()
fig = scan.plot.roi('peak_roi')
fig.tight_layout()
Fitting a Temperature Dependence¶
InĀ [13]:
Copied!
# Define ROI
exp.add_roi('peak_roi', cen_i='pil3_centre_j', cen_j='pil3_centre_i', wid_i=20, wid_j=20, image_name='pil3_100k', peak_search=True, peak_region_i=50, peak_region_j=50)
# Load data
lh_scans = exp.scans(*range(1160565, 1160717, 4))
c1_scans = exp.scans(*range(1160566, 1160717, 4))
lv_scans = exp.scans(*range(1160567, 1160717, 4))
c2_scans = exp.scans(*range(1160568, 1160717, 4))
# Define ROI
exp.add_roi('peak_roi', cen_i='pil3_centre_j', cen_j='pil3_centre_i', wid_i=20, wid_j=20, image_name='pil3_100k', peak_search=True, peak_region_i=50, peak_region_j=50)
# Load data
lh_scans = exp.scans(*range(1160565, 1160717, 4))
c1_scans = exp.scans(*range(1160566, 1160717, 4))
lv_scans = exp.scans(*range(1160567, 1160717, 4))
c2_scans = exp.scans(*range(1160568, 1160717, 4))
InĀ [14]:
Copied!
# Plot data
exp.plot.multi_lines(*lh_scans, xaxis='axes', yaxis='peak_roi_rmbkg', value='Tsample')
# Plot data
exp.plot.multi_lines(*lh_scans, xaxis='axes', yaxis='peak_roi_rmbkg', value='Tsample')
Out[14]:
<Axes: title={'center': 'temp_dep 1160[565:4:713] \nflyscancn eta_fly 0.02 81 BeamOk pil3_100k 1 0.4 roi2 roi1'}, xlabel='eta_fly_fly', ylabel='peak_roi_rmbkg'>
InĀ [15]:
Copied!
# Test fit parameters on a single scan
scan = lh_scans[-6]
scan.fit.multi_peak_fit(xaxis='axes', yaxis='peak_roi_rmbkg', plot_result=True, print_result=True, npeaks=2, min_peak_power=1)
print(scan.format('{scan_number}: {Tsample:.2f}K amplitude={amplitude:.2f}, centre={center:.2f}, width={fwhm:.2f}'))
# Test fit parameters on a single scan
scan = lh_scans[-6]
scan.fit.multi_peak_fit(xaxis='axes', yaxis='peak_roi_rmbkg', plot_result=True, print_result=True, npeaks=2, min_peak_power=1)
print(scan.format('{scan_number}: {Tsample:.2f}K amplitude={amplitude:.2f}, centre={center:.2f}, width={fwhm:.2f}'))
WARNING:hdfmap.nexus:signal 'filepath' not found in scannables, appending 'filepath' to scannables
Fitting with 2 peaks
#1160693
Fit Results
((Model(linear, prefix='bkg_') + Model(gaussian, prefix='p1_')) + Model(gaussian, prefix='p2_'))
Npeaks = 2
Method: leastsq => Fit succeeded.
Chisqr = 12565
Peak p1_
p1_amplitude = 500 (40)
p1_center = 55.514 (8)
p1_sigma = 0.091 (7)
p1_fwhm = 0.21 (2)
p1_height = 2200 (200)
Peak p2_
p2_amplitude = 70 (30)
p2_center = 56.02 (2)
p2_sigma = 0.08 (3)
p2_fwhm = 0.20 (7)
p2_height = 320 (100)
Background
bkg_slope = -50 (40)
bkg_intercept = 3000 (2000)
Totals
amplitude = 560 (50)
center = 55.77 (1)
height = 1300 (100)
sigma = 0.09 (1)
fwhm = 0.20 (3)
background = 40 (20)
1160693: 28.50K amplitude=563.90, centre=55.77, width=0.20
InĀ [16]:
Copied!
# Perform fits
for scan in lh_scans:
scan.fit.multi_peak_fit(xaxis='axes', yaxis='peak_roi_rmbkg', npeaks=2, min_peak_power=0)
print(scan.format('{scan_number}: {Tsample:.2f}K amplitude={amplitude:.2f}, centre={center:.2f}, width={fwhm:.2f}'))
# Perform fits
for scan in lh_scans:
scan.fit.multi_peak_fit(xaxis='axes', yaxis='peak_roi_rmbkg', npeaks=2, min_peak_power=0)
print(scan.format('{scan_number}: {Tsample:.2f}K amplitude={amplitude:.2f}, centre={center:.2f}, width={fwhm:.2f}'))
Fitting with 2 peaks Refitting with 1 peaks 1160565: 6.95K amplitude=1658.54, centre=55.48, width=0.22 Fitting with 2 peaks 1160569: 7.97K amplitude=1822.59, centre=55.61, width=0.14 Fitting with 2 peaks Refitting with 1 peaks 1160573: 8.98K amplitude=1770.95, centre=55.49, width=0.22 Fitting with 2 peaks 1160577: 10.00K amplitude=1917.02, centre=55.30, width=0.35 Fitting with 2 peaks 1160581: 10.98K amplitude=1852.00, centre=55.24, width=0.24 Fitting with 2 peaks Refitting with 1 peaks 1160585: 11.96K amplitude=1659.73, centre=55.50, width=0.21 Fitting with 2 peaks Refitting with 1 peaks 1160589: 12.96K amplitude=1637.98, centre=55.51, width=0.23 Fitting with 2 peaks 1160593: 13.96K amplitude=1683.78, centre=55.23, width=0.21 Fitting with 2 peaks Refitting with 1 peaks 1160597: 14.99K amplitude=1511.57, centre=55.50, width=0.22 Fitting with 2 peaks Refitting with 1 peaks 1160601: 15.97K amplitude=1556.15, centre=55.50, width=0.21 Fitting with 2 peaks Refitting with 1 peaks 1160605: 16.99K amplitude=1462.67, centre=55.49, width=0.21 Fitting with 2 peaks Refitting with 1 peaks 1160609: 17.98K amplitude=1394.51, centre=55.50, width=0.23 Fitting with 2 peaks 1160613: 18.50K amplitude=1305.10, centre=55.74, width=0.17 Fitting with 2 peaks Refitting with 1 peaks 1160617: 18.99K amplitude=1285.54, centre=55.51, width=0.19 Fitting with 2 peaks Refitting with 1 peaks 1160621: 19.49K amplitude=1324.60, centre=55.50, width=0.20 Fitting with 2 peaks Refitting with 1 peaks 1160625: 19.99K amplitude=1198.60, centre=55.50, width=0.20 Fitting with 2 peaks Refitting with 1 peaks 1160629: 20.50K amplitude=1256.12, centre=55.50, width=0.20 Fitting with 2 peaks 1160633: 21.00K amplitude=1311.26, centre=55.27, width=0.24 Fitting with 2 peaks Refitting with 1 peaks 1160637: 21.50K amplitude=1193.39, centre=55.50, width=0.19 Fitting with 2 peaks 1160641: 22.00K amplitude=1377.80, centre=55.22, width=0.25 Fitting with 2 peaks 1160645: 22.50K amplitude=1339.80, centre=55.23, width=0.37 Fitting with 2 peaks Refitting with 1 peaks 1160649: 23.00K amplitude=1011.78, centre=55.51, width=0.19 Fitting with 2 peaks 1160653: 23.50K amplitude=1210.42, centre=55.21, width=0.22 Fitting with 2 peaks 1160657: 24.00K amplitude=899.00, centre=55.27, width=0.15 Fitting with 2 peaks 1160661: 24.50K amplitude=1003.38, centre=55.24, width=0.22 Fitting with 2 peaks 1160665: 25.00K amplitude=0.00, centre=55.51, width=0.15 Fitting with 2 peaks Refitting with 0 peaks 1160669: 25.50K amplitude=0.00, centre=nan, width=nan
/scratch/grp66007/python/mmg_toolbox/.venv/lib/python3.14/site-packages/numpy/_core/fromnumeric.py:3862: RuntimeWarning: Mean of empty slice return _methods._mean(a, axis=axis, dtype=dtype, /scratch/grp66007/python/mmg_toolbox/.venv/lib/python3.14/site-packages/numpy/_core/_methods.py:142: RuntimeWarning: invalid value encountered in scalar divide ret = ret.dtype.type(ret / rcount)
Fitting with 2 peaks Refitting with 0 peaks 1160673: 26.00K amplitude=0.00, centre=nan, width=nan
/scratch/grp66007/python/mmg_toolbox/.venv/lib/python3.14/site-packages/numpy/_core/fromnumeric.py:3862: RuntimeWarning: Mean of empty slice return _methods._mean(a, axis=axis, dtype=dtype, /scratch/grp66007/python/mmg_toolbox/.venv/lib/python3.14/site-packages/numpy/_core/_methods.py:142: RuntimeWarning: invalid value encountered in scalar divide ret = ret.dtype.type(ret / rcount)
Fitting with 2 peaks Refitting with 1 peaks 1160677: 26.50K amplitude=634.74, centre=55.51, width=0.17 Fitting with 2 peaks Refitting with 1 peaks 1160681: 27.00K amplitude=650.77, centre=55.53, width=0.20 Fitting with 2 peaks 1160685: 27.50K amplitude=642.79, centre=55.21, width=0.15 Fitting with 2 peaks Refitting with 1 peaks 1160689: 28.00K amplitude=468.52, centre=55.50, width=0.17 Fitting with 2 peaks 1160693: 28.50K amplitude=563.90, centre=55.77, width=0.20 Fitting with 2 peaks 1160697: 29.00K amplitude=132.58, centre=55.71, width=0.09 Fitting with 2 peaks 1160701: 29.50K amplitude=0.00, centre=55.52, width=1.88 Fitting with 2 peaks Refitting with 1 peaks 1160705: 30.00K amplitude=42.71, centre=55.92, width=0.10 Fitting with 2 peaks Refitting with 0 peaks 1160709: 30.50K amplitude=0.00, centre=nan, width=nan Fitting with 2 peaks
/scratch/grp66007/python/mmg_toolbox/.venv/lib/python3.14/site-packages/numpy/_core/fromnumeric.py:3862: RuntimeWarning: Mean of empty slice return _methods._mean(a, axis=axis, dtype=dtype, /scratch/grp66007/python/mmg_toolbox/.venv/lib/python3.14/site-packages/numpy/_core/_methods.py:142: RuntimeWarning: invalid value encountered in scalar divide ret = ret.dtype.type(ret / rcount)
1160713: 31.00K amplitude=0.00, centre=55.34, width=1.02
InĀ [17]:
Copied!
# Plot results
temperature, area, cen, fwhm = exp.join_scan_arrays(*lh_scans, data_fields=['Tsample', 'amplitude', 'center', 'fwhm'])
fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=[8, 4])
ax1.plot(temperature, area)
ax2.plot(temperature, cen)
ax3.plot(temperature, fwhm)
ax1.set_xlabel('Temperature [K]')
ax2.set_xlabel('Temperature [K]')
ax3.set_xlabel('Temperature [K]')
ax1.set_ylabel('Integrated Area')
ax2.set_ylabel('Peak Centre')
ax3.set_ylabel('FWHM')
fig.tight_layout()
# Plot results
temperature, area, cen, fwhm = exp.join_scan_arrays(*lh_scans, data_fields=['Tsample', 'amplitude', 'center', 'fwhm'])
fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=[8, 4])
ax1.plot(temperature, area)
ax2.plot(temperature, cen)
ax3.plot(temperature, fwhm)
ax1.set_xlabel('Temperature [K]')
ax2.set_xlabel('Temperature [K]')
ax3.set_xlabel('Temperature [K]')
ax1.set_ylabel('Integrated Area')
ax2.set_ylabel('Peak Centre')
ax3.set_ylabel('FWHM')
fig.tight_layout()
InĀ [17]:
Copied!