<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 In this notebook, I briefly demonstrate the use of ProximityCellMatch and BestProximityCellMatch tables in meso
Step1:  Following demonstrates how to find matches between source scan
Step2:  Designate the pairing as what needs to be matched
Step3:  Now also specify which units from the source should be matched
Step4:  Now we have specified scans to match and source scan units, we can populate ProximityCellMatch
Step5:  Now find the best proximity match
<ASSISTANT_TASK:>
Python Code:
from pipeline import meso
Explanation: In this notebook, I briefly demonstrate the use of ProximityCellMatch and BestProximityCellMatch tables in meso
End of explanation
source_scan = dict(animal_id=25133, session=3, scan_idx=11)
target_scan = dict(animal_id=25133, session=4, scan_idx=13)
Explanation: Following demonstrates how to find matches between source scan: 25133-3-11 and target scan 25133-4-13.
We also have a list of unit_ids from the source scan for which we want to find the match.
End of explanation
pairing = (meso.ScanInfo & source_scan).proj(src_session='session', src_scan_idx='scan_idx') * (meso.ScanInfo & target_scan).proj()
meso.ScansToMatch.insert(pairing)
Explanation: Designate the pairing as what needs to be matched:
End of explanation
# 150 units from the source scan
unit_ids = [  46,   75,  117,  272,  342,  381,  395,  408,  414,  463,  537,
568,  581,  633,  670,  800,  801,  842,  873, 1042, 1078, 1085,
1175, 1193, 1246, 1420, 1440, 1443, 1451, 1464, 1719, 1755, 1823,
1863, 2107, 2128, 2161, 2199, 2231, 2371, 2438, 2522, 2572, 2585,
2644, 2764, 2809, 2810, 2873, 2924, 2973, 2989, 3028, 3035, 3083,
3107, 3129, 3131, 3139, 3189, 3192, 3214, 3318, 3513, 3551, 3613,
3618, 3671, 3680, 3742, 3810, 3945, 3973, 4065, 4069, 4085, 4123,
4131, 4134, 4184, 4221, 4353, 4369, 4426, 4490, 4512, 4532, 4865,
4971, 5140, 5171, 5227, 5276, 5694, 5746, 5810, 5817, 5856, 5910,
6013, 6061, 6078, 6108, 6216, 6254, 6273, 6292, 6301, 6368, 6486,
6497, 6558, 6569, 6618, 6620, 6825, 6887, 6911, 6984, 7091, 7199,
7205, 7242, 7331, 7372, 7415, 7429, 7433, 7659, 7715, 7927, 7946,
8085, 8096, 8181, 8317, 8391, 8392, 8395, 8396, 8415, 8472, 8478,
8572, 8580, 8610, 8663, 8681, 8683, 8700]
# create list of entries
src_units = [dict(source_scan, unit_id=unit) for unit in unit_ids]
meso.SourceUnitsToMatch.insert(meso.ScanSet.Unit.proj() & src_units)
Explanation: Now also specify which units from the source should be matched
End of explanation
meso.ProximityCellMatch.populate(display_progress=True)
Explanation: Now we have specified scans to match and source scan units, we can populate ProximityCellMatch
End of explanation
meso.BestProximityCellMatch().populate()
meso.BestProximityCellMatch()
Explanation: Now find the best proximity match
End of explanation
<END_TASK>