process_using.m

From Spinach Documentation Wiki
Revision as of 10:33, 20 September 2020 by Kuprov (talk | contribs) (→‎Notes)
Jump to: navigation, search

Applies the specified trained neural network file to the supplied DEER trace.

Syntax

    answers=process_using(deer_traces,net_file_name)

Arguments

  deer_traces  -  DEER trace(s) as a column vector or a 
                  matrix with multiple columns. The num-
                  ber of rows must match the input size 
                  of the neural network.

  net_file_name - the name of the checkpoint file produ-
                  ced by the train() function of Matlab
                  Neural Network Toolbox, including the
                  full path and the .mat extension.

Outputs

  answers       - neural network output(s) as a column 
                  vector or a matrix with multiple col-
                  umns. The number of rows mathes the 
                  output size of the neural network.

Examples

In the example below, a batch of 100 distribution and DEER trace pairs are generated and processed using the generic distance distribution extraction netset:

       % Load the parameters
       run('net_set_any_peaks/netset_params.m'); 

       % Specify number of traces to produce
       parameters.ntraces=100;
 
       % Generate test batch
       [time_grid,dist_grid,dist_distr_lib,~,~,deer_trace_lib,~,~,parameters]=deer_lib_gen([],parameters);

       % Run the analysis on the example set
       answers=process_using(deer_trace_lib,'net_set_any_peaks/1.mat');

Neural network answers can be plotted against the known right answers:

       % Plot an example
       example=randi(100); figure; 
       subplot(1,2,1); plot(time_grid,deer_trace_lib(:,example)); 
       grid on; title('Input DEER trace');
       xlabel('time, s','interpreter','LaTex');
       subplot(1,2,2); plot(dist_grid,[answers(:,example) dist_distr_lib(:,example)]); 
       grid on; title('Output distribution');
       xlabel('distance, $\rm{\AA}$','interpreter','LaTex');
       legend('Network answer','True answer');

The resulting figure is shown below.

Process using.png

Notes

CUDA capable GPU is not required by this function, it is generally fast enough even on minimal hardware.

See also

deernet.m, netset_curate.m


Version 2.2, authors: Ilya Kuprov, Steve Worswick