1. The BlueiceExtendedModel: Rate and shape parameters
In this tutorial, we’ll learn about the BlueiceExtendedModel, which is based on blueice likelihoods and dive into its rate and shape parameters.
1.1 Initializing the model
This statistical model has the same basic functionalities to generate_data and then fit the data. However, the likelihood is a bit more complex than in the previous example. Thus, the definition of the parameters and of the individual likelihood terms are conveniently defined in a YAML configuration file.
[1]:
import numpy as np
import matplotlib.pyplot as plt
from alea import BlueiceExtendedModel
[2]:
# Just some plotting settings
import matplotlib as mpl
mpl.rcParams["figure.dpi"] = 200
mpl.rcParams["figure.figsize"] = [4, 3]
mpl.rcParams["font.family"] = "serif"
mpl.rcParams["font.size"] = 9
In this tutorial we’ll use the example provided in alea/alea/examples/configs/unbinned_wimp_statistical_model_simple.yaml and we initialize the model from this file via the .from_config() method. You can have a look at the file but it’s not necessary to understand every single entry now. But here are some comments to help understand the file. You’ll find the entries parameter_definition and likelihood_config:
name of the parameter (for example wimp_mass, livetime, wimp_rate_multiplier, etc.). The entries of each dictionary correspond to respective attributes of the Parameter class (for example nominal_value, fittable, description, etc.). To find out the meaning of each of these attributes you can either read about the class in the
documentation, directly look at the Parameter class docstring, or execute the following code snippet in the notebook:from alea import Parameter
Parameter?
likelihood_terms, which is a list containing the individual terms that are added to the likelihood. In our case there, there is only one term called science_run. The entry sources is a list of all the included signal and background sources – in our case er background and wimp signal defined in this term of the likelihood. Each source contains information to the location of the template and
related parameters.[3]:
config_path = "unbinned_wimp_statistical_model_simple.yaml"
model = BlueiceExtendedModel.from_config(config_path)
Computing/loading models on one core: 100%|██████████| 5/5 [00:00<00:00, 646.85it/s]
Again, let’s start by looking at which parameters we have defined in the model. Printing the parameters object will show us a table with all parameters and their attributes/properties. Especially the last column with the description can be helpful to understand the model:
[4]:
print(model.parameters)
nominal_value fittable ptype relative_uncertainty uncertainty blueice_anchors fit_limits parameter_interval_bounds fit_guess description
wimp_mass 50.0 False None None NaN None None None NaN WIMP mass in GeV/c^2
livetime 2.0 False livetime None NaN None None None NaN Livetime in years
wimp_rate_multiplier 1.0 True rate None NaN None [0, None] [0, 50] NaN None
er_rate_multiplier 1.0 True rate True 0.2 None [0, None] None 1.0 None
er_band_shift 0.0 True shape None NaN [-2, -1, 0, 1, 2] [-2, 2] None NaN ER band shape parameter (shifts the ER band up and down)
As we already saw in the configuration file, the model consists of a WIMP signal component (wimp_mass. wimp_rate_multiplier) and an electronic recoil (ER) background component (er_rate_multiplier, er_band_shift). In addition there is a parameter called livetime, which correspond to the exposure of the data acquisition period.
1.2 Generate Data
Before discussing rate and shape parameters, let’s have a look at some data generated from the model:
[5]:
data = model.generate_data()
[6]:
data.keys()
[6]:
dict_keys(['science_run', 'ancillary', 'generate_values'])
The data is a dictionary containing data from the science_run and the ancillary measurements. It also contains the generate_values, which are tha values of the parameters used to generate the data. We’ll discuss the ancillary measurements later and for now focus on the science_run data.
[7]:
data["science_run"]
[7]:
array([(46.23075713, 3785.8254384 , 0), (13.51097847, 2368.91268987, 0),
(50.29375555, 4645.70604737, 0), (86.32263227, 5190.61240359, 0),
(24.28469615, 1831.0807452 , 0), (59.70127754, 3692.42668058, 0),
(54.74253694, 3316.31124122, 0), (22.04167499, 1392.52028308, 0),
(95.55604957, 6219.97228189, 0), (10.09021665, 2039.16406492, 0),
(17.70999996, 1802.39426787, 0), (24.55857586, 2582.12247387, 0),
(51.07353678, 2703.18731584, 0), ( 7.90927184, 1466.42369337, 0),
(98.20174817, 6198.74463518, 0), (97.20093081, 5717.29203985, 0),
(98.84819874, 5359.786693 , 0), (75.88976515, 5663.1405716 , 0),
(48.26844872, 3199.97540106, 0), (93.60169097, 5889.64926164, 0),
(39.33268488, 3503.85575919, 0), ( 4.95800634, 1571.65534984, 0),
( 4.38727621, 1520.98420431, 0), (45.18103849, 4335.12827043, 0),
( 6.43852418, 1698.60128642, 0), (46.95441406, 3298.14744001, 0),
(71.80828928, 4034.97551652, 0), (16.07932551, 2190.46178925, 0),
(82.03693508, 6899.63234111, 0), (80.08382764, 4545.6639101 , 0),
(16.84629223, 1429.59428846, 0), (86.59568706, 6257.44975302, 0),
(41.04601213, 3223.9919503 , 0), (29.07972539, 2342.24498376, 0),
(48.25854553, 3309.21625264, 0), (73.36541864, 3966.50264836, 0),
(94.94927845, 4227.064332 , 0), (96.81978938, 6206.52264791, 0),
( 9.54601509, 1495.026959 , 0), (67.66254625, 4394.71889864, 0),
(68.64215864, 4295.15229485, 0), ( 9.62050146, 1789.02659573, 0),
(60.80393758, 2842.68479972, 0), (27.63346845, 2397.89178756, 0),
(70.98593398, 4783.29151223, 0), ( 7.97158331, 1602.27324852, 0),
(55.36883913, 3882.12002449, 0), (95.45347135, 3546.09715374, 0),
(37.99171809, 3383.23748596, 0), (44.012202 , 3554.27539533, 0),
(31.14608167, 2755.51071633, 0), (12.1546026 , 1480.78671555, 0),
(69.47194218, 4259.31411093, 0), (80.1685268 , 4652.89818653, 0),
(86.29416651, 4584.84134217, 0), (18.8180739 , 1058.24045636, 0),
(75.7818181 , 5313.36287338, 0), (79.66129405, 4749.13450578, 0),
(43.41974335, 3091.7268716 , 0), (11.01768876, 1327.95854885, 0),
( 4.37971688, 737.61560723, 0), (53.58672715, 2442.22251736, 0),
(58.39434931, 4000.61594628, 0), (36.9707711 , 2140.16329199, 0),
(14.74396774, 1338.56433104, 0), (56.55454921, 3351.42169376, 0),
(92.90355315, 6215.8885969 , 0), (16.91077737, 1294.26193337, 0),
(34.75524207, 3149.47197567, 0), (85.15544154, 4966.97125159, 0),
(74.23414395, 3715.89757023, 0), ( 3.08623263, 1208.44485815, 0),
(43.53778669, 2945.08332597, 0), (30.70165948, 2794.64939116, 0),
(10.9216346 , 1745.92090893, 0), (83.77153076, 3779.88691424, 0),
(86.71712961, 4837.06261767, 0), (32.9704159 , 2865.83624582, 0),
(62.65267658, 4673.63835757, 0), (98.32397816, 5775.17473555, 0),
(42.75018377, 2909.44194597, 0), (12.51148818, 2151.11656877, 0),
(73.59786548, 4833.73946435, 0), (50.53352431, 3313.80231056, 0),
(15.8930721 , 2769.21341208, 0), (41.8323103 , 3021.16319247, 0),
(29.72391934, 2249.57415562, 0), (26.68848018, 1560.38811919, 0),
( 4.9136865 , 1146.01932047, 0), (59.32133391, 4064.36268385, 0),
(17.80277871, 1974.13223293, 0), (20.32991524, 2045.03460706, 0),
(98.2030896 , 4604.03172866, 0), (51.04693663, 1830.24191813, 0),
(74.98350877, 3207.12322783, 0), (31.18713533, 2834.11156383, 0),
(77.57455676, 3842.94872981, 0), (82.44390778, 3844.64941903, 0),
(16.16509545, 2613.22910154, 0), (37.58413683, 3524.77131828, 0),
(78.14294187, 5064.38674035, 0), ( 6.08755814, 1147.21852789, 0),
(82.57502584, 4595.23960221, 0), ( 6.09054577, 1304.65840387, 0),
(97.70064535, 4251.32552687, 0), (99.78179381, 4927.62180986, 0),
(87.03971872, 4027.40595236, 0), (75.16301409, 3666.32421192, 0),
(25.99156155, 2708.4733144 , 0), (30.98527939, 2354.26569826, 0),
(74.61305613, 4584.0014399 , 0), (30.4020116 , 2671.16685094, 0),
(79.5260031 , 3988.65050638, 0), (35.11194519, 4097.26332822, 0),
(96.13024019, 4797.80759133, 0), (99.52627856, 4633.51024212, 0),
(49.97525787, 3553.81584164, 0), (21.97618324, 2184.49899675, 0),
( 7.54157106, 1591.85014692, 0), (19.47680909, 1631.96659401, 0),
(34.42674032, 2941.10753086, 0), (97.9428841 , 4982.690403 , 0),
(80.60428477, 5651.72794127, 0), (51.33759965, 3631.43676971, 0),
(35.76246322, 2291.60341865, 0), (98.57546711, 5661.67164253, 0),
(65.23286646, 3616.98807629, 0), (31.40755991, 2619.5354431 , 0),
(33.26216085, 1485.91527164, 0), (50.26555377, 3344.13348896, 0),
(49.20120758, 3780.91267701, 0), (77.85697951, 5776.58852142, 0),
(87.01489962, 4358.81064052, 0), (26.85545462, 2310.74121319, 0),
(84.43819724, 3855.61207806, 0), (81.92730733, 4667.29545549, 0),
(61.31962356, 3674.65504281, 0), (13.70913487, 1333.92557878, 0),
(70.65763352, 4188.96831081, 0), (45.69170135, 2964.06394629, 0),
(44.42320397, 3281.81247837, 0), (82.76219268, 4498.75644265, 0),
(46.7537081 , 3344.19018147, 0), (46.41130994, 3937.62840584, 0),
(36.55459496, 3262.63210401, 0), (10.35311895, 1602.74665548, 0),
(27.70157232, 2376.83797348, 0), (81.55964389, 3949.64755639, 0),
(10.58406971, 1877.8672045 , 0), (56.49141932, 3575.86796802, 0),
(73.62969741, 3994.73016083, 0), (47.46312944, 2884.18760123, 0),
( 2.87665512, 1012.23404956, 0), (58.59558411, 2149.96516037, 0),
(76.5653513 , 4134.4424944 , 0), (18.28153209, 2102.10914494, 0),
(78.26813047, 4519.8732602 , 0), (28.78351262, 2100.02770552, 0),
(83.47268574, 3663.87799862, 0), (50.92692182, 3073.75825238, 0),
(64.71153275, 3838.32797776, 0), (43.29612867, 3517.61640322, 0),
(96.17471436, 2656.89575109, 0), (75.49174774, 3269.53251267, 0),
(39.02781678, 2546.3208168 , 0), (63.93561167, 3973.95434058, 0),
(96.46426042, 4879.33616316, 0), (61.19038908, 4498.95412727, 0),
(63.69495887, 3234.76014353, 0), (27.5713981 , 2555.38078591, 0),
(82.65656262, 3243.15094311, 0), (58.61376484, 4198.13632188, 0),
(99.18448475, 5724.87600071, 0), (82.2575138 , 5260.12033698, 0),
(53.85425163, 2863.70381485, 0), (13.99781959, 1612.57328275, 0),
(38.44547824, 3336.37024202, 0), ( 6.79753262, 1105.2043497 , 0),
(61.84948691, 4036.09056319, 0), (51.84103101, 2464.76315143, 0),
(80.16675512, 3271.28607351, 0), (34.68688613, 3108.70515068, 0),
(60.54966062, 3909.23990073, 0), (99.04470326, 3992.53042454, 0),
(65.56625581, 5645.82935368, 0), (15.00849575, 2645.01771241, 0),
(93.53533797, 4104.18715083, 0), ( 3.53873511, 1289.09108726, 0),
(29.79943923, 2478.22993115, 0), (48.40711045, 4140.17639933, 0),
(81.80387052, 4106.70021404, 0), ( 5.64292734, 1183.39520584, 0),
(63.61863827, 4757.96090576, 0), (10.94532668, 1727.11680442, 0),
(69.25740343, 4854.68068104, 0), (94.30955045, 4586.75827175, 0),
(94.52845251, 5555.70087855, 0), ( 5.54499071, 1216.20613907, 0),
(26.65887383, 2557.21164485, 0), (22.25688161, 1935.96705182, 0),
(97.01858882, 5473.62708169, 0), (27.63122575, 2237.81024854, 0),
(71.98926931, 4673.5842254 , 0), (16.9445163 , 1151.20229216, 0),
(54.96647514, 4536.27673473, 0), (66.60810706, 4483.95793157, 0),
(29.42807419, 4078.00943323, 0), (98.0561598 , 5169.29800857, 0),
(37.18646068, 2184.83244695, 0), (41.52975983, 3579.25588839, 0),
(95.44079105, 4155.39110662, 0), (69.08434054, 4973.64463297, 0),
(75.07170437, 4360.53453719, 0), (56.74705482, 3763.73279513, 0),
(71.65235853, 3228.03896818, 0), ( 7.54633087, 1558.80527018, 0),
(68.20124808, 2622.56242871, 0), (55.71266647, 3142.6046709 , 0),
(41.49028445, 2221.90473969, 0), (98.47293839, 6099.32958241, 0),
(27.16200823, 1953.82601657, 0), (24.63141567, 1481.2706772 , 0),
(31.19439274, 3133.38047059, 0), ( 5.28523034, 1019.23690815, 0),
(57.66827318, 3794.10448332, 0), (41.24633946, 2652.02378974, 0),
(78.79418409, 4744.70926975, 0), ( 4.38012704, 1524.20760789, 0),
(64.46448677, 3488.81632651, 0), (94.43037151, 4233.5906155 , 0),
(15.93264351, 1157.32257259, 0), (35.12603308, 2072.83047703, 0),
(41.33994512, 2895.29163186, 0), (57.71058045, 3157.66669873, 0),
(38.11018803, 3481.80831047, 0), (40.73574882, 2603.37953383, 0),
(43.92183157, 3579.68549827, 0), (64.37622036, 3052.13555578, 0),
(91.45285185, 5459.22355449, 0), (25.73027655, 1765.91718558, 0),
(97.87180685, 5936.40740547, 0), (78.47694103, 6730.59996101, 0),
(24.58028415, 2315.09767083, 0), (32.52199109, 2690.26280485, 0),
(88.48138044, 4407.9407797 , 0), (59.95528036, 4271.21753215, 0),
(29.08474913, 3034.29060271, 0), (74.65729627, 4907.78183605, 0),
(24.47771941, 3025.15894218, 0), (54.88797789, 2866.20259106, 0),
(28.39516636, 3616.16842159, 0), (97.78492855, 6021.06899593, 0),
(58.12450287, 3432.03889993, 0), (98.45372703, 5992.99196168, 0),
(70.62466521, 3567.14842658, 0), (92.04886561, 4947.68374289, 0),
(29.18198734, 2095.91400054, 0), (30.72659249, 4163.70938844, 0),
(27.40996779, 3442.1277695 , 0), (85.59129591, 4531.79196111, 0),
(60.99319858, 3955.4087117 , 0), ( 8.35449764, 2033.43671747, 0),
(34.90430415, 2301.95757905, 0), (92.64684115, 4822.85149932, 0),
(55.93884589, 3618.59772088, 0), (94.95204161, 5044.53703226, 0),
(61.00453883, 2983.82521601, 0), (13.24858707, 1277.97283966, 0),
(86.21603526, 4159.91432401, 0), (75.3240904 , 3363.99335607, 0),
(61.6593386 , 3497.76840477, 0), (93.42874553, 3986.61172921, 0),
( 7.99738729, 1365.2512711 , 0), (69.27776187, 3699.28214831, 0),
(81.84696643, 2937.91830694, 0), (88.01458857, 5412.50113754, 0),
( 6.26191412, 1458.53658689, 0), (50.8730826 , 4251.5463089 , 0),
(99.73355455, 6945.17965696, 0), (72.31484704, 3152.56395807, 0),
(13.71396837, 1657.68008121, 0), (25.4377355 , 3578.546204 , 0),
(89.84828428, 3847.15816959, 0), (61.27431151, 2880.87728554, 0),
(68.44320406, 3155.93004636, 0), (55.00676274, 3462.91569182, 0),
(17.76962908, 2602.89832165, 0), (33.03122814, 2028.82638288, 0),
(60.67813307, 4579.73600473, 0), (74.56522825, 3297.72698752, 0),
(96.13090003, 4924.74929966, 0), (49.15274966, 3332.78534465, 0),
(55.95124853, 3292.34324256, 0), (22.80345093, 2253.88313136, 0),
(35.90775266, 2615.75056535, 0), (23.75075588, 2339.49381065, 0),
(29.6360634 , 3059.10578319, 0), (30.047926 , 1657.56734752, 0),
(42.86083471, 2532.67483856, 0), (75.46709544, 4078.07748096, 0),
(82.22212648, 3805.86426963, 0), (20.65173078, 1691.93132694, 0),
(45.5937925 , 2620.24949834, 0), (95.64652263, 4073.12526828, 0),
(93.96055465, 5057.54015506, 0), (45.76430875, 2867.05041601, 0),
(80.39205202, 3652.6697906 , 0), (95.75150144, 4714.52332147, 0),
(96.38310989, 3772.32264321, 0), (34.20251163, 2708.39390472, 0),
(56.44356423, 3218.49946806, 0), (76.26045978, 4368.17329309, 0),
(90.65298167, 4940.38360564, 0), (42.05280463, 3763.46295303, 0),
(42.37399449, 3785.36554735, 0), (52.71575968, 4387.89206591, 0),
(65.69511666, 4873.0765053 , 0), (70.234827 , 4120.14182016, 0),
(92.88912372, 4876.58170337, 0), ( 4.025399 , 566.11264405, 0),
(37.14365666, 2872.92035461, 0), (75.69292851, 4355.80433649, 0),
(25.51461303, 2513.31547872, 0), (62.52632232, 4771.90286321, 0),
(32.42711825, 2237.81808532, 0), (48.90552393, 3777.75452122, 0),
( 9.15698942, 2309.60187959, 0), (25.83894059, 1850.49755543, 0),
(76.36571446, 4415.29319308, 0), (91.39568953, 5303.83150729, 0),
(17.86559898, 2698.99883584, 0), (18.35801221, 1964.00930464, 0),
(19.92824225, 1976.03741814, 0), (16.61942732, 3920.82655288, 0),
(13.54456386, 1400.16980021, 0), (98.25770111, 4830.37651145, 0),
(66.20768799, 3240.53277354, 0), (94.65898271, 3665.38438429, 0),
(39.71077396, 4386.65315835, 0), (28.32322495, 3047.52610652, 0),
(87.26135634, 4738.22891098, 0), (99.96445521, 4948.95715011, 0),
(96.30083445, 4015.98290423, 0), (21.62178828, 1923.48658187, 0),
(61.65518162, 2792.05287265, 0), (42.35578337, 3094.44826272, 0),
(14.0774194 , 1579.17094461, 0), (81.29938045, 4428.53610514, 0),
(18.65411202, 1625.88948154, 0), (63.76745533, 2320.97725261, 0),
(52.4164088 , 3790.53138428, 0), (94.9166354 , 4910.20968293, 0),
(12.93948443, 1944.16557375, 0), (30.12727207, 2752.4106284 , 0),
(60.01405614, 3449.38067592, 0), (91.16016063, 3870.97936764, 0),
(43.29416308, 2624.10870392, 0), (28.37552046, 3354.17682865, 0),
(73.63398366, 4678.67682201, 0), (76.21466032, 4218.19854926, 0),
(42.79405807, 2533.85919697, 0), (83.32854204, 5379.40839497, 0),
(67.60993504, 3782.19768293, 0), (26.97945349, 3415.30129998, 0),
(24.92358013, 1913.30958068, 0), (44.46913505, 3029.564816 , 0),
(50.35054685, 3293.76248448, 0), (70.17883443, 2813.3465762 , 0),
(31.59857826, 3593.9112905 , 0), (38.03923643, 3285.22559774, 0),
(25.56172342, 2061.65895621, 0), (46.18446571, 3839.49329893, 0),
(99.42406487, 5114.89490339, 0), (74.21091672, 4143.46284441, 0),
(51.14994833, 3958.83933253, 0), (11.03211897, 1605.57136971, 0),
(88.51549465, 5398.96975774, 0), (48.73571745, 4196.71098211, 0),
(91.95169585, 3490.95445037, 0), (44.0582672 , 2947.81669686, 0),
(15.47613473, 2042.10447424, 0), (66.77380602, 2445.12154441, 0),
(33.83196538, 3014.80962753, 0), (57.87705397, 4190.53957453, 0),
(71.97777099, 3254.31265132, 0), (92.61786434, 4882.83533928, 0),
(93.36240996, 4891.06153804, 0), (92.42348716, 3931.95814582, 0),
(99.42845118, 4303.80511514, 0), (47.53735267, 3027.98015662, 0),
(26.68268748, 2870.1603711 , 0), (51.14171645, 2096.45842192, 0),
(39.69918869, 3547.69459528, 0), (52.84481319, 3763.70021584, 0),
( 9.69704276, 1623.77758512, 0), (20.69758285, 2683.98092971, 0),
(15.30051199, 2357.60532322, 0), (25.74989559, 2297.9141931 , 0),
(75.07742219, 3409.02968489, 0), (99.83849592, 3712.55544336, 0),
(21.89106668, 1268.7124031 , 1), (22.25391349, 1741.85631721, 1),
(25.39297309, 1461.17584857, 1), (40.5943938 , 970.07142816, 1),
(12.2914983 , 399.62894221, 1), (32.13263347, 1914.80990635, 1),
(19.55609784, 755.73889724, 1), (14.64466764, 1268.97865745, 1),
( 5.75005414, 253.37373347, 1), ( 9.15530106, 719.98306115, 1),
(11.37849705, 554.13822876, 1), (34.70918416, 1754.97794449, 1),
( 4.70830379, 577.77809631, 1), (13.57051102, 803.33999888, 1),
(35.9823066 , 3080.62400746, 1), ( 9.79152803, 774.20510151, 1),
(14.91601385, 968.47859131, 1), (54.51938694, 2984.62453438, 1),
(11.44859844, 658.47714632, 1), (43.15755448, 3550.28679552, 1),
(20.87919452, 1554.15442442, 1), (34.7684597 , 2160.44569079, 1),
( 7.4289749 , 1090.33002927, 1), (37.81165423, 1892.6155401 , 1)],
dtype=[('cs1', '<f8'), ('cs2', '<f8'), ('source', '<i8')])
We see that the data has entries cs1, cs2, and source. S1 and S2 are the prompt scintillation and delayed signal from drifted electrons, respectively. The “c” in front denotes that those are corrected for detector effects. The key source refers to the origin of each event. It is the index of the source name list, which we can look up with the get_source_name_list method:
[8]:
source_name_list = model.get_source_name_list(likelihood_name="science_run")
source_name_list
[8]:
['er', 'wimp']
Let’s have a look at the toy data:
[9]:
for i, source_name in enumerate(source_name_list):
mask = data["science_run"]["source"] == i
plt.scatter(
data["science_run"]["cs1"][mask], data["science_run"]["cs2"][mask], label=source_name, s=2
)
plt.xlabel("cs1")
plt.ylabel("cs2")
plt.semilogy()
plt.legend(loc="lower right")
[9]:
<matplotlib.legend.Legend at 0x129231fd0>
Most WIMP events have lower values of cs1 and cs2 compared to the ER events. We can use this to discriminate WIMP signal events from ER background events.
1.3 Rate parameters and shape parameters
Blueice distinguished between rate parameters, which only scale the expectation value of the respective component, and shape parameters, which also change the shape of the component. The only shape parameter used here is the er_band_shift, which shifts the ER band in the two dimensional parameter space. To illustrate this, let’s look at some toy data:
The rate parameters simply linearly scale the expectation values of each component of the model. Their nominal values are 1.0, which gives the following expectation values for the defined livetime:
[10]:
model.get_expectation_values()
[10]:
{'er': 400.0, 'wimp': 20.0}
We can verify that this is roughly what we observed in the data:
[11]:
for i, source_name in enumerate(source_name_list):
mask = data["science_run"]["source"] == i
print(f"Source {source_name} has {np.sum(mask)} events.")
Source er has 400 events.
Source wimp has 24 events.
If we choose a wimp_rate_multiplier of 10 we should thus see a 10-fold increase of the expected number of WIMP events:
[12]:
model.get_expectation_values(wimp_rate_multiplier=10.0)
[12]:
{'er': 400.0, 'wimp': 200.0}
[13]:
wimp_rich_data = model.generate_data(wimp_rate_multiplier=10.0)
for i, source_name in enumerate(source_name_list):
mask = wimp_rich_data["science_run"]["source"] == i
print(f"Source {source_name} has {np.sum(mask)} events.")
Source er has 393 events.
Source wimp has 198 events.
Now let’s see what the shape parameters do. We generate a toy dataset with the nominal and the two extreme values of the er_band_shift parameter and see what this does to the data:
[14]:
for er_band_shift, c in zip([2, 0, -2], ["crimson", "k", "dodgerblue"]):
data = model.generate_data(er_band_shift=er_band_shift)
mask = data["science_run"]["source"] == source_name_list.index("er")
plt.scatter(
data["science_run"]["cs1"][mask],
data["science_run"]["cs2"][mask],
label=f"er_band_shift={er_band_shift}",
c=c,
s=2,
)
plt.xlabel("cs1")
plt.ylabel("cs2")
plt.semilogy()
plt.legend(loc="lower right")
[14]:
<matplotlib.legend.Legend at 0x12a01c090>
As you can see, the parameter er_band_shift moves the ER band up and down in log(cs2). Note that you can choose any value between the highest and lowest blueice_anchor for this parameter, blueice will interpolate the er tamplate for you:
[15]:
model.parameters.er_band_shift.blueice_anchors
[15]:
[-2, -1, 0, 1, 2]
[16]:
er_band_shift = 1.42
data = model.generate_data(er_band_shift=er_band_shift)
mask = data["science_run"]["source"] == source_name_list.index("er")
plt.scatter(
data["science_run"]["cs1"][mask],
data["science_run"]["cs2"][mask],
label=f"er_band_shift={er_band_shift}",
c="mediumseagreen",
s=2,
)
plt.xlabel("cs1")
plt.ylabel("cs2")
plt.semilogy()
plt.legend(loc="lower right")
[16]:
<matplotlib.legend.Legend at 0x12a0d5e10>
[ ]: