Deconvolution of signal which is broadened by laser spot size I have a signal that I measured by optical means using a focused laser. The laser scans over a microscopic feature (in step size of 0.33 micron) and I have plotted the result of the measurement as a function of distance (x scale is microns):

Signal image:



I am interested in the width of the feature I am measuring, however in this case the width seems on the same order (or even much smaller) than the laser spot size. This results in the signal being a Gaussian shape which could potentially just be the shape of the laser spot. But I cannot know that for sure, because I'm trying to measure the width of this feature. It is entirely plausible that the feature itself gives a Gaussian response, I expect it is not an extremely sharp edge. But I'm trying to determine how sharp the edge is exactly, and the laser spot size is now limiting.

Assuming the feature is extremely thin and sharp, then the measurement would indeed yield this Gaussian shape. However the feature is definitely not infinitely sharp and I believe I can measure more accurately what its shape is by using deconvolution. 

I have tried to measure the laser spot size (this would be the system response function, I guess?) by scanning over a feature that IS definitely 100% sharp. If everything was perfect the signal from that would be a step function, but of course due to the large laser spot size I actually get a sort of error function shape from which I believe I can determine the laser spot size:

Sharp edge signal image:



Unless I'm mistaken the parameter C in my fit gives me the 1/e^2 beam width (0.785 micron). I think I can use this to form the system response function, assuming that my laser beam is Gaussian (which is probably not true but that's the best I can do).

The original signal I measured should be a convolution of the actual feature and this Gaussian system response, so I should also be able to deconvolve the signal with this same Gaussian system response and therefore obtain a better measurement of the feature, right? 

How would I go about doing this? I have the original signal data (image 1, distance vs signal) and I can assume a Gaussian spot for my laser as the system response function with the known size obtained from the measurement of the perfectly sharp edge (image 2), as far as I understand (not much more than this...) this should be enough to do a deconvolution?
There was a similar question here a while back with a conceptually similar problem.
Link to the earlier question.

That one was about scanning a target with an electron beam.
The question there was how to determine the true shape of the beam if you use a known target.  You would seem to have a beam with a known shape.
You've got it a bit easier, since you are dealing with a single dimension rather than a 2D shape.

The easiest way to start would be to look at examples for the Matlab deconv method.

Basically, you need two vectors - one that represents the beam, and one that represents the object as scanned with the beam.  Feed them into the deconv method, and you get a vector that represents just the object.

One way to go at it would be to create a vector for an object of known size - say you have a sample of exactly 5 microns width.  You make a vector representing say 10 microns, and you put a 5 micron wide step in the middle of it.  Now you scan for real a 5 micron wide object, and deconvolve that vector with your generated 5 micron vector.  Now, you have the beam vector to use when measuring unknown objects.

If you don't have Matlab, you could use Gnu Octave which works almost just like Matlab - many Matlab examples Just Work in Octave.

Example Octave code:

calibration_target=[1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1];
simulated_beam=[1,1,2,2,2,1,1];
calibration_scan=conv(simulated_beam,calibration_target,"full");
[recovered_beam_shape,beam_remainder]=deconv(calibration_scan,calibration_target);

test_item=[0,0,0,1,1,0,0,0];
simulated_testscan=conv(simulated_beam,test_item,"full");
corrected_test_item_scan=deconv(simulated_testscan,recovered_beam_shape);

subplot(4,2,1);
plot(calibration_target);
title("calibration target");

subplot(4,2,2);
plot(calibration_scan);
title("simulated scan of target with simulated beam");

subplot(4,2,3);
plot(simulated_beam);
title("simulated beam");

subplot(4,2,4);
plot(recovered_beam_shape);
title("recovered beam shape");

subplot(4,2,5);
plot(simulated_testscan);
title("simulated testscan");

subplot(4,2,6);
plot(corrected_test_item_scan);
title("corrected test item scan");

subplot(4,2,7);
plot(test_item);
title(" test item true shape");


Result:





Added to answer questions from the comments.


Convolution and deconvolution work on uniformly spaced vectors.  All you need are the intensity values - drop your x coordinates.  If your data points aren't uniformly spaced, then you've got a problem.  If you interpolate your points to get uniform spacing, then you will probably introduce some fuzziness.  I don't know how much of a bad effect that would have on the deconvolution.  As for determining the vector to correct for the beam, I would scan a target with a known shape and sharp edges.  Then I would deconvolve the scanned data with an ideal image of the target - basically a vector as wide as the scanned object, with values of zero for the areas outside of the target, and values of 1 inside the target.  For example, a target 5 microns wide scanned with 1 micron stept would be [0,0,0,0,0,1,1,1,1,1,0,0,0,0,0]  Since you did a scan with a known object in order to generate your gaussian, I assume this is possible.
The "size" shouldn't matter - assuming you mean the amplitude or intensity.  I would scale the generated data to make 1 represent the scanned area at maximum intensity.  If you meant the number of elements, then that would matter.  You need to overscan by enough to be sure that your beam actually leaves the target to each side.  If you don't overscan enough, then you won't be able to get a true image of your target.