# FWHM of set of data without fitting

I need to find the full width half maximum of a set of data and I'm trying to write a function for doing that.

I'd like to do that without a proper fit of the data mainly for two reason: - I need to use it for many different shapes and I'd prefer not to change the fitting function every time - some of the data don't follow exactly any simple function. In any case, the data are quite dense so it shouldn't be a problem.

This is the solution that I found, but I'm not happy with that:

FWHMlist[list_, estimationLeft_: 1549, estimationRight_: 1551] := (
interpList = Interpolation[list, InterpolationOrder -> 1];
left = FindMinimum[Abs[interpList[x] - 0.5], {x, estimationLeft}][[
2, 1, 2]];
right = FindMinimum[Abs[interpList[x] - 0.5], {x, estimationRight}][[2, 1,
2]];
{(right + left)/2, Abs[right - left]}
)

The problem is that for making it work nicely you need to put by hand the values of "estimationLeft" and "estimationRight" within a quite high accuracy (that can be down to 5% of the FWHM itself). Moreover, I always get this error message (twice, one for each FindMinimum), even if it finds the correct solution:

FindMinimum::lstol: The line search decreased the step size to within the tolerance specified by AccuracyGoal and PrecisionGoal but was unable to find a sufficient decrease in the function. You may need more than MachinePrecision digits of working precision to meet these tolerances.

Also, in some cases its behaviour is completely "random": sometimes it happens that I put estimationLeft=1549 and estimationRight=1551 and it finds the position of the data inverted (for example left=1551.3 and right=1549.2, while it should be the other way around) and that's why I added the Abs[] function in Abs[right - left].

I also tried with FindRoot and NSolve but none of them worked smoothly.

Here's one of the set of data I'm checking:

{{1520.22, 3.9143*10^-7}, {1520.29, 4.2235*10^-7}, {1520.35,
4.58852*10^-7}, {1520.41, 4.85261*10^-7}, {1520.47,
4.98993*10^-7}, {1520.54, 5.38451*10^-7}, {1520.6,
5.75251*10^-7}, {1520.66, 5.78558*10^-7}, {1520.72,
5.94969*10^-7}, {1520.79, 6.01124*10^-7}, {1520.85,
6.22937*10^-7}, {1520.91, 6.23425*10^-7}, {1520.97,
6.08534*10^-7}, {1521.03, 5.93284*10^-7}, {1521.1,
5.6918*10^-7}, {1521.16, 5.36251*10^-7}, {1521.22,
4.97934*10^-7}, {1521.28, 4.67186*10^-7}, {1521.35,
4.27334*10^-7}, {1521.41, 3.62609*10^-7}, {1521.47,
3.46459*10^-7}, {1521.53, 3.53876*10^-7}, {1521.59,
3.38124*10^-7}, {1521.66, 3.64584*10^-7}, {1521.72,
3.64745*10^-7}, {1521.78, 3.81447*10^-7}, {1521.84,
4.1051*10^-7}, {1521.91, 4.35542*10^-7}, {1521.97,
4.65507*10^-7}, {1522.03, 4.90923*10^-7}, {1522.09,
5.21076*10^-7}, {1522.15, 5.32535*10^-7}, {1522.22,
5.61712*10^-7}, {1522.28, 5.73446*10^-7}, {1522.34,
6.05857*10^-7}, {1522.4, 5.93109*10^-7}, {1522.47,
6.24156*10^-7}, {1522.53, 6.08723*10^-7}, {1522.59,
5.89722*10^-7}, {1522.65, 5.98539*10^-7}, {1522.71,
5.87068*10^-7}, {1522.78, 5.15607*10^-7}, {1522.84,
5.22349*10^-7}, {1522.9, 4.73289*10^-7}, {1522.96,
4.31955*10^-7}, {1523.03, 3.95917*10^-7}, {1523.09,
3.72316*10^-7}, {1523.15, 3.43806*10^-7}, {1523.21,
3.36248*10^-7}, {1523.27, 3.50636*10^-7}, {1523.34,
3.67204*10^-7}, {1523.4, 3.55345*10^-7}, {1523.46,
3.83565*10^-7}, {1523.52, 4.24807*10^-7}, {1523.59,
4.26466*10^-7}, {1523.65, 4.46987*10^-7}, {1523.71,
4.95276*10^-7}, {1523.77, 5.02934*10^-7}, {1523.83,
5.31009*10^-7}, {1523.9, 5.74494*10^-7}, {1523.96,
5.75629*10^-7}, {1524.02, 5.66701*10^-7}, {1524.08,
6.05141*10^-7}, {1524.15, 6.12398*10^-7}, {1524.21,
5.91093*10^-7}, {1524.27, 5.9609*10^-7}, {1524.33,
6.12125*10^-7}, {1524.39, 5.52301*10^-7}, {1524.46,
5.31125*10^-7}, {1524.52, 5.39433*10^-7}, {1524.58,
4.847*10^-7}, {1524.64, 4.42748*10^-7}, {1524.71,
4.20911*10^-7}, {1524.77, 3.68586*10^-7}, {1524.83,
3.35457*10^-7}, {1524.89, 3.77376*10^-7}, {1524.95,
3.55983*10^-7}, {1525.02, 3.44279*10^-7}, {1525.08,
3.8394*10^-7}, {1525.14, 4.00067*10^-7}, {1525.2,
3.99889*10^-7}, {1525.27, 4.48809*10^-7}, {1525.33,
4.9117*10^-7}, {1525.39, 4.76197*10^-7}, {1525.45,
5.16265*10^-7}, {1525.51, 5.50181*10^-7}, {1525.58,
5.51648*10^-7}, {1525.64, 5.80574*10^-7}, {1525.7,
6.00684*10^-7}, {1525.76, 5.83252*10^-7}, {1525.83,
6.07597*10^-7}, {1525.89, 6.05896*10^-7}, {1525.95,
5.63925*10^-7}, {1526.01, 5.60134*10^-7}, {1526.07,
5.54021*10^-7}, {1526.14, 4.83576*10^-7}, {1526.2,
4.60495*10^-7}, {1526.26, 4.41709*10^-7}, {1526.32,
3.72963*10^-7}, {1526.39, 3.55997*10^-7}, {1526.45,
3.62267*10^-7}, {1526.51, 3.38248*10^-7}, {1526.57,
3.50673*10^-7}, {1526.64, 3.8074*10^-7}, {1526.7,
3.83932*10^-7}, {1526.76, 3.86929*10^-7}, {1526.82,
4.26975*10^-7}, {1526.88, 4.51675*10^-7}, {1526.95,
4.71222*10^-7}, {1527.01, 4.92058*10^-7}, {1527.07,
5.30869*10^-7}, {1527.13, 5.2632*10^-7}, {1527.2,
5.63481*10^-7}, {1527.26, 5.89408*10^-7}, {1527.32,
5.74759*10^-7}, {1527.38, 5.82722*10^-7}, {1527.44,
6.12278*10^-7}, {1527.51, 5.97496*10^-7}, {1527.57,
5.80282*10^-7}, {1527.63, 5.90183*10^-7}, {1527.69,
5.67122*10^-7}, {1527.76, 5.32595*10^-7}, {1527.82,
5.15495*10^-7}, {1527.88, 4.81057*10^-7}, {1527.94,
4.40682*10^-7}, {1528., 4.09105*10^-7}, {1528.07,
3.77077*10^-7}, {1528.13, 3.39069*10^-7}, {1528.19,
3.62227*10^-7}, {1528.25, 3.87959*10^-7}, {1528.32,
3.62078*10^-7}, {1528.38, 3.67303*10^-7}, {1528.44,
4.23054*10^-7}, {1528.5, 4.16867*10^-7}, {1528.56,
4.23342*10^-7}, {1528.63, 4.78273*10^-7}, {1528.69,
5.05433*10^-7}, {1528.75, 5.12387*10^-7}, {1528.81,
5.43615*10^-7}, {1528.88, 5.61102*10^-7}, {1528.94,
5.68615*10^-7}, {1529., 5.91733*10^-7}, {1529.06,
6.19253*10^-7}, {1529.12, 5.88423*10^-7}, {1529.19,
5.99432*10^-7}, {1529.25, 6.06569*10^-7}, {1529.31,
5.67947*10^-7}, {1529.37, 5.47341*10^-7}, {1529.44,
5.25961*10^-7}, {1529.5, 5.06112*10^-7}, {1529.56,
4.47976*10^-7}, {1529.62, 4.25818*10^-7}, {1529.68,
3.84007*10^-7}, {1529.75, 3.52092*10^-7}, {1529.81,
3.73698*10^-7}, {1529.87, 3.52514*10^-7}, {1529.93,
3.77081*10^-7}, {1530., 4.00759*10^-7}, {1530.06,
4.00582*10^-7}, {1530.12, 4.21798*10^-7}, {1530.18,
4.6793*10^-7}, {1530.24, 4.77754*10^-7}, {1530.31,
4.99111*10^-7}, {1530.37, 5.36287*10^-7}, {1530.43,
5.44647*10^-7}, {1530.49, 5.64794*10^-7}, {1530.56,
5.84462*10^-7}, {1530.62, 5.93932*10^-7}, {1530.68,
5.88048*10^-7}, {1530.74, 6.12409*10^-7}, {1530.8,
5.84544*10^-7}, {1530.87, 5.75051*10^-7}, {1530.93,
5.70453*10^-7}, {1530.99, 5.3823*10^-7}, {1531.05,
5.09009*10^-7}, {1531.12, 4.78552*10^-7}, {1531.18,
4.57544*10^-7}, {1531.24, 4.14104*10^-7}, {1531.3,
3.7082*10^-7}, {1531.36, 3.75874*10^-7}, {1531.43,
3.72792*10^-7}, {1531.49, 3.6298*10^-7}, {1531.55,
3.84319*10^-7}, {1531.61, 3.99501*10^-7}, {1531.68,
3.8672*10^-7}, {1531.74, 4.34744*10^-7}, {1531.8,
4.49666*10^-7}, {1531.86, 4.68999*10^-7}, {1531.92,
5.17347*10^-7}, {1531.99, 5.18348*10^-7}, {1532.05,
5.39*10^-7}, {1532.11, 5.66601*10^-7}, {1532.17,
5.77421*10^-7}, {1532.24, 5.95685*10^-7}, {1532.3,
6.14646*10^-7}, {1532.36, 6.13813*10^-7}, {1532.42,
6.12788*10^-7}, {1532.49, 6.12889*10^-7}, {1532.55,
6.06748*10^-7}, {1532.61, 5.84911*10^-7}, {1532.67,
5.51608*10^-7}, {1532.73, 5.37742*10^-7}, {1532.8,
5.04793*10^-7}, {1532.86, 4.56924*10^-7}, {1532.92,
4.37371*10^-7}, {1532.98, 3.93941*10^-7}, {1533.05,
3.7887*10^-7}, {1533.11, 3.98661*10^-7}, {1533.17,
3.97374*10^-7}, {1533.23, 3.93975*10^-7}, {1533.29,
4.26558*10^-7}, {1533.36, 4.49377*10^-7}, {1533.42,
4.47819*10^-7}, {1533.48, 4.86029*10^-7}, {1533.54,
5.13083*10^-7}, {1533.61, 5.37319*10^-7}, {1533.67,
5.60277*10^-7}, {1533.73, 5.96615*10^-7}, {1533.79,
5.97419*10^-7}, {1533.85, 6.18556*10^-7}, {1533.92,
6.46869*10^-7}, {1533.98, 6.2984*10^-7}, {1534.04,
6.50267*10^-7}, {1534.1, 6.44509*10^-7}, {1534.17,
6.25337*10^-7}, {1534.23, 5.90752*10^-7}, {1534.29,
5.90374*10^-7}, {1534.35, 5.6594*10^-7}, {1534.41,
5.35443*10^-7}, {1534.48, 4.94193*10^-7}, {1534.54,
4.49487*10^-7}, {1534.6, 4.17449*10^-7}, {1534.66,
4.40452*10^-7}, {1534.73, 4.29065*10^-7}, {1534.79,
4.34901*10^-7}, {1534.85, 4.60163*10^-7}, {1534.91,
4.66811*10^-7}, {1534.97, 4.87345*10^-7}, {1535.04,
5.1991*10^-7}, {1535.1, 5.40121*10^-7}, {1535.16,
5.79275*10^-7}, {1535.22, 5.92716*10^-7}, {1535.29,
6.31406*10^-7}, {1535.35, 6.53088*10^-7}, {1535.41,
6.57596*10^-7}, {1535.47, 6.83577*10^-7}, {1535.53,
7.07946*10^-7}, {1535.6, 6.59731*10^-7}, {1535.66,
7.03363*10^-7}, {1535.72, 7.06889*10^-7}, {1535.78,
6.66386*10^-7}, {1535.85, 6.48645*10^-7}, {1535.91,
6.45084*10^-7}, {1535.97, 6.05684*10^-7}, {1536.03,
5.56335*10^-7}, {1536.09, 5.38173*10^-7}, {1536.16,
5.02977*10^-7}, {1536.22, 4.5372*10^-7}, {1536.28,
4.43375*10^-7}, {1536.34, 4.47265*10^-7}, {1536.41,
4.52041*10^-7}, {1536.47, 4.6251*10^-7}, {1536.53,
4.71308*10^-7}, {1536.59, 4.79651*10^-7}, {1536.65,
4.91726*10^-7}, {1536.72, 5.4149*10^-7}, {1536.78,
5.28421*10^-7}, {1536.84, 5.38826*10^-7}, {1536.9,
5.7066*10^-7}, {1536.97, 5.94345*10^-7}, {1537.03,
5.88357*10^-7}, {1537.09, 6.01417*10^-7}, {1537.15,
6.16327*10^-7}, {1537.21, 6.15539*10^-7}, {1537.28,
6.17448*10^-7}, {1537.34, 6.2594*10^-7}, {1537.4,
5.88535*10^-7}, {1537.46, 5.97005*10^-7}, {1537.53,
5.79931*10^-7}, {1537.59, 5.39427*10^-7}, {1537.65,
5.19*10^-7}, {1537.71, 5.1033*10^-7}, {1537.77,
4.59437*10^-7}, {1537.84, 4.14154*10^-7}, {1537.9,
4.0774*10^-7}, {1537.96, 4.1406*10^-7}, {1538.02,
3.93311*10^-7}, {1538.09, 4.22095*10^-7}, {1538.15,
4.28481*10^-7}, {1538.21, 4.2989*10^-7}, {1538.27,
4.67088*10^-7}, {1538.34, 4.9423*10^-7}, {1538.4,
4.96262*10^-7}, {1538.46, 5.49255*10^-7}, {1538.52,
5.56046*10^-7}, {1538.58, 5.76649*10^-7}, {1538.65,
6.0559*10^-7}, {1538.71, 6.15742*10^-7}, {1538.77,
6.16315*10^-7}, {1538.83, 6.51037*10^-7}, {1538.9,
6.36387*10^-7}, {1538.96, 6.1571*10^-7}, {1539.02,
6.29042*10^-7}, {1539.08, 5.99115*10^-7}, {1539.14,
5.64686*10^-7}, {1539.21, 5.61112*10^-7}, {1539.27,
5.18741*10^-7}, {1539.33, 4.82224*10^-7}, {1539.39,
4.56016*10^-7}, {1539.46, 4.23174*10^-7}, {1539.52,
4.34349*10^-7}, {1539.58, 4.40693*10^-7}, {1539.64,
4.29027*10^-7}, {1539.7, 4.1932*10^-7}, {1539.77,
4.69089*10^-7}, {1539.83, 4.78978*10^-7}, {1539.89,
4.87221*10^-7}, {1539.95, 5.15037*10^-7}, {1540.02,
5.52767*10^-7}, {1540.08, 5.54825*10^-7}, {1540.14,
5.89984*10^-7}, {1540.2, 6.12943*10^-7}, {1540.26,
6.12661*10^-7}, {1540.33, 6.38029*10^-7}, {1540.39,
6.47726*10^-7}, {1540.45, 6.39801*10^-7}, {1540.51,
6.50199*10^-7}, {1540.58, 6.53268*10^-7}, {1540.64,
6.48409*10^-7}, {1540.7, 5.95793*10^-7}, {1540.76,
6.0956*10^-7}, {1540.82, 5.8823*10^-7}, {1540.89,
5.48017*10^-7}, {1540.95, 5.22436*10^-7}, {1541.01,
5.07947*10^-7}, {1541.07, 4.5276*10^-7}, {1541.14,
4.42881*10^-7}, {1541.2, 4.5963*10^-7}, {1541.26,
4.47021*10^-7}, {1541.32, 4.46818*10^-7}, {1541.38,
4.84781*10^-7}, {1541.45, 4.88015*10^-7}, {1541.51,
4.9329*10^-7}, {1541.57, 5.41672*10^-7}, {1541.63,
5.55122*10^-7}, {1541.7, 5.57954*10^-7}, {1541.76,
6.04663*10^-7}, {1541.82, 6.22467*10^-7}, {1541.88,
6.24182*10^-7}, {1541.94, 6.53323*10^-7}, {1542.01,
6.66268*10^-7}, {1542.07, 6.61379*10^-7}, {1542.13,
6.88575*10^-7}, {1542.19, 6.97675*10^-7}, {1542.26,
6.58159*10^-7}, {1542.32, 6.66856*10^-7}, {1542.38,
6.51562*10^-7}, {1542.44, 6.23926*10^-7}, {1542.5,
5.92763*10^-7}, {1542.57, 5.81644*10^-7}, {1542.63,
5.19917*10^-7}, {1542.69, 5.10136*10^-7}, {1542.75,
5.10665*10^-7}, {1542.82, 4.92407*10^-7}, {1542.88,
5.20025*10^-7}, {1542.94, 5.36503*10^-7}, {1543.,
5.39691*10^-7}, {1543.06, 5.66984*10^-7}, {1543.13,
5.98417*10^-7}, {1543.19, 6.06754*10^-7}, {1543.25,
6.59347*10^-7}, {1543.31, 6.83011*10^-7}, {1543.38,
7.08242*10^-7}, {1543.44, 7.58154*10^-7}, {1543.5,
7.65186*10^-7}, {1543.56, 7.78644*10^-7}, {1543.62,
8.18964*10^-7}, {1543.69, 8.38611*10^-7}, {1543.75,
8.32989*10^-7}, {1543.81, 8.64342*10^-7}, {1543.87,
8.56904*10^-7}, {1543.94, 8.57994*10^-7}, {1544.,
8.63213*10^-7}, {1544.06, 8.72321*10^-7}, {1544.12,
8.46976*10^-7}, {1544.19, 8.55505*10^-7}, {1544.25,
8.47766*10^-7}, {1544.31, 8.37952*10^-7}, {1544.37,
8.70779*10^-7}, {1544.43, 9.20593*10^-7}, {1544.5,
9.31007*10^-7}, {1544.56, 9.74478*10^-7}, {1544.62,
1.03626*10^-6}, {1544.68, 1.0913*10^-6}, {1544.75,
1.14937*10^-6}, {1544.81, 1.23678*10^-6}, {1544.87,
1.31748*10^-6}, {1544.93, 1.37517*10^-6}, {1544.99,
1.47804*10^-6}, {1545.06, 1.55892*10^-6}, {1545.12,
1.63864*10^-6}, {1545.18, 1.76142*10^-6}, {1545.24,
1.85862*10^-6}, {1545.31, 1.96211*10^-6}, {1545.37,
2.09183*10^-6}, {1545.43, 2.22839*10^-6}, {1545.49,
2.34583*10^-6}, {1545.55, 2.51958*10^-6}, {1545.62,
2.67073*10^-6}, {1545.68, 2.82933*10^-6}, {1545.74,
3.00481*10^-6}, {1545.8, 3.22934*10^-6}, {1545.87,
3.43025*10^-6}, {1545.93, 3.65887*10^-6}, {1545.99,
3.95407*10^-6}, {1546.05, 4.26389*10^-6}, {1546.11,
4.60625*10^-6}, {1546.18, 4.99243*10^-6}, {1546.24,
5.37961*10^-6}, {1546.3, 5.8201*10^-6}, {1546.36,
6.34826*10^-6}, {1546.43, 6.91374*10^-6}, {1546.49,
7.48294*10^-6}, {1546.55, 8.16146*10^-6}, {1546.61,
8.93082*10^-6}, {1546.67, 9.74638*10^-6}, {1546.74,
0.0000106574}, {1546.8, 0.0000116214}, {1546.86,
0.000012724}, {1546.92, 0.0000140392}, {1546.99,
0.0000154451}, {1547.05, 0.0000169463}, {1547.11,
0.0000188481}, {1547.17, 0.0000210989}, {1547.23,
0.0000237694}, {1547.3, 0.0000265585}, {1547.36,
0.0000299197}, {1547.42, 0.0000340624}, {1547.48,
0.0000389017}, {1547.55, 0.00004424}, {1547.61,
0.00005172}, {1547.67, 0.0000616668}, {1547.73,
0.0000721524}, {1547.79, 0.0000868403}, {1547.86,
0.000104143}, {1547.92, 0.000130255}, {1547.98,
0.000161535}, {1548.04, 0.000199802}, {1548.11,
0.000252911}, {1548.17, 0.000327089}, {1548.23,
0.000427545}, {1548.29, 0.000557827}, {1548.35,
0.000746401}, {1548.42, 0.001029}, {1548.48, 0.00143916}, {1548.54,
0.00198357}, {1548.6, 0.00284646}, {1548.67, 0.0042478}, {1548.73,
0.00632993}, {1548.79, 0.00977115}, {1548.85, 0.0146819}, {1548.91,
0.0250958}, {1548.98, 0.0432263}, {1549.04, 0.0779823}, {1549.1,
0.138558}, {1549.16, 0.255334}, {1549.23, 0.466786}, {1549.29,
0.687991}, {1549.35, 0.84265}, {1549.41, 0.90325}, {1549.47,
0.907048}, {1549.54, 0.890872}, {1549.6, 0.881758}, {1549.66,
0.889737}, {1549.72, 0.907534}, {1549.79, 0.925909}, {1549.85,
0.941836}, {1549.91, 0.956288}, {1549.97, 0.962327}, {1550.04,
0.963002}, {1550.1, 0.964112}, {1550.16, 0.962716}, {1550.22,
0.957763}, {1550.28, 0.953931}, {1550.35, 0.947951}, {1550.41,
0.929057}, {1550.47, 0.894493}, {1550.53, 0.838966}, {1550.6,
0.742447}, {1550.66, 0.606328}, {1550.72, 0.448108}, {1550.78,
0.307077}, {1550.84, 0.193267}, {1550.91, 0.120175}, {1550.97,
0.072633}, {1551.03, 0.0428024}, {1551.09, 0.0262912}, {1551.16,
0.0167012}, {1551.22, 0.0110605}, {1551.28, 0.00736256}, {1551.34,
0.00485699}, {1551.4, 0.00330759}, {1551.47, 0.00232362}, {1551.53,
0.00164338}, {1551.59, 0.00116192}, {1551.65,
0.000815452}, {1551.72, 0.000612398}, {1551.78,
0.000458164}, {1551.84, 0.000352139}, {1551.9,
0.000263624}, {1551.96, 0.000205313}, {1552.03,
0.000159939}, {1552.09, 0.000127764}, {1552.15,
0.0000974857}, {1552.21, 0.0000773562}, {1552.28,
0.0000612388}, {1552.34, 0.000048225}, {1552.4,
0.0000390242}, {1552.46, 0.0000316792}, {1552.52,
0.0000262915}, {1552.59, 0.0000215882}, {1552.65,
0.0000177108}, {1552.71, 0.0000148016}, {1552.77,
0.0000125356}, {1552.84, 0.0000106181}, {1552.9,
8.86773*10^-6}, {1552.96, 7.51536*10^-6}, {1553.02,
6.48209*10^-6}, {1553.08, 5.59658*10^-6}, {1553.15,
4.79413*10^-6}, {1553.21, 4.1462*10^-6}, {1553.27,
3.68178*10^-6}, {1553.33, 3.25625*10^-6}, {1553.4,
2.85756*10^-6}, {1553.46, 2.49831*10^-6}, {1553.52,
2.23597*10^-6}, {1553.58, 2.01519*10^-6}, {1553.64,
1.76694*10^-6}, {1553.71, 1.55925*10^-6}, {1553.77,
1.41837*10^-6}, {1553.83, 1.26118*10^-6}, {1553.89,
1.14993*10^-6}, {1553.96, 1.02649*10^-6}, {1554.02,
9.36663*10^-7}, {1554.08, 8.94778*10^-7}, {1554.14,
8.47963*10^-7}, {1554.2, 7.74931*10^-7}, {1554.27,
7.55435*10^-7}, {1554.33, 7.47139*10^-7}, {1554.39,
7.06839*10^-7}, {1554.45, 7.06525*10^-7}, {1554.52,
7.03425*10^-7}, {1554.58, 6.87042*10^-7}, {1554.64,
6.80318*10^-7}, {1554.7, 6.91128*10^-7}, {1554.76,
6.67473*10^-7}, {1554.83, 6.61153*10^-7}, {1554.89,
6.75798*10^-7}, {1554.95, 6.35135*10^-7}, {1555.01,
6.30096*10^-7}, {1555.08, 6.46942*10^-7}, {1555.14,
5.84808*10^-7}, {1555.2, 5.55333*10^-7}, {1555.26,
5.61819*10^-7}, {1555.32, 5.04239*10^-7}, {1555.39,
4.70567*10^-7}, {1555.45, 4.46038*10^-7}, {1555.51,
4.00279*10^-7}, {1555.57, 4.06262*10^-7}, {1555.64,
4.07907*10^-7}, {1555.7, 3.93049*10^-7}, {1555.76,
4.05481*10^-7}, {1555.82, 4.21922*10^-7}, {1555.89,
4.28899*10^-7}, {1555.95, 4.51003*10^-7}, {1556.01,
4.71488*10^-7}, {1556.07, 4.83279*10^-7}, {1556.13,
5.10238*10^-7}, {1556.2, 5.23011*10^-7}, {1556.26,
5.27263*10^-7}, {1556.32, 5.45748*10^-7}, {1556.38,
5.62307*10^-7}, {1556.45, 5.47116*10^-7}, {1556.51,
5.60557*10^-7}, {1556.57, 5.60161*10^-7}, {1556.63,
5.32748*10^-7}, {1556.69, 5.23554*10^-7}, {1556.76,
5.03117*10^-7}, {1556.82, 4.57058*10^-7}, {1556.88,
4.5152*10^-7}, {1556.94, 4.36222*10^-7}, {1557.01,
3.71418*10^-7}, {1557.07, 3.59292*10^-7}, {1557.13,
3.8752*10^-7}, {1557.19, 3.5666*10^-7}, {1557.25,
3.606*10^-7}, {1557.32, 3.958*10^-7}, {1557.38,
3.73632*10^-7}, {1557.44, 4.03792*10^-7}, {1557.5,
4.19671*10^-7}, {1557.57, 4.37828*10^-7}, {1557.63,
4.51243*10^-7}, {1557.69, 4.84979*10^-7}, {1557.75,
4.9934*10^-7}, {1557.81, 4.95637*10^-7}, {1557.88,
5.2738*10^-7}, {1557.94, 5.23191*10^-7}, {1558.,
5.24962*10^-7}, {1558.06, 5.47583*10^-7}, {1558.13,
5.35919*10^-7}, {1558.19, 5.31112*10^-7}, {1558.25,
5.27976*10^-7}, {1558.31, 5.00444*10^-7}, {1558.37,
4.78359*10^-7}, {1558.44, 4.62942*10^-7}, {1558.5,
4.49116*10^-7}, {1558.56, 4.05695*10^-7}, {1558.62,
3.81348*10^-7}, {1558.69, 3.51126*10^-7}, {1558.75,
3.5479*10^-7}, {1558.81, 3.75509*10^-7}, {1558.87,
3.68913*10^-7}, {1558.93, 3.56691*10^-7}, {1559.,
3.88518*10^-7}, {1559.06, 4.10759*10^-7}, {1559.12,
4.15878*10^-7}, {1559.18, 4.31829*10^-7}, {1559.25,
4.66116*10^-7}, {1559.31, 4.66733*10^-7}, {1559.37,
4.85579*10^-7}, {1559.43, 5.14336*10^-7}, {1559.49,
5.06532*10^-7}, {1559.56, 5.29003*10^-7}, {1559.62,
5.38599*10^-7}, {1559.68, 5.34441*10^-7}, {1559.74,
5.257*10^-7}, {1559.81, 5.36547*10^-7}, {1559.87,
4.97451*10^-7}, {1559.93, 4.89881*10^-7}, {1559.99,
4.66134*10^-7}, {1560.05, 4.33465*10^-7}, {1560.12,
4.12023*10^-7}, {1560.18, 3.74186*10^-7}, {1560.24,
3.52459*10^-7}, {1560.3, 3.59962*10^-7}, {1560.37,
3.60265*10^-7}, {1560.43, 3.71048*10^-7}, {1560.49,
3.7938*10^-7}, {1560.55, 3.83652*10^-7}, {1560.61,
4.02434*10^-7}, {1560.68, 4.35622*10^-7}, {1560.74,
4.46141*10^-7}, {1560.8, 4.56876*10^-7}, {1560.86,
4.92889*10^-7}, {1560.93, 5.02818*10^-7}, {1560.99,
5.07472*10^-7}, {1561.05, 5.13407*10^-7}, {1561.11,
5.47223*10^-7}, {1561.17, 5.50261*10^-7}, {1561.24,
5.02213*10^-7}, {1561.3, 5.51866*10^-7}, {1561.36,
5.26751*10^-7}, {1561.42, 4.93767*10^-7}, {1561.49,
4.95485*10^-7}, {1561.55, 4.7109*10^-7}, {1561.61,
4.39825*10^-7}, {1561.67, 4.11854*10^-7}, {1561.74,
4.02752*10^-7}, {1561.8, 3.61215*10^-7}, {1561.86,
3.5813*10^-7}, {1561.92, 3.65193*10^-7}, {1561.98,
3.614*10^-7}, {1562.05, 3.66792*10^-7}, {1562.11,
3.86028*10^-7}, {1562.17, 3.83074*10^-7}, {1562.23,
4.05164*10^-7}, {1562.3, 4.41678*10^-7}, {1562.36,
4.45155*10^-7}, {1562.42, 4.65896*10^-7}, {1562.48,
4.91181*10^-7}, {1562.54, 5.03445*10^-7}, {1562.61,
5.07049*10^-7}, {1562.67, 5.22176*10^-7}, {1562.73,
5.21113*10^-7}, {1562.79, 5.30692*10^-7}, {1562.86,
5.39297*10^-7}, {1562.92, 5.17036*10^-7}, {1562.98,
5.12964*10^-7}, {1563.04, 5.09898*10^-7}, {1563.1,
4.796*10^-7}, {1563.17, 4.56359*10^-7}, {1563.23,
4.36042*10^-7}, {1563.29, 3.99088*10^-7}, {1563.35,
3.80347*10^-7}, {1563.42, 3.5745*10^-7}, {1563.48,
3.60986*10^-7}, {1563.54, 3.54648*10^-7}, {1563.6,
3.74047*10^-7}, {1563.66, 3.76036*10^-7}, {1563.73,
3.80292*10^-7}, {1563.79, 4.10273*10^-7}, {1563.85,
4.36294*10^-7}, {1563.91, 4.4712*10^-7}, {1563.98,
4.61345*10^-7}, {1564.04, 4.78653*10^-7}, {1564.1,
4.84456*10^-7}, {1564.16, 5.18302*10^-7}, {1564.22,
5.22164*10^-7}, {1564.29, 5.20212*10^-7}, {1564.35,
5.33134*10^-7}, {1564.41, 5.38858*10^-7}, {1564.47,
5.2709*10^-7}, {1564.54, 5.06943*10^-7}, {1564.6,
4.92774*10^-7}, {1564.66, 4.65084*10^-7}, {1564.72,
4.53548*10^-7}, {1564.78, 4.19295*10^-7}, {1564.85,
3.80935*10^-7}, {1564.91, 3.63628*10^-7}, {1564.97,
3.61478*10^-7}, {1565.03, 3.62205*10^-7}, {1565.1,
3.63325*10^-7}, {1565.16, 3.64196*10^-7}, {1565.22,
3.74477*10^-7}, {1565.28, 4.06607*10^-7}, {1565.34,
4.09479*10^-7}, {1565.41, 4.23897*10^-7}, {1565.47,
4.56301*10^-7}, {1565.53, 4.64998*10^-7}, {1565.59,
4.79293*10^-7}, {1565.66, 5.08619*10^-7}, {1565.72,
5.11555*10^-7}, {1565.78, 5.12805*10^-7}, {1565.84,
5.32302*10^-7}, {1565.9, 5.3777*10^-7}, {1565.97,
5.17709*10^-7}, {1566.03, 5.47141*10^-7}, {1566.09,
5.46472*10^-7}, {1566.15, 4.67247*10^-7}, {1566.22,
4.95026*10^-7}, {1566.28, 4.69605*10^-7}, {1566.34,
4.27756*10^-7}, {1566.4, 4.06615*10^-7}, {1566.46,
3.96654*10^-7}, {1566.53, 3.58181*10^-7}, {1566.59,
3.60586*10^-7}, {1566.65, 3.6554*10^-7}, {1566.71,
3.61202*10^-7}, {1566.78, 3.78514*10^-7}, {1566.84,
3.90038*10^-7}, {1566.9, 3.92534*10^-7}, {1566.96,
4.23232*10^-7}, {1567.02, 4.42563*10^-7}, {1567.09,
4.54717*10^-7}, {1567.15, 4.70641*10^-7}, {1567.21,
4.93834*10^-7}, {1567.27, 4.97927*10^-7}, {1567.34,
5.07608*10^-7}, {1567.4, 5.24829*10^-7}, {1567.46,
5.24447*10^-7}, {1567.52, 5.1717*10^-7}, {1567.59,
5.32684*10^-7}, {1567.65, 5.0938*10^-7}, {1567.71,
5.00024*10^-7}, {1567.77, 4.84666*10^-7}, {1567.83,
4.57878*10^-7}, {1567.9, 4.4829*10^-7}, {1567.96,
4.25056*10^-7}, {1568.02, 3.73932*10^-7}, {1568.08,
3.59996*10^-7}, {1568.15, 3.75591*10^-7}, {1568.21,
3.54681*10^-7}, {1568.27, 3.70144*10^-7}, {1568.33,
3.76103*10^-7}, {1568.39, 3.81188*10^-7}, {1568.46,
4.07376*10^-7}, {1568.52, 4.28222*10^-7}, {1568.58,
4.32461*10^-7}, {1568.64, 4.66806*10^-7}, {1568.71,
4.91233*10^-7}, {1568.77, 4.95157*10^-7}, {1568.83,
5.13491*10^-7}, {1568.89, 5.15105*10^-7}, {1568.95,
5.24405*10^-7}, {1569.02, 5.49872*10^-7}, {1569.08,
5.34437*10^-7}, {1569.14, 5.14718*10^-7}, {1569.2,
5.24206*10^-7}, {1569.27, 4.97602*10^-7}, {1569.33,
4.67481*10^-7}, {1569.39, 4.58655*10^-7}, {1569.45,
4.18571*10^-7}, {1569.51, 3.94378*10^-7}, {1569.58,
3.78642*10^-7}, {1569.64, 3.63205*10^-7}, {1569.7,
3.54906*10^-7}, {1569.76, 3.77561*10^-7}, {1569.83,
3.70489*10^-7}, {1569.89, 3.72111*10^-7}, {1569.95, 3.96338*10^-7}}

And this is the output I get:

where the red dots are the data points, the blue line is the interpolation function and the horizontal line is the FWHM (which apparently is correct, and in this case is equal to 1.46386 and centred in 1549.97.

How about clipping your function values to 0 or 1 based on their relationship to .5, and then extracting the first and last nonzero element? Here is a function that does this:

FWHM[data_] := Module[{clip, min, max, x, y},
clip=SparseArray[Clip[data[[All,2]],{.5,.5},{0,1}]]["ColumnIndices"];
If[Length[clip]<1,Return[\$Failed]];
{min,max}=clip[[{1,-1},1]];
min=y/.First@Solve[data[[min-1]]+x(data[[min]]-data[[min-1]])=={y,.5}, {x,y}];
max=y/.First@Solve[data[[max]]+x(data[[max+1]]-data[[max]])=={y,.5},{x,y}];
{min,max}
]

FWHM[data]

{1549.24, 1550.7}

• Thanks, that work just perfectly! The only change I would do is replacing Clip[data[[All,2]],{.5,.5},{0,1}] with Round[data[[All, 2]]] which is more compact and intuitive for me :D Commented Jul 19, 2017 at 20:08
• However, when working on a large list of numbers, Carl's use of Clip is faster than Round. Carl Woll is notorious for writing Mathematica code that efficiently performs data manipulation. Commented Jul 19, 2017 at 22:55
• Great, thank you very much for the explanation! That's why I ask here, I'm always keen to learn new things from who knows more than me (almost everyone then :D ) Commented Jul 20, 2017 at 7:48

Here's another possible way. Basically I find the maximum value, max and then find the Nearest points to max/2. An average of the points on each side (using FindClusters) should produce a quick approximation to the FWHM.

fwhm[data_, n_Integer] :=
Module[{max = MaximalBy[data, Last][[1, 2]]},
(Mean /@ FindClusters[data[[#, 1]] & /@
Nearest[data[[All, 2]] -> "Index", (1/2) max, 2 n], 2])
]

fwhm[data, 4]
(* {1549.23, 1550.72} *)
• Thank you for your answer! Commented Jul 19, 2017 at 20:10

A straight forward approach which is very close to your original code is to locate the positions where the value exceeds a threshold (say 0.1) and also locate the position where the value is maximum (i.e., center).

Solve the x value where the interpolated function equals 0.5 between the left threshold and center positions and the right threshold and center positions.

FWHMlist[list_] := Module[
{
interpList = Interpolation[list, InterpolationOrder -> 1],
posCenter,
posBorders,
posLeft,
posRight,
xLeft,
xCenter,
xRight,
left,
right
},

posCenter =
Position[data, With[{max = Max[data[[All, 2]]]}, {_, max}]][[1, 1]];
posBorders = Position[data, {_, y_} /; y > 0.31];
posLeft = (First@posBorders)[[1]];
posRight = (Last@posBorders)[[1]];
xLeft = list[[posLeft, 1]];
xCenter = list[[posCenter, 1]];
xRight = list[[posRight, 1]];

left = FindMinimum[{(interpList[x] - 0.5)^2, xLeft < x < xCenter},
x][[2, 1, 2]];

right = FindMinimum[{(interpList[x] - 0.5)^2, xCenter < x < xRight},
x][[2,1, 2]];

{left, right}
]