function [hFig, hAxes] = accordPlotMaker_Linz_Demo_1()
%
% The AcCoRD Simulator
% (Actor-based Communication via Reaction-Diffusion)
%
% Copyright 2016 Adam Noel. All rights reserved.
% 
% For license details, read LICENSE.txt in the root AcCoRD directory
% For user documentation, read README.txt in the root AcCoRD directory
%
% accordPlotMakerWrapper.m - Wrapper function for accordPlotMaker, which
%   can create a plot from AcCoRD simulation output.
%   This file prepares all of the input arguments needed for
%   accordPlotMaker.
%   RECOMMENDATION: TO USE THIS FUNCTION, YOU SHOULD MAKE A COPY AND MODIFY
%   THE COPY.
%
% INPUTS
% NONE - this file is intended to be a wrapper that is modified directly.
%   Descriptions of the input arguments for accordVideoMaker are described
%   as they are initialized below.
%
% OUTPUTS
% hFig - handle(s) to plotted figure(s). Use for making changes.
% hAxes - handle(s) to axes in plotted figure(s). Use for making changes.
%
% Last revised for AcCoRD v0.7.0.1 (public beta, 2016-08-30)
%
% Revision history:
%
% Revision v0.7.0.1 (public beta, 2016-08-30)
% - changed axes clipping to 'on'
% - Minor updates to comments
%
% Revision v0.7 (public beta, 2016-07-09)
% - Created file
%
% Created 2016-06-03

%% 

% hAxes - handle to plotting axes. If 0, a new figure will be created.
%   Otherwise, curve will be added to existing axes
hAxes = 0;

% fileToLoad - simulation file generated by accordImport from raw AcCoRD
%   simulation output. The '.mat' extension can be omitted. File should
%   have 'data' and 'config' structures.
fileToLoad = 'accord_linz_demo_1_absorbing_sphere_out';

% customFigProp - structure of figure properties to change from AcCoRD
%   defaults. Can be passed as empty if no defaults are to be changed. See
%   accordBuildFigureStruct for structure fields and their default values.
%   If plot will be a surface, and face colors are being set by the figure
%   colormap, then the Colormap can be set here.
customFigProp = [];

% customAxesProp - structure of axes properties to change from AcCoRD
%   defaults. Can be passed as empty if no defaults are to be changed. See
%   accordBuildAxesStruct for structure fields and their default values.
%   NOTE: It is highly recommended to change the default Visible and
%   Projection properties, since the default settings favor video
%   generation and not curve plotting
customAxesProp.Visible = 'on';
customAxesProp.Projection = 'orthographic';
customAxesProp.Clipping = 'on';

% passiveActorToPlot - index of passive recording actors whose
%   signals are to be plotted. Indexing matches the list of passive
%   actors whose observations are recorded (as stored in the data structure
%   in fileToLoad).
passiveID = 2;

% molID - index of molecules to display. Indexing corresponds to the
%   list of molecules that the actor is recording (as stored in the data
%   structure in fileToLoad).
molID = 1;

% customObsProp - structure of data display properties to change
%   from AcCoRD defaults. Can be passed as empty if no defaults are to be
%   changed. See accordBuildObserverStruct for structure fields and their
%   default values. Header of accordBuildObserverStruct includes full
%   details on how to specify each type of plot.
customObsProp = [];

% customCurveProp - structure of display properties to change
%   from AcCoRD defaults. Can be passed as empty if no defaults are to be
%   changed. The specific properties depend on the definition of
%   customObsProp.obsType, which is 'Sample' by default
%
% If the data to display is 2D, then see accordBuildCurveStruct for
%   structure fields and their default values.
% If the data to display is 3D, then see accordBuildSurfStruct for
%   structure fields and their default values. Applies to all types that
%   have "3D" in their name
customCurveProp.Color = 'b';
customCurveProp.LineStyle = 'none';
customCurveProp.Marker = 's';
customCurveProp.DisplayName = 'Molecules Absorbed by Receiver';

%% Call accordPlotMaker
[~, hAxes] = accordPlotMaker(hAxes, fileToLoad,...
    passiveID, molID, ...
    customObsProp, customCurveProp, ...
    customFigProp, customAxesProp);

%% Add analytical curve

customObsProp.obsType = 'Expected';
customObsProp.sampleInterval = 1;
customCurveProp.LineStyle = '-';
customCurveProp.Marker = 'none';

rRx = 4e-6;
d = 8e-6;
vol = 4/3*pi*rRx^3;        % Volume
D = 1e-10;          % Diffusion coefficient
N = 1e3;
k = 0;
r = rRx;
r0 = d;
data1 = 1e-3:1e-3:0.41; % Time vector
customObsProp.data1 = data1;

customCurveProp.DisplayName = 'Analytical';
customObsProp.data2 = N*r/r0*erfc((r0-r)./sqrt(4*D*data1));
[~, hAxes] = accordPlotMaker(hAxes, [], [], [], customObsProp, customCurveProp, [], []);