3
$\begingroup$

I'd like to combine three separate fits to one. As you can see in the picture below, there's an underground I manually fitted with the function

k = Divide[Log[10/35], 2000]
UndergroundFit[c_] := 37*Exp(-k*c). 

The two peaks were fitted with a Lorentz-curve model like this:

LorentzModel = Divide[2*A, 4*(c - p)^2 + FWHM^2];
LorentzFitPeak1 = NonlinearModelFit[ListPeak1, 
  Divide[2*A, 4*(c - p)^2 + FWHM^2] + 30, {{A, 100}, p, FWHM}, c];
LorentzFitPeak2 = NonlinearModelFit[ListPeak2, 
  Divide[2*A, 4*(c - p)^2 + FWHM^2] + 16, {{A, 60}, p, FWHM}, c];

ListPeak1 and ListPeak2 are subsets of the main set of data:

CalibCountsPairs= {{1,0},{2,0},{3,0},{4,0},{5,0},{6,0},{7,0},{8,0},{9,0},{10,0},{11,0},{12,0},{13,0},{14,0},{15,0},{16,0},{17,0},{18,0},{19,0},{20,0},{21,0},{22,0},{23,0},{24,0},{25,0},{26,0},{27,0},{28,0},{29,0},{30,0},{31,0},{32,0},{33,0},{34,0},{35,0},{36,0},{37,0},{38,0},{39,0},{40,0},{41,0},{42,44},{43,46},{44,47},{45,42},{46,41},{47,45},{48,42},{49,46},{50,48},{51,54},{52,40},{53,45},{54,49},{55,49},{56,39},{57,36},{58,29},{59,49},{60,46},{61,41},{62,43},{63,29},{64,37},{65,31},{66,35},{67,40},{68,29},{69,37},{70,28},{71,33},{72,32},{73,35},{74,42},{75,25},{76,37},{77,36},{78,37},{79,41},{80,38},{81,43},{82,36},{83,48},{84,26},{85,31},{86,48},{87,41},{88,36},{89,41},{90,34},{91,26},{92,34},{93,32},{94,29},{95,38},{96,26},{97,38},{98,26},{99,32},{100,39},{101,44},{102,32},{103,38},{104,24},{105,37},{106,50},{107,34},{108,31},{109,30},{110,26},{111,34},{112,37},{113,32},{114,39},{115,40},{116,28},{117,37},{118,27},{119,43},{120,35},{121,29},{122,32},{123,37},{124,32},{125,48},{126,29},{127,26},{128,38},{129,25},{130,35},{131,24},{132,28},{133,44},{134,28},{135,29},{136,31},{137,27},{138,40},{139,35},{140,26},{141,31},{142,36},{143,34},{144,34},{145,29},{146,39},{147,30},{148,36},{149,27},{150,35},{151,23},{152,32},{153,25},{154,37},{155,35},{156,41},{157,33},{158,36},{159,30},{160,31},{161,35},{162,31},{163,30},{164,27},{165,33},{166,22},{167,39},{168,39},{169,29},{170,33},{171,36},{172,35},{173,30},{174,31},{175,32},{176,38},{177,28},{178,25},{179,39},{180,35},{181,36},{182,30},{183,20},{184,30},{185,28},{186,30},{187,27},{188,43},{189,22},{190,35},{191,40},{192,34},{193,32},{194,30},{195,34},{196,31},{197,28},{198,30},{199,31},{200,39},{201,42},{202,37},{203,32},{204,42},{205,34},{206,33},{207,25},{208,31},{209,34},{210,43},{211,30},{212,35},{213,32},{214,29},{215,29},{216,30},{217,31},{218,28},{219,27},{220,37},{221,31},{222,23},{223,27},{224,29},{225,33},{226,29},{227,32},{228,32},{229,35},{230,29},{231,31},{232,33},{233,31},{234,34},{235,21},{236,33},{237,29},{238,37},{239,40},{240,26},{241,40},{242,39},{243,34},{244,39},{245,29},{246,29},{247,33},{248,23},{249,29},{250,31},{251,30},{252,34},{253,31},{254,26},{255,26},{256,35},{257,34},{258,25},{259,35},{260,37},{261,32},{262,35},{263,33},{264,29},{265,31},{266,30},{267,32},{268,32},{269,27},{270,31},{271,38},{272,33},{273,28},{274,36},{275,25},{276,32},{277,35},{278,33},{279,33},{280,40},{281,37},{282,36},{283,30},{284,28},{285,33},{286,33},{287,33},{288,36},{289,31},{290,46},{291,43},{292,31},{293,37},{294,33},{295,41},{296,37},{297,34},{298,48},{299,45},{300,40},{301,48},{302,38},{303,51},{304,48},{305,48},{306,37},{307,63},{308,40},{309,44},{310,55},{311,50},{312,45},{313,58},{314,56},{315,42},{316,57},{317,67},{318,44},{319,59},{320,65},{321,72},{322,70},{323,68},{324,69},{325,61},{326,68},{327,60},{328,64},{329,83},{330,63},{331,70},{332,66},{333,61},{334,70},{335,83},{336,74},{337,66},{338,63},{339,73},{340,73},{341,54},{342,94},{343,86},{344,82},{345,87},{346,94},{347,81},{348,65},{349,89},{350,92},{351,85},{352,86},{353,86},{354,86},{355,98},{356,97},{357,79},{358,97},{359,111},{360,97},{361,96},{362,90},{363,85},{364,90},{365,98},{366,99},{367,104},{368,96},{369,79},{370,87},{371,101},{372,92},{373,103},{374,85},{375,97},{376,72},{377,92},{378,101},{379,100},{380,102},{381,86},{382,91},{383,102},{384,95},{385,110},{386,97},{387,105},{388,91},{389,98},{390,92},{391,96},{392,75},{393,94},{394,81},{395,63},{396,76},{397,89},{398,73},{399,91},{400,70},{401,76},{402,67},{403,76},{404,85},{405,71},{406,84},{407,77},{408,85},{409,69},{410,60},{411,73},{412,78},{413,78},{414,66},{415,80},{416,79},{417,67},{418,54},{419,77},{420,71},{421,64},{422,58},{423,60},{424,54},{425,55},{426,53},{427,69},{428,75},{429,60},{430,60},{431,50},{432,50},{433,77},{434,60},{435,51},{436,55},{437,54},{438,57},{439,58},{440,55},{441,58},{442,61},{443,53},{444,44},{445,54},{446,52},{447,57},{448,40},{449,54},{450,39},{451,60},{452,51},{453,47},{454,47},{455,55},{456,48},{457,47},{458,55},{459,29},{460,41},{461,43},{462,44},{463,32},{464,46},{465,40},{466,46},{467,41},{468,45},{469,40},{470,43},{471,37},{472,47},{473,43},{474,47},{475,41},{476,44},{477,34},{478,46},{479,37},{480,32},{481,29},{482,45},{483,37},{484,38},{485,40},{486,29},{487,33},{488,41},{489,31},{490,38},{491,33},{492,46},{493,37},{494,38},{495,29},{496,34},{497,37},{498,37},{499,32},{500,33},{501,32},{502,38},{503,41},{504,34},{505,29},{506,29},{507,35},{508,21},{509,38},{510,40},{511,30},{512,39},{513,26},{514,28},{515,13},{516,24},{517,31},{518,31},{519,29},{520,32},{521,46},{522,22},{523,36},{524,29},{525,36},{526,26},{527,22},{528,24},{529,31},{530,22},{531,27},{532,25},{533,23},{534,39},{535,24},{536,31},{537,35},{538,26},{539,29},{540,22},{541,25},{542,42},{543,32},{544,29},{545,30},{546,32},{547,27},{548,31},{549,28},{550,22},{551,30},{552,28},{553,20},{554,26},{555,24},{556,32},{557,22},{558,33},{559,30},{560,24},{561,33},{562,33},{563,20},{564,33},{565,20},{566,24},{567,15},{568,18},{569,36},{570,30},{571,21},{572,32},{573,30},{574,27},{575,19},{576,26},{577,33},{578,28},{579,17},{580,31},{581,25},{582,24},{583,19},{584,31},{585,30},{586,23},{587,24},{588,20},{589,25},{590,23},{591,27},{592,19},{593,26},{594,24},{595,20},{596,20},{597,27},{598,32},{599,16},{600,25},{601,25},{602,29},{603,19},{604,22},{605,25},{606,34},{607,23},{608,29},{609,23},{610,21},{611,20},{612,30},{613,22},{614,24},{615,41},{616,29},{617,20},{618,36},{619,24},{620,30},{621,25},{622,37},{623,25},{624,26},{625,14},{626,17},{627,39},{628,25},{629,27},{630,19},{631,27},{632,22},{633,24},{634,20},{635,18},{636,29},{637,37},{638,22},{639,24},{640,25},{641,29},{642,27},{643,18},{644,21},{645,27},{646,22},{647,28},{648,24},{649,32},{650,10},{651,32},{652,21},{653,22},{654,27},{655,29},{656,17},{657,26},{658,25},{659,31},{660,31},{661,20},{662,22},{663,24},{664,17},{665,27},{666,17},{667,20},{668,26},{669,20},{670,22},{671,24},{672,26},{673,30},{674,26},{675,22},{676,24},{677,19},{678,27},{679,18},{680,22},{681,20},{682,40},{683,23},{684,37},{685,21},{686,28},{687,31},{688,24},{689,23},{690,21},{691,29},{692,19},{693,29},{694,19},{695,25},{696,20},{697,26},{698,23},{699,27},{700,21},{701,32},{702,21},{703,24},{704,22},{705,34},{706,27},{707,22},{708,19},{709,23},{710,18},{711,15},{712,19},{713,18},{714,31},{715,28},{716,25},{717,25},{718,25},{719,16},{720,13},{721,21},{722,22},{723,24},{724,15},{725,20},{726,28},{727,28},{728,29},{729,21},{730,26},{731,24},{732,26},{733,14},{734,26},{735,24},{736,21},{737,29},{738,25},{739,20},{740,18},{741,22},{742,25},{743,27},{744,29},{745,28},{746,17},{747,15},{748,21},{749,22},{750,27},{751,19},{752,24},{753,22},{754,19},{755,19},{756,24},{757,21},{758,22},{759,25},{760,29},{761,20},{762,14},{763,21},{764,28},{765,30},{766,24},{767,30},{768,21},{769,18},{770,23},{771,29},{772,16},{773,27},{774,23},{775,27},{776,25},{777,21},{778,25},{779,24},{780,30},{781,22},{782,21},{783,24},{784,17},{785,20},{786,17},{787,15},{788,21},{789,17},{790,27},{791,27},{792,22},{793,18},{794,29},{795,19},{796,24},{797,24},{798,19},{799,17},{800,24},{801,25},{802,27},{803,31},{804,25},{805,20},{806,24},{807,14},{808,26},{809,24},{810,25},{811,27},{812,30},{813,16},{814,27},{815,17},{816,28},{817,22},{818,24},{819,14},{820,17},{821,16},{822,20},{823,19},{824,19},{825,17},{826,28},{827,16},{828,14},{829,25},{830,26},{831,19},{832,30},{833,30},{834,27},{835,27},{836,24},{837,21},{838,19},{839,17},{840,21},{841,22},{842,24},{843,20},{844,27},{845,19},{846,19},{847,25},{848,39},{849,19},{850,21},{851,30},{852,27},{853,29},{854,30},{855,39},{856,36},{857,20},{858,35},{859,18},{860,26},{861,34},{862,17},{863,30},{864,27},{865,32},{866,32},{867,27},{868,35},{869,25},{870,29},{871,32},{872,23},{873,35},{874,29},{875,27},{876,35},{877,32},{878,27},{879,33},{880,39},{881,39},{882,28},{883,27},{884,36},{885,20},{886,26},{887,35},{888,42},{889,30},{890,34},{891,38},{892,32},{893,46},{894,31},{895,51},{896,33},{897,41},{898,44},{899,42},{900,44},{901,36},{902,37},{903,44},{904,48},{905,34},{906,35},{907,45},{908,39},{909,42},{910,30},{911,43},{912,49},{913,48},{914,40},{915,41},{916,43},{917,54},{918,41},{919,46},{920,41},{921,45},{922,44},{923,45},{924,52},{925,42},{926,50},{927,39},{928,48},{929,50},{930,49},{931,39},{932,60},{933,70},{934,53},{935,62},{936,51},{937,63},{938,51},{939,45},{940,43},{941,60},{942,56},{943,54},{944,43},{945,68},{946,49},{947,53},{948,46},{949,42},{950,56},{951,62},{952,52},{953,55},{954,42},{955,35},{956,53},{957,56},{958,53},{959,58},{960,55},{961,64},{962,65},{963,54},{964,57},{965,58},{966,58},{967,53},{968,71},{969,46},{970,72},{971,47},{972,56},{973,55},{974,69},{975,66},{976,59},{977,63},{978,51},{979,55},{980,56},{981,63},{982,52},{983,56},{984,53},{985,56},{986,57},{987,48},{988,53},{989,50},{990,57},{991,59},{992,56},{993,46},{994,58},{995,62},{996,53},{997,45},{998,53},{999,67},{1000,54},{1001,53},{1002,46},{1003,53},{1004,66},{1005,62},{1006,48},{1007,53},{1008,55},{1009,47},{1010,50},{1011,62},{1012,51},{1013,59},{1014,43},{1015,61},{1016,52},{1017,55},{1018,51},{1019,44},{1020,55},{1021,42},{1022,47},{1023,46},{1024,50},{1025,52},{1026,47},{1027,53},{1028,44},{1029,49},{1030,54},{1031,56},{1032,44},{1033,47},{1034,49},{1035,49},{1036,57},{1037,49},{1038,36},{1039,42},{1040,63},{1041,55},{1042,39},{1043,43},{1044,44},{1045,32},{1046,37},{1047,47},{1048,29},{1049,45},{1050,34},{1051,42},{1052,36},{1053,38},{1054,36},{1055,39},{1056,34},{1057,34},{1058,34},{1059,39},{1060,40},{1061,39},{1062,33},{1063,27},{1064,38},{1065,36},{1066,40},{1067,47},{1068,30},{1069,39},{1070,42},{1071,42},{1072,32},{1073,27},{1074,39},{1075,30},{1076,38},{1077,32},{1078,43},{1079,32},{1080,36},{1081,37},{1082,38},{1083,35},{1084,21},{1085,29},{1086,29},{1087,24},{1088,27},{1089,28},{1090,24},{1091,22},{1092,27},{1093,31},{1094,35},{1095,27},{1096,35},{1097,31},{1098,27},{1099,26},{1100,30},{1101,25},{1102,29},{1103,29},{1104,25},{1105,20},{1106,23},{1107,33},{1108,25},{1109,26},{1110,25},{1111,25},{1112,25},{1113,18},{1114,20},{1115,23},{1116,20},{1117,19},{1118,20},{1119,28},{1120,21},{1121,17},{1122,13},{1123,18},{1124,24},{1125,25},{1126,18},{1127,17},{1128,24},{1129,31},{1130,24},{1131,25},{1132,19},{1133,15},{1134,25},{1135,24},{1136,23},{1137,17},{1138,18},{1139,26},{1140,25},{1141,21},{1142,21},{1143,17},{1144,29},{1145,24},{1146,23},{1147,23},{1148,24},{1149,19},{1150,27},{1151,17},{1152,21},{1153,24},{1154,18},{1155,20},{1156,16},{1157,21},{1158,20},{1159,21},{1160,21},{1161,17},{1162,19},{1163,15},{1164,15},{1165,21},{1166,9},{1167,14},{1168,8},{1169,18},{1170,15},{1171,18},{1172,5},{1173,24},{1174,19},{1175,23},{1176,14},{1177,11},{1178,15},{1179,13},{1180,16},{1181,20},{1182,16},{1183,11},{1184,12},{1185,13},{1186,23},{1187,11},{1188,18},{1189,17},{1190,16},{1191,14},{1192,20},{1193,13},{1194,27},{1195,16},{1196,23},{1197,17},{1198,15},{1199,14},{1200,18},{1201,16},{1202,18},{1203,17},{1204,9},{1205,19},{1206,18},{1207,22},{1208,18},{1209,16},{1210,19},{1211,20},{1212,15},{1213,17},{1214,13},{1215,17},{1216,17},{1217,14},{1218,16},{1219,14},{1220,17},{1221,17},{1222,11},{1223,17},{1224,12},{1225,13},{1226,15},{1227,20},{1228,13},{1229,10},{1230,9},{1231,13},{1232,19},{1233,12},{1234,18},{1235,26},{1236,19},{1237,16},{1238,12},{1239,18},{1240,11},{1241,12},{1242,13},{1243,10},{1244,22},{1245,10},{1246,10},{1247,16},{1248,20},{1249,23},{1250,12},{1251,15},{1252,13},{1253,11},{1254,12},{1255,13},{1256,11},{1257,21},{1258,21},{1259,13},{1260,14},{1261,15},{1262,20},{1263,17},{1264,14},{1265,15},{1266,24},{1267,24},{1268,22},{1269,16},{1270,20},{1271,18},{1272,18},{1273,18},{1274,17},{1275,12},{1276,22},{1277,13},{1278,8},{1279,15},{1280,17},{1281,12},{1282,14},{1283,20},{1284,17},{1285,18},{1286,9},{1287,11},{1288,12},{1289,19},{1290,14},{1291,13},{1292,13},{1293,19},{1294,21},{1295,18},{1296,15},{1297,17},{1298,21},{1299,21},{1300,9},{1301,17},{1302,15},{1303,8},{1304,11},{1305,14},{1306,18},{1307,11},{1308,22},{1309,13},{1310,16},{1311,16},{1312,28},{1313,25},{1314,17},{1315,18},{1316,12},{1317,15},{1318,18},{1319,17},{1320,13},{1321,18},{1322,18},{1323,21},{1324,18},{1325,8},{1326,22},{1327,20},{1328,19},{1329,12},{1330,17},{1331,16},{1332,10},{1333,13},{1334,13},{1335,14},{1336,13},{1337,22},{1338,19},{1339,23},{1340,15},{1341,11},{1342,14},{1343,13},{1344,11},{1345,12},{1346,25},{1347,12},{1348,23},{1349,13},{1350,15},{1351,17},{1352,13},{1353,15},{1354,15},{1355,10},{1356,21},{1357,18},{1358,14},{1359,15},{1360,21},{1361,20},{1362,23},{1363,17},{1364,25},{1365,15},{1366,20},{1367,14},{1368,10},{1369,25},{1370,17},{1371,21},{1372,16},{1373,10},{1374,14},{1375,22},{1376,16},{1377,23},{1378,19},{1379,18},{1380,16},{1381,18},{1382,21},{1383,28},{1384,19},{1385,14},{1386,18},{1387,11},{1388,20},{1389,22},{1390,16},{1391,17},{1392,22},{1393,14},{1394,21},{1395,21},{1396,18},{1397,17},{1398,17},{1399,20},{1400,23},{1401,20},{1402,24},{1403,23},{1404,12},{1405,15},{1406,20},{1407,20},{1408,9},{1409,17},{1410,21},{1411,13},{1412,18},{1413,16},{1414,16},{1415,23},{1416,15},{1417,11},{1418,14},{1419,24},{1420,22},{1421,18},{1422,12},{1423,13},{1424,19},{1425,17},{1426,17},{1427,19},{1428,24},{1429,12},{1430,12},{1431,19},{1432,20},{1433,21},{1434,14},{1435,17},{1436,28},{1437,14},{1438,19},{1439,14},{1440,21},{1441,18},{1442,14},{1443,17},{1444,17},{1445,17},{1446,16},{1447,14},{1448,18},{1449,17},{1450,16},{1451,21},{1452,16},{1453,23},{1454,19},{1455,12},{1456,15},{1457,13},{1458,22},{1459,22},{1460,13},{1461,9},{1462,12},{1463,19},{1464,16},{1465,20},{1466,23},{1467,25},{1468,19},{1469,22},{1470,19},{1471,22},{1472,19},{1473,15},{1474,21},{1475,14},{1476,18},{1477,15},{1478,15},{1479,21},{1480,17},{1481,14},{1482,23},{1483,20},{1484,25},{1485,12},{1486,25},{1487,21},{1488,15},{1489,22},{1490,14},{1491,16},{1492,18},{1493,21},{1494,19},{1495,16},{1496,10},{1497,20},{1498,16},{1499,14},{1500,15},{1501,10},{1502,17},{1503,17},{1504,15},{1505,21},{1506,13},{1507,22},{1508,17},{1509,25},{1510,18},{1511,24},{1512,20},{1513,14},{1514,15},{1515,27},{1516,11},{1517,11},{1518,15},{1519,14},{1520,12},{1521,20},{1522,12},{1523,15},{1524,9},{1525,19},{1526,16},{1527,16},{1528,18},{1529,19},{1530,11},{1531,22},{1532,11},{1533,14},{1534,14},{1535,14},{1536,10},{1537,14},{1538,7},{1539,19},{1540,12},{1541,13},{1542,24},{1543,14},{1544,13},{1545,18},{1546,14},{1547,13},{1548,12},{1549,17},{1550,17},{1551,24},{1552,14},{1553,8},{1554,17},{1555,20},{1556,15},{1557,6},{1558,14},{1559,13},{1560,19},{1561,12},{1562,16},{1563,14},{1564,13},{1565,14},{1566,20},{1567,14},{1568,12},{1569,20},{1570,11},{1571,17},{1572,15},{1573,14},{1574,15},{1575,9},{1576,13},{1577,16},{1578,23},{1579,13},{1580,24},{1581,15},{1582,18},{1583,15},{1584,21},{1585,14},{1586,17},{1587,12},{1588,10},{1589,16},{1590,15},{1591,14},{1592,11},{1593,18},{1594,17},{1595,9},{1596,15},{1597,13},{1598,20},{1599,14},{1600,10},{1601,12},{1602,9},{1603,10},{1604,13},{1605,12},{1606,11},{1607,16},{1608,11},{1609,15},{1610,12},{1611,14},{1612,17},{1613,21},{1614,12},{1615,6},{1616,13},{1617,15},{1618,16},{1619,14},{1620,18},{1621,5},{1622,12},{1623,11},{1624,16},{1625,12},{1626,11},{1627,10},{1628,13},{1629,14},{1630,13},{1631,17},{1632,11},{1633,21},{1634,12},{1635,16},{1636,10},{1637,10},{1638,12},{1639,8},{1640,12},{1641,18},{1642,16},{1643,15},{1644,8},{1645,14},{1646,16},{1647,13},{1648,8},{1649,13},{1650,9},{1651,10},{1652,8},{1653,13},{1654,12},{1655,10},{1656,14},{1657,16},{1658,18},{1659,17},{1660,9},{1661,14},{1662,18},{1663,17},{1664,9},{1665,9},{1666,19},{1667,16},{1668,13},{1669,10},{1670,11},{1671,15},{1672,15},{1673,9},{1674,12},{1675,10},{1676,9},{1677,16},{1678,10},{1679,16},{1680,12},{1681,8},{1682,10},{1683,19},{1684,10},{1685,9},{1686,7},{1687,11},{1688,9},{1689,9},{1690,15},{1691,12},{1692,8},{1693,17},{1694,13},{1695,13},{1696,18},{1697,11},{1698,9},{1699,10},{1700,5},{1701,11},{1702,10},{1703,10},{1704,18},{1705,15},{1706,12},{1707,14},{1708,16},{1709,22},{1710,9},{1711,15},{1712,14},{1713,13},{1714,18},{1715,16},{1716,12},{1717,12},{1718,13},{1719,13},{1720,8},{1721,12},{1722,10},{1723,13},{1724,13},{1725,8},{1726,14},{1727,13},{1728,15},{1729,9},{1730,12},{1731,11},{1732,8},{1733,14},{1734,16},{1735,16},{1736,15},{1737,13},{1738,13},{1739,11},{1740,15},{1741,16},{1742,8},{1743,18},{1744,14},{1745,11},{1746,12},{1747,10},{1748,10},{1749,14},{1750,9},{1751,13},{1752,11},{1753,12},{1754,13},{1755,10},{1756,14},{1757,20},{1758,9},{1759,7},{1760,11},{1761,10},{1762,11},{1763,11},{1764,8},{1765,15},{1766,8},{1767,17},{1768,11},{1769,10},{1770,12},{1771,9},{1772,16},{1773,11},{1774,14},{1775,11},{1776,14},{1777,15},{1778,12},{1779,16},{1780,13},{1781,15},{1782,13},{1783,13},{1784,15},{1785,16},{1786,13},{1787,14},{1788,16},{1789,10},{1790,11},{1791,9},{1792,15},{1793,6},{1794,17},{1795,11},{1796,13},{1797,8},{1798,12},{1799,12},{1800,15},{1801,12},{1802,13},{1803,12},{1804,12},{1805,11},{1806,10},{1807,9},{1808,4},{1809,12},{1810,8},{1811,15},{1812,12},{1813,12},{1814,13},{1815,6},{1816,14},{1817,12},{1818,10},{1819,7},{1820,14},{1821,14},{1822,12},{1823,13},{1824,8},{1825,10},{1826,6},{1827,7},{1828,14},{1829,14},{1830,8},{1831,7},{1832,11},{1833,6},{1834,9},{1835,10},{1836,14},{1837,10},{1838,7},{1839,6},{1840,6},{1841,11},{1842,12},{1843,14},{1844,12},{1845,16},{1846,13},{1847,7},{1848,10},{1849,10},{1850,10},{1851,12},{1852,8},{1853,6},{1854,9},{1855,9},{1856,14},{1857,11},{1858,9},{1859,10},{1860,9},{1861,18},{1862,8},{1863,9},{1864,4},{1865,4},{1866,12},{1867,14},{1868,8},{1869,11},{1870,8},{1871,9},{1872,11},{1873,12},{1874,13},{1875,9},{1876,7},{1877,10},{1878,10},{1879,11},{1880,6},{1881,9},{1882,7},{1883,7},{1884,6},{1885,13},{1886,9},{1887,9},{1888,8},{1889,9},{1890,9},{1891,7},{1892,7},{1893,2},{1894,8},{1895,11},{1896,9},{1897,12},{1898,12},{1899,13},{1900,12},{1901,13},{1902,14},{1903,12},{1904,5},{1905,12},{1906,8},{1907,7},{1908,17},{1909,4},{1910,7},{1911,9},{1912,10},{1913,13},{1914,11},{1915,12},{1916,10},{1917,11},{1918,11},{1919,8},{1920,11},{1921,14},{1922,14},{1923,10},{1924,13},{1925,7},{1926,7},{1927,11},{1928,12},{1929,10},{1930,11},{1931,12},{1932,9},{1933,11},{1934,10},{1935,12},{1936,13},{1937,13},{1938,7},{1939,15},{1940,19},{1941,10},{1942,15},{1943,9},{1944,9},{1945,13},{1946,12},{1947,13},{1948,14},{1949,12},{1950,8},{1951,7},{1952,19},{1953,11},{1954,10},{1955,4},{1956,5},{1957,9},{1958,13},{1959,14},{1960,7},{1961,10},{1962,11},{1963,5},{1964,5},{1965,8},{1966,6},{1967,11},{1968,13},{1969,9},{1970,8},{1971,13},{1972,13},{1973,14},{1974,9},{1975,12},{1976,8},{1977,10},{1978,13},{1979,9},{1980,14},{1981,7},{1982,11},{1983,7},{1984,10},{1985,8},{1986,8},{1987,9},{1988,13},{1989,8},{1990,8},{1991,13},{1992,13},{1993,7},{1994,8},{1995,11},{1996,8},{1997,11},{1998,11},{1999,13},{2000,4},{2001,9},{2002,10},{2003,10},{2004,8},{2005,5},{2006,10},{2007,13},{2008,8},{2009,13},{2010,3},{2011,9},{2012,9},{2013,10},{2014,7},{2015,15},{2016,8},{2017,12},{2018,5},{2019,6},{2020,12},{2021,10},{2022,10},{2023,7},{2024,15},{2025,7},{2026,10},{2027,10},{2028,9},{2029,9},{2030,8},{2031,15},{2032,13},{2033,9},{2034,7},{2035,10},{2036,8},{2037,15},{2038,15},{2039,7},{2040,6},{2041,10},{2042,12},{2043,7},{2044,11},{2045,7},{2046,8},{2047,9},{2048,12},{2049,8},{2050,10},{2051,6},{2052,12},{2053,8},{2054,8},{2055,12},{2056,6},{2057,10},{2058,15},{2059,11},{2060,7},{2061,8},{2062,9},{2063,10},{2064,7},{2065,7},{2066,10},{2067,11},{2068,8},{2069,6},{2070,9},{2071,12},{2072,4},{2073,8},{2074,6},{2075,11},{2076,7},{2077,3},{2078,12},{2079,9},{2080,3},{2081,14},{2082,6},{2083,6},{2084,15},{2085,10},{2086,11},{2087,10},{2088,9},{2089,7},{2090,6},{2091,3},{2092,11},{2093,5},{2094,13},{2095,4},{2096,11},{2097,12},{2098,6},{2099,13},{2100,9},{2101,12},{2102,8},{2103,9},{2104,5},{2105,8},{2106,6},{2107,10},{2108,11},{2109,10},{2110,14},{2111,9},{2112,9},{2113,4},{2114,12},{2115,15},{2116,8},{2117,11},{2118,16},{2119,11},{2120,17},{2121,10},{2122,7},{2123,15},{2124,8},{2125,8},{2126,8},{2127,8},{2128,9},{2129,10},{2130,8},{2131,4},{2132,9},{2133,8},{2134,5},{2135,12},{2136,10},{2137,14},{2138,12},{2139,7},{2140,10},{2141,9},{2142,12},{2143,11},{2144,13},{2145,6},{2146,4},{2147,10},{2148,5},{2149,7},{2150,7},{2151,10},{2152,7},{2153,5},{2154,9},{2155,6},{2156,9},{2157,4},{2158,9},{2159,9},{2160,9},{2161,8},{2162,8},{2163,8},{2164,8},{2165,13},{2166,8},{2167,6},{2168,7},{2169,8},{2170,9},{2171,11},{2172,11},{2173,10},{2174,8},{2175,7},{2176,8},{2177,4},{2178,8},{2179,7},{2180,8},{2181,6},{2182,8},{2183,9},{2184,8},{2185,10},{2186,3},{2187,8},{2188,6},{2189,11},{2190,7},{2191,8},{2192,9},{2193,4},{2194,13},{2195,11},{2196,8},{2197,13},{2198,8},{2199,5},{2200,7},{2201,11},{2202,15},{2203,4},{2204,7},{2205,9},{2206,5},{2207,4},{2208,10},{2209,6},{2210,6},{2211,11},{2212,10},{2213,13},{2214,8},{2215,10},{2216,9},{2217,10},{2218,8},{2219,4},{2220,10},{2221,8},{2222,11},{2223,10},{2224,13},{2225,7},{2226,11},{2227,13},{2228,7},{2229,4},{2230,4},{2231,5},{2232,7},{2233,11},{2234,11},{2235,6},{2236,8},{2237,6},{2238,7},{2239,6},{2240,11},{2241,7},{2242,13},{2243,10},{2244,8},{2245,8},{2246,4},{2247,6},{2248,8},{2249,9},{2250,9},{2251,6},{2252,6},{2253,10},{2254,6},{2255,10},{2256,6},{2257,5},{2258,13},{2259,13},{2260,14},{2261,9},{2262,12},{2263,5},{2264,4},{2265,5},{2266,9},{2267,10},{2268,10},{2269,7},{2270,6},{2271,12},{2272,7},{2273,8},{2274,7},{2275,7},{2276,12},{2277,9},{2278,4},{2279,11},{2280,7},{2281,9},{2282,7},{2283,8},{2284,8},{2285,4},{2286,8},{2287,9},{2288,8},{2289,5},{2290,10},{2291,10},{2292,7},{2293,13},{2294,5},{2295,12},{2296,7},{2297,9},{2298,5},{2299,8},{2300,6},{2301,6},{2302,13},{2303,8},{2304,10},{2305,8},{2306,10},{2307,9},{2308,11},{2309,7},{2310,3},{2311,7},{2312,11},{2313,9},{2314,5},{2315,10},{2316,3},{2317,16},{2318,6},{2319,8},{2320,10},{2321,6},{2322,9},{2323,6},{2324,5},{2325,5},{2326,6},{2327,3},{2328,8},{2329,5},{2330,4},{2331,7},{2332,11},{2333,5},{2334,9},{2335,5},{2336,8},{2337,5},{2338,7},{2339,10},{2340,4},{2341,6},{2342,5},{2343,12},{2344,8},{2345,6},{2346,9},{2347,8},{2348,9},{2349,6},{2350,7},{2351,6},{2352,8},{2353,5},{2354,12},{2355,7},{2356,11},{2357,7},{2358,7},{2359,8},{2360,7},{2361,8},{2362,9},{2363,6},{2364,8},{2365,6},{2366,10},{2367,6},{2368,7},{2369,7},{2370,6},{2371,8},{2372,7},{2373,4},{2374,5},{2375,6},{2376,10},{2377,7},{2378,12},{2379,12},{2380,11},{2381,3},{2382,5},{2383,8},{2384,13},{2385,8},{2386,8},{2387,8},{2388,8},{2389,2},{2390,6},{2391,5},{2392,13},{2393,7},{2394,10},{2395,11},{2396,4},{2397,4},{2398,9},{2399,8},{2400,11},{2401,10},{2402,12},{2403,11},{2404,8},{2405,14},{2406,9},{2407,4},{2408,16},{2409,5},{2410,7},{2411,9},{2412,9},{2413,15},{2414,11},{2415,8},{2416,8},{2417,8},{2418,6},{2419,5},{2420,11},{2421,6},{2422,4},{2423,3},{2424,1},{2425,9},{2426,8},{2427,5},{2428,5},{2429,7},{2430,13},{2431,6},{2432,14},{2433,6},{2434,5},{2435,7},{2436,6},{2437,4},{2438,8},{2439,9},{2440,8},{2441,12},{2442,6},{2443,3},{2444,6},{2445,6},{2446,7},{2447,6},{2448,10},{2449,14},{2450,8},{2451,7},{2452,11},{2453,9},{2454,5},{2455,11},{2456,5},{2457,12},{2458,13},{2459,8},{2460,2},{2461,9},{2462,7},{2463,7}}

Note that I purposefully cut off data so that I wouldn't exceed the character limit for posts with

ListPeak1 = CalibCounts2Pairs[[300;;500]];
ListPeak2 = CalibCounts2Pairs[[900;;1200]];

There's two main problems I'd like to solve:

  1. Combining the three fits to one so that the Lorentz fits themselves take the underground into account
  2. As can be seen in the figure above, the two Lorentz fits don't quite reach the upper most data points

My approach is to just define a new fit function:

 AltPeakFit[c_]=UndergroundFit[c] - 
  LorentzFitIronPeak1[c] + LorentzFitPeak2[c] + 420

Adding 420 is neccessary to shift the new function up (looking at the single functions, I don't understand why this is neccesary, but adding 420 helps the result look almost as desired).

The new figure with all the fit functions looks like this:

As one can see, the second peak is quite well traced by the new fit function AltPeakFit[c_]. I don't understand why the proposed procedure doesn't work for peak1 as well and how I can fix it.

Any help would be greatly appreciated.

$\endgroup$
3
  • $\begingroup$ Hi, I wouldn't worry about the fits not reaching the uppermost points, that is to be expected from a fit. $\endgroup$
    – banone
    Commented Jul 25, 2023 at 13:48
  • $\begingroup$ CalibCounts2Pairs is not defined. UndergroundFit has non-executable defintion. $\endgroup$ Commented Jul 25, 2023 at 14:16
  • $\begingroup$ @banone Unfortunately my lab supervisor doesn't see it that way :') $\endgroup$ Commented Jul 25, 2023 at 14:17

1 Answer 1

10
$\begingroup$

You can combine all three functions into one, and perform one fit. To obtain meaningful results, you have to provide good initial values for the parameters.

peak1 = 2 A1/(4*(c - p1)^2 + FWHM1^2);
peak2 = 2 A2/(4*(c - p2)^2 + FWHM2^2);
background = 37 Exp[(Log[10/35]/2000) c];
fit = NonlinearModelFit[CalibCountsPairs, 
  peak1 + peak2 + background, {{p1, 300}, {p2, 1000}, {FWHM1, 80}, {FWHM2, 80}, 
   {A1, 100}, {A2, 10}}, c]

Show[Plot[fit[c], {c, 0, 2500}, PlotRange -> All], ListPlot[CalibCountsPairs]]

enter image description here

Note that I fixed the parameters for the background (but you could let them be fitted). Also, it is important that you know what you are actually trying to achieve with such fits and are aware of potential (statistical) pitfalls.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.