diff --git a/+nf/extract.m b/+nf/extract.m index c1b4062..8475d72 100644 --- a/+nf/extract.m +++ b/+nf/extract.m @@ -1,9 +1,9 @@ -%% Extract a specific subset of data from a neurofield output struct. +%% Extract a specific subset of data from a nftsim output struct. % % The subset can be specified in terms of: traces; times; and nodes. % % ARGUMENTS: -% obj -- A neurofield output struct (a Matlab struct containing data +% obj -- A nftsim output struct (a Matlab struct containing data % from a simulation). % traces -- A cell array or a comma separated string of the traces % you want to extract, e.g. 'Propagator.2.phi, Coupling.2.nu'. @@ -35,7 +35,7 @@ % If no nodes are provided, output all nodes if ~isstruct(obj) || ~isfield(obj, 'data') error(['nf:' mfilename ':BadArgument'], ... - 'The first argument must be a neurofield output struct.'); + 'The first argument must be a nftsim output struct.'); end if nargin < 4 || isempty(nodes) diff --git a/+nf/get_frequencies.m b/+nf/get_frequencies.m index 228a3d3..e2ef0c1 100644 --- a/+nf/get_frequencies.m +++ b/+nf/get_frequencies.m @@ -2,20 +2,20 @@ % Return corresponding grids of frequencies and positions % % ARGUMENTS: -% data -- . -% fs -- . -% Lx -- . -% Ly -- . +% data -- an 1D or 3D array of size space points along x, space points along y, tim points, +% fs -- sampling temporal frequency in [Hz] +% Lx -- physical size of the spatial domain along x in [m] +% Ly -- physical size of the spatial domain along y in [m] % % OUTPUT: -% f -- . -% Kx -- . -% Ky -- . -% x -- . -% y -- . -% df -- . -% dk -- . -% dx -- . +% f -- vector of (positives) frequencies in [Hz] +% Kx -- vector of angular wavenumbers in [rad/m] +% Ky -- vector of angular wavenumbers in [rad/m] +% x -- vector with spatial coordinates in [m] +% y -- vector with spatial coordinates in [m] +% df -- temporal frequency resolution in [Hz] +% dk -- radial spatial frequency resolution in [rad/m] +% dx -- spatial resolution in [m] % % REQUIRES: % -- @@ -38,16 +38,19 @@ x = []; y = []; + % This is the single positive sided frequency vector if isvector(data) - f = (0:(fs / length(data)):(fs / 2)).'; % This is the single sided frequency + f = (0:(fs / length(data)):(fs / 2)).'; return end - f = (0:(fs / size(data, 3)):(fs / 2)).'; % This is the single sided frequency + % This is the single positive sided frequency + f = (0:(fs / size(data, 3)):(fs / 2)).'; df = fs / size(data, 3); - - Kx = 2*pi*(0:1/Lx:size(data, 1)/Lx/2); % This is the single sided frequency - Ky = 2*pi*(0:1/Ly:size(data, 2)/Ly/2); % This is the single sided frequency + + % Wavenumbers / single sided and positive + Kx = 2*pi*(0:1/Lx:size(data, 1)/Lx/2); + Ky = 2*pi*(0:1/Ly:size(data, 2)/Ly/2); if mod(size(data, 1), 2) % If there is NO nyquist frequency component Kx = [-Kx(end:-1:2) Kx]; @@ -60,13 +63,24 @@ else Ky = [-Ky(end:-1:2) Ky(1:end-1)]; end + [Kx, Ky] = meshgrid(Kx, Ky); + + % Smallest wavenumber - resolution in k-space (angular spatial frequency) + % This is assuming the spatial domain is square (Lx=Ly) + dk = 2 * pi / Lx; + + % dx and dy should be the same + dx = Lx / size(data, 1); % [m] + dy = Ly / size(data, 1); % [m] + + % the stencil in NFTsim assumes the coordinates of a parcel of the discretized domain + % is at the centre of the parcel, thus the first coordinate is at (dx/2; dy/2) + + x = dx * (0:size(data, 1)) + dx/2; + y = dy * (0:size(data, 1)) + dx/2; - dx = Lx / size(data, 1); % Metres per pixel - x = dx * (0:size(data, 1)-1); - dy = Ly / size(data, 1); - y = dy * (0:size(data, 1)-1); [x, y] = meshgrid(x, y); end %function get_frequencies() diff --git a/+nf/grid.m b/+nf/grid.m index 7df682f..242d388 100644 --- a/+nf/grid.m +++ b/+nf/grid.m @@ -8,7 +8,7 @@ % output all nodes), or the number of nodes is not a perfect square.. % % ARGUMENTS: -% obj -- A neurofield output struct (a Matlab struct containing data +% obj -- A nftsim output struct (a Matlab struct containing data % from a simulation). % trace -- A string with the name of the array to reshape. % @@ -35,7 +35,7 @@ if output_nodes ~= obj.input_nodes error(['nf:' mfilename ':IncompatibleOutput'], ... - 'Output from NeuroField must be for all nodes') + 'Output from NFTsim must be for all nodes') end data = nf.extract(obj, trace); @@ -48,7 +48,7 @@ longside_nodes = obj.longside_nodes; shortside_nodes = obj.input_nodes / obj.longside_nodes; end - %Reshape to an array of (n,m,tpts) + %Reshape to an array of (nx,ny,tpts) %data = reshape(data, grid_edge, grid_edge, obj.npoints); diff --git a/+nf/plot_timeseries.m b/+nf/plot_timeseries.m index 436a88f..faf8e2f 100644 --- a/+nf/plot_timeseries.m +++ b/+nf/plot_timeseries.m @@ -17,7 +17,7 @@ % figure_handles -- cell array of figure handles. % % REQUIRES: -% nf.extract() -- Extract a specific subset of data from a neurofield +% nf.extract() -- Extract a specific subset of data from a nftsim % output struct. % % AUTHOR: @@ -28,7 +28,7 @@ %{ %Either run a simulation: nf_obj = nf.run('./configs/eirs-corticothalamic.conf') - %Or load some neurofield output data + %Or load some nftsim output data nf_obj = nf.read('./configs/eirs-corticothalamic.output') %Plot every fourth node for the trace 'Propagator.1.phi'. diff --git a/+nf/read.m b/+nf/read.m index ce4814f..f221e36 100644 --- a/+nf/read.m +++ b/+nf/read.m @@ -1,11 +1,11 @@ -%% Read a neurofield output file and return a neurofield output struct. +%% Read a nftsim output file and return a nftsim output struct. % % ARGUMENTS: -% fname -- The name of the neurofield output file to read (absolute +% fname -- The name of the nftsim output file to read (absolute % or relative path). % % OUTPUT: -% obj -- A neurofield output struct. A Matlab struct containing data +% obj -- A nftsim output struct. A Matlab struct containing data % and parameters from a simulation. % % AUTHOR: @@ -42,7 +42,7 @@ while isempty(strfind(buffer, '=======================')) - % TODO: consider cleaning up this part. + % TODO: CLEAN UP - this part refers to EEGCODE. if ~isempty(strfind(buffer, 'Time |')) error(['nf:' mfilename ':OldStyleOutput'], ... 'Did you try and open and old-style output file? Found a | that looked like a delimiter.') diff --git a/+nf/report.m b/+nf/report.m index 53772dd..816c7fd 100644 --- a/+nf/report.m +++ b/+nf/report.m @@ -1,7 +1,7 @@ -%% Given a neurofield output struct, print some information about it. +%% Given a nftsim output struct, print some information about it. % % ARGUMENTS: -% obj -- A neurofield output struct (a Matlab struct containing data +% obj -- A nftsim output struct (a Matlab struct containing data % from a simulation). % % OUTPUT: Prints to terminal. @@ -16,7 +16,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function report(obj) - fprintf(1, 'Output for: neurofield -i "%s"\n', obj.conf_file) + fprintf(1, 'Output for: nftsim -i "%s"\n', obj.conf_file) fprintf(1, 'Traces: '); for j = 1:length(obj.fields) fprintf(1, '%s ', obj.fields{j}); diff --git a/+nf/rfft.m b/+nf/rfft.m index 0888642..6e13bae 100644 --- a/+nf/rfft.m +++ b/+nf/rfft.m @@ -21,6 +21,7 @@ % http://www.brain-dynamics.net/~chris_rennie/fourier.pdf % % AUTHOR: +% Original: Chris Rennie circa 2000 % Romesh Abeysuriya (2012-03-22). % % USAGE: @@ -75,9 +76,10 @@ P(2:(end - 1), :) = P(2:(end - 1), :) .* 2.0; end + % TODO: check normalizations % P now contains properly normalized spectral power %f = fs / 2 * linspace(0, 1, NFFT / 2 + 1)'; - f = 0:(fs / NFFT):(fs / 2); % I think this is more correct + f = 0:(fs / NFFT):(fs / 2); % I think this is more correct P = mean(P, 2); P = P ./ f(2); % Divide by frequency bin size to get power density diff --git a/+nf/run.m b/+nf/run.m index 1d794d3..c598b7e 100644 --- a/+nf/run.m +++ b/+nf/run.m @@ -1,9 +1,9 @@ -%% Function to run neurofield and return a neurofield output struct. +%% Function to run nftsim and return a nftsim output struct. % -% Provided a configuration file-name (fname.conf), run the neurofield +% Provided a configuration file-name (fname.conf), run the nftsim % executable, generating an output file (fname.output). Optionally, if an % output argument is provided then, parse the output file and return a -% neurofield output struct containing the simulation results. +% nftsim output struct containing the simulation results. % % % ARGUMENTS: @@ -11,15 +11,15 @@ % the .conf extension. % time_stamp -- boolean flag to use a time_stamp YYYY-MM-DDTHHMMSS % in the output file name. -% neurofield_path -- neurofield executable (full or relative path). +% nftsim_path -- nftsim executable (full or relative path). % % OUTPUT: Writes a .output file in the same location as the .conf file. -% obj -- A neurofield output struct (a Matlab struct containing +% obj -- A nftsim output struct (a Matlab struct containing % data from a simulation). % % REQUIRES: -% neurofield -- The neurofield executable, must be in your path. -% nf.read -- Read a neurofield output file and return a neurofield +% nftsim -- The nftsim executable, must be in your path. +% nf.read -- Read a nftsim output file and return a nftsim % output struct. % % AUTHOR: @@ -27,12 +27,12 @@ % % USAGE: %{ - %At a matlab command promt, from neurofield's main directory: + %At a matlab command promt, from nftsim's main directory: nf_obj = nf.run('./configs/eirs-corticothalamic.conf') %} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -function obj = run(fname, time_stamp, neurofield_path) +function obj = run(fname, time_stamp, nftsim_path) % tic; fname = strrep(fname, '.conf', ''); %Strip any .conf suffix. @@ -41,39 +41,39 @@ if nargin < 2 time_stamp = false; end - % If we were not provided a path to neurofield, try to determine one. - if nargin < 3 || isempty(neurofield_path) + % If we were not provided a path to nftsim, try to determine one. + if nargin < 3 || isempty(nftsim_path) % Check typical locations, the first path that exists will be selected. - locations = {'neurofield', ... - './bin/neurofield', ... - './neurofield/bin/neurofield', ... - 'neurofield.exe'}; + locations = {'nftsim', ... + './bin/nftsim', ... + './nftsim/bin/nftsim', ... + 'nftsim.exe'}; selected_path = find(cellfun(@(name) exist(name, 'file')==2, locations), 1, 'first'); if ~isempty(selected_path) - neurofield_path = locations{selected_path}; + nftsim_path = locations{selected_path}; else error(['nf:' mfilename ':BadPath'], ... - 'neurofield not found. Either change into the neurofield base directory or make a symlink to neurofield in the current directory.'); + 'nftsim not found. Either change into the nftsim base directory or make a symlink to nftsim in the current directory.'); end % If we were provided a path, check that it is valid. - elseif ~exist(neurofield_path, 'file') + elseif ~exist(nftsim_path, 'file') error(['nf:' mfilename ':BadPath'], ... - 'The neurofield_path you provided is incorrect:"%s".',neurofield_path); + 'The nftsim_path you provided is incorrect:"%s".',nftsim_path); end if ~time_stamp - neurofield_cmd = sprintf('%s -i %s.conf -o %s.output', neurofield_path, fname, fname); + nftsim_cmd = sprintf('%s -i %s.conf -o %s.output', nftsim_path, fname, fname); else - neurofield_cmd = sprintf('%s -i %s.conf -t', neurofield_path, fname); + nftsim_cmd = sprintf('%s -i %s.conf -t', nftsim_path, fname); end fprintf('INFO: Executing command:\n') - fprintf('%s\n', neurofield_cmd); - [status, cmdout] = system(neurofield_cmd); + fprintf('%s\n', nftsim_cmd); + [status, cmdout] = system(nftsim_cmd); string(cmdout) if status ~= 0 - error(['nf:' mfilename ':NeurofieldError'], ... - 'An error occurred while running neurofield!'); + error(['nf:' mfilename ':NFTsimError'], ... + 'An error occurred while running nftsim!'); end fprintf(1, 'INFO: tic-toc: Took about %.3f seconds\n', toc); diff --git a/+nf/spatial_spectrum.m b/+nf/spatial_spectrum.m index ab93e83..92ee7d0 100644 --- a/+nf/spatial_spectrum.m +++ b/+nf/spatial_spectrum.m @@ -10,19 +10,19 @@ % spatial_filter -- set to 1 to enable the usual exponential k filter % % OUTPUT: -% f -- . -% P -- . -% Kx -- . -% Ky -- . -% Pkf -- . -% x -- . -% y -- . -% Prf -- . +% f -- vector of temporal frequencies in [Hz] +% P -- power spectral density in [au / Hz ???]???? +% Kx -- vector with angular wavenumbers in [rad/m] +% Ky -- vector with angular wavenumbers in [rad/m] +% Pkf -- power spectral density? array in [units?????] +% x -- array of spatial coordinates along x [m] +% y -- array of spatial coordinates along y [m] +% Prf --power spectral density ? in space frequency [units?????] % % REQUIRES: -% nf.get_frequencies() -- -% nf.grid() -- -% nf.partition() -- +% nf.get_frequencies() +% nf.grid() +% nf.partition() % % REFERENCES: % @@ -119,9 +119,9 @@ function [Pkf, Prf] = get_spectrum(data, k_mask, k_filter, Lx, fs) - df = fs / (size(data, 3)); - dk = 2 * pi / Lx; - dx = Lx / size(data, 1); % Metres per pixel + df = fs / (size(data, 3)); % [Hz] + dk = 2 * pi / Lx; % spatial frequency resolution in [rad/m] -- smallest nonzero wavenumber + dx = Lx / size(data, 1); % [m] % First, get the 3D FFT and apply volume conduction P = fftshift(fftn(data)); @@ -155,7 +155,7 @@ Prf(:, :, 2:(end - 1)) = Prf(:, :, 2:(end - 1)) * 2; end - % Divide by N, dx and dx so that integration gives the correct power + % Divide by N, dx and dx so that integration gives the correct power or PSD????? % Division by N on the grounds that energy in real space is given by summing abs(x)^2/N % So we could call the power P=abs(x)^2/N so that sum(P) gives the correct power % And then division by dx*dx means that integral(P) over position gives the right answer diff --git a/+nf/spectrum.m b/+nf/spectrum.m index ded0d64..949e7c9 100644 --- a/+nf/spectrum.m +++ b/+nf/spectrum.m @@ -1,7 +1,7 @@ -%% Return the frequency and frequency spectrum of given neurofield output. +%% Return the frequency and frequency spectrum of given nftsim output. % % ARGUMENTS: -% obj -- A neurofield output struct (a Matlab struct containing data +% obj -- A nftsim output struct (a Matlab struct containing data % from a simulation). % traces -- traces to use % n_windows -- number of windows (Default=8). @@ -12,7 +12,7 @@ % % REQUIRES: % nf.partition() -- Partition a list of n items into m groups. -% nf.extract() -- Extract a specific subset of data from a neurofield output struct. +% nf.extract() -- Extract a specific subset of data from a nftsim output struct. % nf.rfft() -- Fourier transform. % % REFERENCES: @@ -22,7 +22,7 @@ % % USAGE: %{ - %Load some neurofield output data. + %Load some nftsim output data. obj = nf.read('./configs/example.output') %Calculate the mean power spectrum. [f, P] = nf.spectrum(obj, 'Propagator.1.phi', [], true, true); @@ -36,7 +36,7 @@ function [f, P] = spectrum(obj, traces, n_windows, windowed, detrended) if ~isstruct(obj) error(['nf:' mfilename ':BadArgument'], ... - 'The first argument must be a neurofield simulation struct.') + 'The first argument must be a nftsim simulation struct.') end if nargin < 2 || isempty(traces) @@ -68,9 +68,9 @@ % Partition the extracted data into epochs of time. frac_overlap = 0.5; - evenlength = true; - same_size = true; - window_idx = nf.partition(size(data, 1), n_windows, [], frac_overlap, evenlength, same_size); + evenlength = true; + same_size = true; + window_idx = nf.partition(size(data, 1), n_windows, [], frac_overlap, evenlength, same_size); window_length = window_idx(1, 2) - window_idx(1, 1) + 1; % Calculate mean power spectrum for each epoch of time. diff --git a/.gitattributes b/.gitattributes index 23f9482..9db3506 100644 --- a/.gitattributes +++ b/.gitattributes @@ -15,7 +15,7 @@ Makefile text # The executable. -neurofield binary +nftsim binary #Configuration files *.conf text diff --git a/.gitignore b/.gitignore index 2192ddf..5a39f60 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ dep/ doc/html/ doc/latex/ -# Ignore NeuroField output files +# Ignore NFTsim output files *.output *.mat diff --git a/Doxyfile b/Doxyfile index 6ae5cae..78b252c 100644 --- a/Doxyfile +++ b/Doxyfile @@ -33,7 +33,7 @@ DOXYFILE_ENCODING = UTF-8 # title of most generated pages and in a few other places. # The default value is: My Project. -PROJECT_NAME = "Neurofield" +PROJECT_NAME = "NFTsim" # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version diff --git a/Makefile b/Makefile index 33ea3f4..b9dfbc1 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -#Makefile for neurofield +#Makefile for nftsim # # Type 'make help' for a list of possible targets with brief descriptions. # If you're having problems, the Makefile itself can be debugged using the @@ -14,7 +14,7 @@ DOCDIR := doc/ DEPDIR := dep/ #Default to *nix, suffix-less, binary. -BIN := neurofield +BIN := nftsim #User-manual files USER_MANUAL := NFTsimManual.pdf @@ -58,18 +58,18 @@ NO_DEPS += clean-user-manual clean-reference-manual clean-docs clean-deps clean- # Define our suffix list .SUFFIXES: .o .d .cpp .h .tex -.PHONY: neurofield debug all clang make_bin_dir make_obj_dir make_dep_dir help help-dev info docs user-manual reference-manual \ +.PHONY: nftsim debug all clang make_bin_dir make_obj_dir make_dep_dir help help-dev info docs user-manual reference-manual \ clean-user-manual clean-reference-manual clean-docs clean-deps clean-objs clean-bin clean clean-all -# target: neurofield - Compile neurofield placing the executable in the bin directory. -neurofield: $(BINDIR)$(BIN) +# target: nftsim - Compile nftsim placing the executable in the bin directory. +nftsim: $(BINDIR)$(BIN) -# target: debug - Compile neurofield with debugging enabled. +# target: debug - Compile nftsim with debugging enabled. debug: CXXFLAGS := $(DEBUG) -debug: neurofield +debug: nftsim -# target: all - Compile neurofield and build all documentation. -all: neurofield docs +# target: all - Compile nftsim and build all documentation. +all: nftsim docs # target: gcc - Build using gcc, unnecessary on Linux as gcc is default. ifeq ($(MAKECMDGOALS), gcc) @@ -80,7 +80,7 @@ ifeq ($(MAKECMDGOALS), gcc) CXXFLAGS := -std=c++11 -lm -Wall -Wextra -pedantic -msse -msse2 -msse3 -mfpmath=sse -march=native -mtune=native -funroll-loops -flto -O3 DEPFLAGS = -std=c++11 -MM -MP -MT $(OBJDIR)$*.o endif -gcc: neurofield +gcc: nftsim # target: clang - Build using clang++, unnecessary on MacOS unless you want extra warnings as clang++ is default. ifeq ($(MAKECMDGOALS), clang) @@ -91,7 +91,7 @@ ifeq ($(MAKECMDGOALS), clang) CXXFLAGS := -std=c++11 -Weverything -Wno-padded -Wno-c++98-compat -Wno-c++98-compat-pedantic -fdiagnostics-fixit-info -Wdocumentation -march=native -funroll-loops -flto -O3 DEPFLAGS = -std=c++11 -MM -MP -MT $(OBJDIR)$*.o endif -clang: neurofield +clang: nftsim # target: intel - Build using intel C++ compiler. ifeq ($(MAKECMDGOALS), intel) @@ -104,13 +104,13 @@ ifeq ($(MAKECMDGOALS), intel) CXXFLAGS := -std=c++11 -Wall -Wremarks -Wchecks -Weffec++ -xHost -funroll-loops -ipo -O3 DEPFLAGS = -std=c++11 -MM -MP -MT $(OBJDIR)$*.o endif -intel: neurofield +intel: nftsim # target: $(BINDIR)$(BIN) - Main target for the final build, linking objects into an executable. $(BINDIR)$(BIN): $(OBJ) | make_bin_dir $(CXX) $(CXXFLAGS) $(OBJ) -o $@ @$(CAT) conditions.txt - @echo "USE OF NEUROFIELD CONSTITUTES ACCEPTANCE OF THE APACHE 2.0 LICENSE" + @echo "USE OF NFTSIM CONSTITUTES ACCEPTANCE OF THE APACHE 2.0 LICENSE" # target: make_bin_dir - Create the directory $BINDIR if it doesn't already exist. make_bin_dir: diff --git a/benchmarks/nf_benchmarks b/benchmarks/nf_benchmarks index ec04ca3..09f4fac 100755 --- a/benchmarks/nf_benchmarks +++ b/benchmarks/nf_benchmarks @@ -1,7 +1,7 @@ #!/usr/bin/env bash # nf_benchmarks: -# A script for benchmarking neurofield and storing the results. +# A script for benchmarking nftsim and storing the results. # #USAGE: # #Show this header message: @@ -51,9 +51,9 @@ # + ./benchmarks/results/code_info.csv # + ./benchmarks/results/system_info.csv # The script expects/requires: -# + to be run from a clean clone of neurofield's repository +# + to be run from a clean clone of nftsim's repository # (clean here means no uncommitted changes in the working directory); -# + neurofield to be building and running properly; and +# + nftsim to be building and running properly; and # + valid configuration files as input. # # Authors: Paula Sanz-Leon; Stuart A. Knock; @@ -72,8 +72,8 @@ TMP_DIR='/tmp' MEM_DIR='/dev/shm' SCRIPT_PATH="$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1 ; pwd -P )" RESULTS_DIR="${SCRIPT_PATH}/results" -NEUROFIELD_DIR="$( cd "$SCRIPT_PATH" || exit 1; cd ../ || exit 1; pwd -P )" -NEUROFIELD="$NEUROFIELD_DIR/bin/neurofield" +NFTSIM_DIR="$( cd "$SCRIPT_PATH" || exit 1; cd ../ || exit 1; pwd -P )" +NFTSIM="$NFTSIM_DIR/bin/nftsim" TODAY="$(date +%F)" #Date in IEEE standard format, ie YYYY-mm-dd FILE_NAME_NOW="$(date +%FT%H%M%S)" #ISO 8601: YYYY-mm-ddThhMMSS @@ -174,13 +174,13 @@ delete_entries(){ fi } #delete_entries -#Rebuild neurofield from scratch to make sure the executable matches current code. +#Rebuild nftsim from scratch to make sure the executable matches current code. fresh_build(){ #Use a subshell to: ( - #Change into neurofield's base directory. - if ! cd "$NEUROFIELD_DIR"; then - printf 'ERROR: %s\n' "Failed to change to neurofield directory: '$NEUROFIELD_DIR'" + #Change into nftsim's base directory. + if ! cd "$NFTSIM_DIR"; then + printf 'ERROR: %s\n' "Failed to change to nftsim directory: '$NFTSIM_DIR'" return 1 fi #Ensure we are actually running the current version of the code. @@ -464,7 +464,7 @@ else fi if [[ "${DEBUG,,}" = 'true' ]]; then - printf '%s\n' "NEUROFIELD: '$NEUROFIELD'" + printf '%s\n' "NFTSIM: '$NFTSIM'" printf '%s\n' "CONFIG_FILE: '$CONFIG_FILE'" printf '%s\n' "OUTPUT_FILE: '$OUTPUT_FILE'" printf '%s\n' "TIMING_FILE: '$TIMING_FILE'" @@ -477,7 +477,7 @@ if ! gather_system_info; then exit 1; fi if ! gather_code_info; then exit 1; fi if ! gather_conf_info; then exit 1; fi -#Unless we have explicitly been told not to, rebuild neurofield. +#Unless we have explicitly been told not to, rebuild nftsim. [[ "${NF_BENCH_NO_MAKE,,}" = 'true' ]] || if ! fresh_build; then exit 1; fi if ! TMP_TIMING_FILE="$(mktemp "$TMP_DIR"/nf_timing-XXXX)"; then @@ -487,7 +487,7 @@ fi for (( j = 0; j < NF_BENCH_NUMBER_OF_TRIALS; j++ )); do #Finally, do the actual benchmark run: - /usr/bin/time -v "$NEUROFIELD" -i "$CONFIG_FILE" -o "$OUTPUT_FILE" 2> "$TMP_TIMING_FILE" + /usr/bin/time -v "$NFTSIM" -i "$CONFIG_FILE" -o "$OUTPUT_FILE" 2> "$TMP_TIMING_FILE" #Collect important resource usage info into variables file_size="$(wc --bytes < "$OUTPUT_FILE")" diff --git a/conditions.txt b/conditions.txt index f4a921d..0e588d5 100644 --- a/conditions.txt +++ b/conditions.txt @@ -1,5 +1,5 @@ ============================================================================== -= NEUROFIELD is licensed under the Apache 2.0 License = += NFTSIM is licensed under the Apache 2.0 License = ============================================================================== (c) Copyright @@ -7,14 +7,20 @@ School of Physics University of Sydney - Please cite Neurofield as follows: + Please cite NFTsim as follows: Sanz-Leon, P., Robinson, PA., Knock, SA., Drysdale, PM., Fung, PK., Abeysuriya, GM., Rennie, CJ and Zhao, XL. - "NeuroField: Theory and Simulation of Multiscale Neural Field Dynamics" - presubmitted to PLoS Computational Biology + "NFTsim: Theory and Simulation of Multiscale Neural Field Dynamics" + Submitted to PLoS Computational Biology (2017) + Download the preprint from here: + https://www.biorxiv.org/content/early/2018/02/01/237032 + -Feedback, bug reports, patches and contributions are welcome at -https://github.com/BrainDynamicsUSYD/neurofield/issues +Feedback, bug reports, patches and contributions are welcome at: +https://github.com/BrainDynamicsUSYD/nftsim/issues + +Read online documentation at: +https://github.com/BrainDynamicsUSYD/nftsim/wiki ============================================================================== diff --git a/doc/NFTsimManual.pdf b/doc/NFTsimManual.pdf index 5f10f78..252752a 100644 Binary files a/doc/NFTsimManual.pdf and b/doc/NFTsimManual.pdf differ diff --git a/doc/NFTsimManual.tex b/doc/NFTsimManual.tex index 2f68a5e..1b7f797 100644 --- a/doc/NFTsimManual.tex +++ b/doc/NFTsimManual.tex @@ -1,6 +1,6 @@ \documentclass[12pt,a4paper]{article} -\title{NeuroField User Manual} +\title{NFTsim User Manual} \author{Complex Systems\\School of Physics\\University of Sydney} \date{\today} @@ -25,7 +25,7 @@ \parindent=0.0cm \parskip=0.5cm \fancyhf{} -\lhead{{\em NeuroField} User Guide} +\lhead{{\em NFTsim} User Guide} \rfoot{\thepage} \lfoot{{\scriptsize \textcopyright\ Brain Dynamics Group, University of Sydney 2015}} @@ -43,7 +43,7 @@ \newcommand{\type}[1]{{\small\small\tt #1} } -\newcommand{\NF}[0]{\type{NeuroField}} +\newcommand{\NF}[0]{\type{NFTsim}} \graphicspath{{Figure/}} @@ -61,7 +61,7 @@ \begin{document} -\section*{NeuroField User Guide} +\section*{NFTsim User Guide} \NF is a \type{C++} program developed by the Brain Dynamics Group at the University of Sydney, which solves the neural field model of Robinson et al. It is one of a core group of software analysis packages we have developed for our research. @@ -99,31 +99,31 @@ \subsection*{Assumed knowledge} %\pagebreak %\tableofcontents -\section{Obtaining and setting up NeuroField} +\section{Obtaining and setting up NFTsim} \label{sec:obtain} -\subsection{Obtaining NeuroField} +\subsection{Obtaining NFTsim} -\NF can be obtained from our website, \url{http://sydney.edu.au/science/physics/research/complex-systems/brain-dynamics/software.shtml}. As per the license agreement, users are not permitted to redistribute this program to other individuals or organizations - they should download NeuroField directly so as to have the most recent version, including any corrections. +\NF can be obtained from our website, \url{http://sydney.edu.au/science/physics/research/complex-systems/brain-dynamics/software.shtml}. As per the license agreement, users are not permitted to redistribute this program to other individuals or organizations - they should download NFTsim directly so as to have the most recent version, including any corrections. \subsection{Directory layout} -All of the files associated with \NF are contained in a directory called \type{neurofield}. This directory is referred to as the `root directory', and it contains the following: +All of the files associated with \NF are contained in a directory called \type{nftsim}. This directory is referred to as the `root directory', and it contains the following: \begin{tabular}{l p{13cm}} \type{src/}& \type{C++} source code.\\ \type{(obj/)}& This directory is created during compilation and stores intermediate object code.\\ \type{(dep/)}& This directory is created during compilation and stores dependency information.\\ -\type{(bin/)}& The compiled binary \type{neurofield} is created here.\\ +\type{(bin/)}& The compiled binary \type{nftsim} is created here.\\ \type{configs/}& Stores example configuration files for \NF.\\ \type{doc/}& Contains this manual and the reference manual once it's built.\\ \type{+nf/}& Matlab package directory containing \NF helper scripts.\\ \type{test/}& Directory for development testing and is irrelevant for users.\\ \end{tabular} -\subsection{Compiling NeuroField} +\subsection{Compiling NFTsim} \label{sec:compiling} -You can compile NeuroField simply by running +You can compile NFTsim simply by running \begin{lstlisting} make @@ -150,30 +150,30 @@ \subsection{Compiling NeuroField} make help \end{lstlisting} -\section{Running NeuroField} +\section{Running NFTsim} \label{sec:running} You can run \NF directly using \begin{lstlisting} -./bin/neurofield +./bin/nftsim \end{lstlisting} -from the main \NF directory. For ease of use, you may consider adding the \type{neurofield} binary to your system path. +from the main \NF directory. For ease of use, you may consider adding the \type{nftsim} binary to your system path. -By default, \NF will check if a configuration file called \type{neurofield.conf} exists in the current directory. If this file exists, \NF will run it and write output to the file \type{neurofield.output} in the current directory. When these default files are used, a warning is displayed: +By default, \NF will check if a configuration file called \type{nftsim.conf} exists in the current directory. If this file exists, \NF will run it and write output to the file \type{nftsim.output} in the current directory. When these default files are used, a warning is displayed: \begin{lstlisting} -romesha@romeshalt: neurofield > ./bin/neurofield -Warning: Using neurofield.conf for input by default -Warning: Using neurofield.output for output by default +romesha@romeshalt: nftsim > ./bin/nftsim +Warning: Using nftsim.conf for input by default +Warning: Using nftsim.output for output by default \end{lstlisting} -Note that NeuroField will overwrite the output file if it exists, so it is not a good idea to use \type{neurofield.output} for your work. +Note that NFTsim will overwrite the output file if it exists, so it is not a good idea to use \type{nftsim.output} for your work. You can optionally provide an input file using the \type{-i} switch. For example, \begin{lstlisting} -./bin/neurofield -i configs/example.conf +./bin/nftsim -i configs/example.conf \end{lstlisting} will use the configuration file \type{example.conf} within the \type{configs} directory, and will write output to \type{example.output} also in the \type{configs} directory. The output file name is generated by replacing the input file's suffix (\type{.conf}) with \type{.output}. @@ -181,12 +181,12 @@ \section{Running NeuroField} Or you can also specify an output file, using the \type{-o} switch. For example, if you want your configuration files and output data to be in different directories, \begin{lstlisting} -./bin/neurofield -i configs/example.conf -o example.output +./bin/nftsim -i configs/example.conf -o example.output \end{lstlisting} will use the configuration file \type{example.conf} within the \type{configs} directory, and will write output to \type{example.output} in the current directory. -A list of available switches can be displayed by using the \type{-h} or \type{--help} option i.e., \type{./bin/neurofield -h} +A list of available switches can be displayed by using the \type{-h} or \type{--help} option i.e., \type{./bin/nftsim -h} \subsection{Writing a configuration file} \label{sec:config} @@ -220,14 +220,14 @@ \subsection{Writing a configuration file} \item The ordering of the parameters are important. Wrong parameter ordering results in \NF terminating with an error message. \item The configuration file is white-space independent, e.g., there can be either no spaces, many spaces, or new lines between parameters. \item For readability, users are encouraged to arrange parameter entries for different objects (via new lines and indentations) and aligning corresponding parameters between different objects. - \item Tip for \type{vi} users: \type{./Helper\_scripts/neurofield.vim} implements syntax highlighting for configuration files in \type{vi}. See comments within for installation instructions. + \item Tip for \type{vi} users: \type{./Helper\_scripts/nftsim.vim} implements syntax highlighting for configuration files in \type{vi}. See comments within for installation instructions. \end{enumerate} \subsubsection{Example configuration} The remainder of this section refers to an example configuration for the illustrative example system shown in Fig.~\ref{fig:cortical}. The corresponding configuration file is also shown below. This configuration file is included in the repository as \type{configs/cortex.conf} and can be run from the \NF repository root using \begin{lstlisting} -./bin/neurofield -i configs/cortex.conf -o cortex.output +./bin/nftsim -i configs/cortex.conf -o cortex.output \end{lstlisting} {\em It is recommended that you open \type{configs/cortex.conf} to read in conjunction with this section of the manual.} @@ -519,7 +519,7 @@ \subsubsection{Coupling Classes} %\] %The neuromodulator's concentration is in turn given by a user chosen stimulus form analogous to stimulus populations. - %The remainder of the input form is specification of the output for $\nu$. This takes an analogous form to the usual output data lines. The $\nu$ data is output to a file with filename \type{neurofield.synaptout.xx} where xx is an index number of the coupling. + %The remainder of the input form is specification of the output for $\nu$. This takes an analogous form to the usual output data lines. The $\nu$ data is output to a file with filename \type{nftsim.synaptout.xx} where xx is an index number of the coupling. %An example Modcouple input form is given by %\begin{lstlisting} @@ -611,7 +611,7 @@ \subsubsection{Output data} \section{Analysis} \label{sec:analysis} -\NF produces a single output file, unless a different name is manually specified this file's name is the same as the input file but with the suffix replaced by \type{.output}. The output file starts with a copy of the input file, to enable the output file to serve as a complete representation of the simulation. The simulation results follow a series of `\type{=}' characters. Example content in \type{neurofield.output} is +\NF produces a single output file, unless a different name is manually specified this file's name is the same as the input file but with the suffix replaced by \type{.output}. The output file starts with a copy of the input file, to enable the output file to serve as a complete representation of the simulation. The simulation results follow a series of `\type{=}' characters. Example content in \type{nftsim.output} is \begin{lstlisting} ============================================= Time Propagator.2.phi @@ -671,18 +671,18 @@ \subsection{Matlab} There are two ways to create the \type{nf} object. You can read the output file directly after executing \NF elsewhere \begin{lstlisting} -obj = nf.read('neurofield.output') +obj = nf.read('nftsim.output') \end{lstlisting} or you can use the \type{nf.run} helper script to run the config file using \NF and automatically parse the output \begin{lstlisting} -obj = nf.run('neurofield.conf') +obj = nf.run('nftsim.conf') \end{lstlisting} %Using \type{nf\_run} means you will need to add \NF to your shell search path. -Several helper files are provided to manipulate the \type{nf} object. The two most important helpers are \type{nf.extract} and \type{nf.grid}. Often you want to extract a particular field from the \type{nf} object, for example, to examine the output from \type{Propagator.3.phi}. To do this directly with the neurofield struct, you would need to check the \type{fields} variable to find the index of the trace you wanted, and then extract it from the \type{data} field. In the previous example, \type{Propagator.3.phi} is the second trace. These expressions are identical: +Several helper files are provided to manipulate the \type{nf} object. The two most important helpers are \type{nf.extract} and \type{nf.grid}. Often you want to extract a particular field from the \type{nf} object, for example, to examine the output from \type{Propagator.3.phi}. To do this directly with the nftsim struct, you would need to check the \type{fields} variable to find the index of the trace you wanted, and then extract it from the \type{data} field. In the previous example, \type{Propagator.3.phi} is the second trace. These expressions are identical: \begin{lstlisting} trace = obj.data{2}; trace = nf.extract(obj,'Propagator.3.phi') @@ -749,7 +749,7 @@ \subsubsection{Coding style} using std::vector; \end{lstlisting} -\subsection{Extending NeuroField via inheritance} +\subsection{Extending NFTsim via inheritance} \label{sec:extension} Most new functionalities may be introduced by inheriting existing classes and overloading appropriate functions, where the core classes are: @@ -777,7 +777,7 @@ \subsection{Extending NeuroField via inheritance} \end{tabular} \subsubsection{Class hierarchy} -The diagram in Figure \ref{fig:classes} shows the inheritance hierarchy for the base NeuroField objects. Note that the \type{Array} class is a container object, and it is not necessary to interact with it directly. See Sec.~\ref{sec:array} for details. +The diagram in Figure \ref{fig:classes} shows the inheritance hierarchy for the base NFTsim objects. Note that the \type{Array} class is a container object, and it is not necessary to interact with it directly. See Sec.~\ref{sec:array} for details. \begin{figure}[h] \label{fig:classes} @@ -857,9 +857,9 @@ \subsubsection{Procedure for implementing a new class} \item Write a configuration file that uses the new class. Or if the object may exhibit different types of behaviour under different parameter values, having one configuration file for each type of behaviour may be advantageous. Make sure that the configuration file has an appropriate comment. \end{enumerate} -\subsection{NeuroField classes} +\subsection{NFTsim classes} -This section contains an overview of all of the base classes in NeuroField. +This section contains an overview of all of the base classes in NFTsim. \subsubsection{Class NF} \label{sec:nf} @@ -1248,7 +1248,7 @@ \subsubsection{Object-oriented programming} \item To summarize, some features brought forth are code structure and protection, code reuse and extension, dynamic allocation of object type, and (if applicable) coding-level object hierarchy. \end{enumerate} -\subsubsection{NeuroField} +\subsubsection{NFTsim} \begin{enumerate} \item \NF is naturally object oriented: firing response, propagators, couplings, dendrites naturally arise and form a network, where each class/object influences other ones. diff --git a/doc/noise.lyx b/doc/noise.lyx index 2afd1c9..e02f717 100644 --- a/doc/noise.lyx +++ b/doc/noise.lyx @@ -65,7 +65,7 @@ \begin_body \begin_layout Title -Noise Amplitude in NeuroField +Noise Amplitude in NFTsim \end_layout \begin_layout Author @@ -81,8 +81,8 @@ Introduction \end_layout \begin_layout Standard -Correctly calculating the noise amplitude for NeuroField is critical when - comparing the power spectrum in NeuroField to analytic predictions. +Correctly calculating the noise amplitude for NFTsim is critical when + comparing the power spectrum in NFTsim to analytic predictions. In the analytic work, we work almost exclusively in Fourier space, and use white noise with \end_layout @@ -135,10 +135,10 @@ s \end_layout \begin_layout Standard -In NeuroField, white noise is drawn from a Gaussian distribution at each +In NFTsim, white noise is drawn from a Gaussian distribution at each node, at each point in time. There is a relationship between the mean and standard deviation of the - Gaussian distribution used in NeuroField, and between + Gaussian distribution used in NFTsim, and between \begin_inset Formula $\phi_{n}^{(0)}$ \end_inset @@ -156,7 +156,7 @@ In NeuroField, white noise is drawn from a Gaussian distribution at each \begin_inset Formula $\phi_{n}(k,\omega)$ \end_inset - which are related to the standard deviation of the NeuroField Gaussian + which are related to the standard deviation of the NFTsim Gaussian distribution. \end_layout @@ -721,7 +721,7 @@ When a plot of the power spectrum is made in Matlab, dividing by the transfer ). Also, this value corresponds to the single sided power spectral density. - In NeuroField, we require the full power spectrum including negative frequency + In NFTsim, we require the full power spectrum including negative frequency components. Therefore, the value of \begin_inset Formula $\phi_{n}^{2}(f)$ @@ -754,7 +754,7 @@ Therefore, once we have chosen \begin_inset Formula $\phi_{n}^{2}(\omega)$ \end_inset - we are able to calculate the appropriate noise amplitude in NeuroField + we are able to calculate the appropriate noise amplitude in NFTsim using the relation \end_layout @@ -949,7 +949,7 @@ s \end_inset we can calculate the corresponding standard deviation for the noise in - NeuroField using the previously derived correspondance. + NFTsim using the previously derived correspondance. At a sampling rate of 10000 Hz, we find \end_layout @@ -982,7 +982,7 @@ s \begin_inset Formula $^{-1}$ \end_inset - compared with NeuroField using the above noise amplitud and sampling rates. + compared with NFTsim using the above noise amplitud and sampling rates. In this cortical network, the parameter values used were \begin_inset Formula $\nu_{ee}=1$ \end_inset @@ -1205,12 +1205,12 @@ The end result is that Parseval's theorem is satisfied in Matlab as a direct \begin_layout Standard The same problem exists when considering spatial sampling. The size of the cortex is assumed to be 50 x 50cm, which is discretized - in NeuroField when solving the wave equation for propagation of + in NFTsim when solving the wave equation for propagation of \begin_inset Formula $\phi_{e}$ \end_inset in the cortex. - NeuroField allows the user to pick the number of nodes in each direction + NFTsim allows the user to pick the number of nodes in each direction along the grid, subject to the constraints \end_layout @@ -1248,7 +1248,7 @@ However, an additional effect is that the noise amplitude depends on the \end_inset decreased as the sampling rate increased for the same standard deviation - of noise in NeuroField. + of noise in NFTsim. This is in fact exactly the same scenario, because when the physical size of the cortex is fixed, changing the number of nodes alters the spatial sampling frequency (samples per meter). @@ -1384,7 +1384,7 @@ Cortex only network (3D) \begin_layout Standard We now consider the same cortical-only network, only now allowing for spatial variation. - This was achieved by running NeuroField with 400 nodes, such that + This was achieved by running NFTsim with 400 nodes, such that \begin_inset Formula $\Delta x=0.025$ \end_inset @@ -1402,7 +1402,7 @@ s \end_inset . - Numerical integration was performed using NeuroField in exactly the same + Numerical integration was performed using NFTsim in exactly the same way as the 1D case, and the power spectral density was evaluted consistent with the scalings required by Parseval's theorem (dividing by total number of elements, dividing by the frequency bin size, summing over angular wavenumbe @@ -1516,7 +1516,7 @@ Finally, we can test this noise amplitude for the full corticothalamic model. \end_inset . - Also, in NeuroField we replace the sigmoid response with a linearized response, + Also, in NFTsim we replace the sigmoid response with a linearized response, to eliminate nonlinear effects that are not included in the analytic power spectrum. Comparing the resulting power spectra shows an excellent match between @@ -1578,11 +1578,11 @@ When solving over a 2D grid, users can specify \begin_inset Formula $\Delta x$ \end_inset - in the NeuroField configuration file. - In this case, NeuroField will perform the rescaling appropriately. + in the NFTsim configuration file. + In this case, NFTsim will perform the rescaling appropriately. For a 1D system with only a single node (which is incapable of using the wave propagator), users should use the conversion formula in this document. - The calculation of the power spectrum based on NeuroField output is included + The calculation of the power spectrum based on NFTsim output is included in the helper script \family typewriter nf_spatial_spectrum.m @@ -1594,7 +1594,7 @@ nf_spatial_spectrum.m \end_inset -values included, and how to implement volume conduction filtering. - It accepts a NeuroField output object, and parameters for segmenting, limiting + It accepts a NFTsim output object, and parameters for segmenting, limiting \begin_inset Formula $k$ \end_inset diff --git a/nf_conf.vim b/nf_conf.vim index 22a7a64..d785ec9 100644 --- a/nf_conf.vim +++ b/nf_conf.vim @@ -27,4 +27,4 @@ hi def link CntKey preproc hi def link CntI preproc hi def link Choice statement -let b:current_syntax = "neurofield" +let b:current_syntax = "nftsim" diff --git a/nf_configs b/nf_configs index 572e4cb..5db031b 100755 --- a/nf_configs +++ b/nf_configs @@ -6,7 +6,7 @@ # ./nf_configs --help # #DESCRIPTION: -# A script for checking the output from the neurofield repo's .conf files +# A script for checking the output from the nftsim repo's .conf files # against their expected test output. The expected/test output is stored in # the directory # ./test/data/configs/ @@ -32,11 +32,11 @@ declare -r INPUTARG1 INPUTARG2 SCRIPTDIR="$(dirname "${BASH_SOURCE[0]}")" -neurofield_exists(){ - if [[ -e "$SCRIPTDIR"/bin/neurofield ]]; then +nftsim_exists(){ + if [[ -e "$SCRIPTDIR"/bin/nftsim ]]; then return 0 else - printf '%s\n' "The neurofield executable doesn't exist, run make." + printf '%s\n' "The nftsim executable doesn't exist, run make." return 1 fi } @@ -46,12 +46,12 @@ parse_command_flags(){ #check for command line switches case "$INPUTARG1" in --regenerate|-r) - neurofield_exists || return 1 + nftsim_exists || return 1 regenerate_output_file "$INPUTARG2" return "$?" ;; --check|-c) - neurofield_exists || return 1 + nftsim_exists || return 1 if [[ "$INPUTARG2" = 'all' ]]; then check_all return "$?" @@ -63,7 +63,7 @@ parse_command_flags(){ ;; --clean) #Remove files left around by calls to --check that found differences. - rm -f /tmp/neurofield_* + rm -f /tmp/nftsim_* return "$?" ;; --help|-h|-?) @@ -80,7 +80,7 @@ msg_help(){ printf ' %s\n\n' "nf_configs -- ''" printf ' %s\n' "Modes:" printf '\n%s\n' " --check" - printf '%s\n' " Check if the output from neurofield has changed for a specified config file." + printf '%s\n' " Check if the output from nftsim has changed for a specified config file." printf '%s\n' " For example, to check the output of the 'example.conf' file, run:" printf '%s\n' " ./nf_configs --check 'example'" printf '%s\n' " or:" @@ -116,11 +116,11 @@ set_output_file(){ } # Run the config file provided as an argument, the first arg is expected -# to be a relative(to neurofield) path to the config file. +# to be a relative(to nftsim) path to the config file. run_config(){ local config_file="$1" local output_file - local neurofield_status + local nftsim_status #If run_config() was called with a second arg use it as the output_file if (( $# > 1 )); then @@ -133,18 +133,18 @@ run_config(){ [[ -d "$output_dir" ]] || mkdir --parents "$output_dir" fi - #Run neurofield for the requested config file - "$SCRIPTDIR/bin/neurofield" -i "$config_file" -o "$output_file" - neurofield_status="$?" + #Run nftsim for the requested config file + "$SCRIPTDIR/bin/nftsim" -i "$config_file" -o "$output_file" + nftsim_status="$?" #If the run was successful then gzip the resulting file. - if ((neurofield_status == 0)); then + if ((nftsim_status == 0)); then gzip --force "$output_file" else - printf "$ERROR_CLR %s\n" "Failed running: $SCRIPTDIR/bin/neurofield -i $config_file -o $output_file" + printf "$ERROR_CLR %s\n" "Failed running: $SCRIPTDIR/bin/nftsim -i $config_file -o $output_file" fi - return "$neurofield_status" + return "$nftsim_status" } get_all_config_files(){ @@ -166,7 +166,7 @@ regenerate_output_file(){ done return 0 elif [[ "$config_file" == "changed" ]]; then - [[ -f "/tmp/neurofield_changed_output_list_$(whoami).txt" ]] || { printf '%s\n' 'No changed list.'; return 1; } + [[ -f "/tmp/nftsim_changed_output_list_$(whoami).txt" ]] || { printf '%s\n' 'No changed list.'; return 1; } local regen_file local -i regen_errors=0 while read -r output_to_regenerate ; do @@ -176,7 +176,7 @@ regenerate_output_file(){ printf '%s\n' "Regenerating '$regen_file'..." set_output_file "$regen_file" if ! run_config "$regen_file"; then ((++regen_errors)); fi - done < "/tmp/neurofield_changed_output_list_$(whoami).txt" + done < "/tmp/nftsim_changed_output_list_$(whoami).txt" if ((regen_errors!=0)); then printf '%s\n' "There were '$regen_errors' errors while regenerating changed output." return "$regen_errors" @@ -199,7 +199,7 @@ regenerate_output_file(){ } check_all(){ - local -r changed_ouput_list="/tmp/neurofield_changed_output_list_$(whoami).txt" + local -r changed_ouput_list="/tmp/nftsim_changed_output_list_$(whoami).txt" [[ -f "$changed_ouput_list" ]] && rm -f "$changed_ouput_list" local error_count=0 local conf_count=0 @@ -223,7 +223,7 @@ check_all(){ } #Generates a temporary output file in /tmp/ for a specified config file and -#compares it to the corresponding output file in neurofield/test/data/configs/ +#compares it to the corresponding output file in nftsim/test/data/configs/ check_output_file(){ local config_file="$1" local config_file_name @@ -234,14 +234,14 @@ check_output_file(){ config_file="$(find "$SCRIPTDIR/configs" -maxdepth 3 -type f -name "${config_file}.conf")" fi - #Compare the current output of neurofield against stored output. + #Compare the current output of nftsim against stored output. if [[ -f "$config_file" ]]; then set_output_file "$config_file" [[ -f "${OUTPUT_FILE}.gz" ]] || { printf "$ERROR_CLR %s\n" "No existing file to check against."; return 1; } config_file_name="$(basename "$config_file")" - #Path to file containing output of current neurofield. - OUTPUT_FILE_TMP="$(mktemp --tmpdir="/tmp" --suffix=.output neurofield_"$config_file_name"-XXXX 2>/dev/null \ - || mktemp /tmp/neurofield_"$config_file_name".XXXX)" #Alternative for OSX + #Path to file containing output of current nftsim. + OUTPUT_FILE_TMP="$(mktemp --tmpdir="/tmp" --suffix=.output nftsim_"$config_file_name"-XXXX 2>/dev/null \ + || mktemp /tmp/nftsim_"$config_file_name".XXXX)" #Alternative for OSX run_config "$config_file" "$OUTPUT_FILE_TMP" || return 1 diff -q <(zcat "${OUTPUT_FILE_TMP}.gz") <(zcat "${OUTPUT_FILE}.gz") &> /dev/null DIFF_STATUS="$?" #NOTE: No-diff = 0; diff = 1; error = 2 diff --git a/src/array.h b/src/array.h index 0378caf..d9e69f5 100644 --- a/src/array.h +++ b/src/array.h @@ -6,8 +6,8 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_ARRAY_H -#define NEUROFIELD_SRC_ARRAY_H +#ifndef NFTSIM_SRC_ARRAY_H +#define NFTSIM_SRC_ARRAY_H // C++ standard library headers #include // std::vector; @@ -88,4 +88,4 @@ typename Array::size_type Array::size() const { return m.size(); } -#endif //NEUROFIELD_SRC_ARRAY_H +#endif //NFTSIM_SRC_ARRAY_H diff --git a/src/bcm.cpp b/src/bcm.cpp index 71fcedc..9cb84d7 100644 --- a/src/bcm.cpp +++ b/src/bcm.cpp @@ -9,7 +9,7 @@ // Main module header #include "bcm.h" // BCM; -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "de.h" // RK4; diff --git a/src/bcm.h b/src/bcm.h index 0b3c656..fbb940c 100644 --- a/src/bcm.h +++ b/src/bcm.h @@ -6,10 +6,10 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_BCM_H -#define NEUROFIELD_SRC_BCM_H +#ifndef NFTSIM_SRC_BCM_H +#define NFTSIM_SRC_BCM_H -// Other neurofield headers +// Other nftsim headers #include "cadp.h" // CaDP; #include "configf.h" // Configf; #include "output.h" // Output; @@ -70,4 +70,4 @@ class BCM : public CaDP { void output( Output& output ) const override; }; -#endif //NEUROFIELD_SRC_BCM_H +#endif //NFTSIM_SRC_BCM_H diff --git a/src/bcmlong.cpp b/src/bcmlong.cpp index ecea3e7..ddc940a 100644 --- a/src/bcmlong.cpp +++ b/src/bcmlong.cpp @@ -9,7 +9,7 @@ // Main module header #include "bcmlong.h" // BCMLong; -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "de.h" // RK4; #include "output.h" // Output; diff --git a/src/bcmlong.h b/src/bcmlong.h index 93e980f..ca4adc8 100644 --- a/src/bcmlong.h +++ b/src/bcmlong.h @@ -6,10 +6,10 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_BCMLONG_H -#define NEUROFIELD_SRC_BCMLONG_H +#ifndef NFTSIM_SRC_BCMLONG_H +#define NFTSIM_SRC_BCMLONG_H -// Other neurofield headers +// Other nftsim headers #include "bcm.h" // BCM; #include "configf.h" // Configf; #include "de.h" // RK4; @@ -38,4 +38,4 @@ class BCMLong : public BCM { void output( Output& output ) const override; }; -#endif //NEUROFIELD_SRC_BCMLONG_H +#endif //NFTSIM_SRC_BCMLONG_H diff --git a/src/burst.cpp b/src/burst.cpp index 7f612b0..2a6ecdf 100644 --- a/src/burst.cpp +++ b/src/burst.cpp @@ -9,7 +9,7 @@ // Main module header #include "burst.h" // BurstResponse; -// Other neurofield headers +// Other nftsim headers #include "array.h" // Array; #include "configf.h" // Configf; #include "dendrite.h" // Dendrite; diff --git a/src/burst.h b/src/burst.h index b888b01..4808a22 100644 --- a/src/burst.h +++ b/src/burst.h @@ -6,10 +6,10 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_BURST_H -#define NEUROFIELD_SRC_BURST_H +#ifndef NFTSIM_SRC_BURST_H +#define NFTSIM_SRC_BURST_H -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "de.h" // DE; RK4; #include "output.h" // Output; @@ -64,5 +64,5 @@ class BurstResponse : public FiringResponse { //derived class; constructor initi void output( Output& output ) const override; //vector of Output ptrs filled by }; -#endif //NEUROFIELD_SRC_BURST_H +#endif //NFTSIM_SRC_BURST_H diff --git a/src/cadp.cpp b/src/cadp.cpp index 601ce75..3b37fd5 100644 --- a/src/cadp.cpp +++ b/src/cadp.cpp @@ -9,7 +9,7 @@ // Main module header #include "cadp.h" // CaDP; -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "output.h" // Output; #include "population.h" // Population; diff --git a/src/cadp.h b/src/cadp.h index 47a22a4..9a5ada5 100644 --- a/src/cadp.h +++ b/src/cadp.h @@ -6,10 +6,10 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_CADP_H -#define NEUROFIELD_SRC_CADP_H +#ifndef NFTSIM_SRC_CADP_H +#define NFTSIM_SRC_CADP_H -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "coupling.h" // Coupling; #include "de.h" // DE; RK4; @@ -72,4 +72,4 @@ class CaDP : public Coupling { void output( Output& output ) const override; }; -#endif //NEUROFIELD_SRC_CADP_H +#endif //NFTSIM_SRC_CADP_H diff --git a/src/configf.h b/src/configf.h index ba5982e..934af11 100644 --- a/src/configf.h +++ b/src/configf.h @@ -6,8 +6,8 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_CONFIGF_H -#define NEUROFIELD_SRC_CONFIGF_H +#ifndef NFTSIM_SRC_CONFIGF_H +#define NFTSIM_SRC_CONFIGF_H // C++ standard library headers #include // std::ifstream; tellg; seekg; @@ -109,4 +109,4 @@ template bool Configf::optional( const std::string& param, T& ret, int return false; } -#endif //NEUROFIELD_SRC_CONFIGF_H +#endif //NFTSIM_SRC_CONFIGF_H diff --git a/src/coupling.cpp b/src/coupling.cpp index 4b9cf53..8e9bbe9 100644 --- a/src/coupling.cpp +++ b/src/coupling.cpp @@ -9,7 +9,7 @@ // Main module header #include "coupling.h" // Coupling; -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "output.h" // Output; #include "population.h" // Population; diff --git a/src/coupling.h b/src/coupling.h index 1c67132..3e910a1 100644 --- a/src/coupling.h +++ b/src/coupling.h @@ -6,13 +6,13 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_COUPLING_H -#define NEUROFIELD_SRC_COUPLING_H +#ifndef NFTSIM_SRC_COUPLING_H +#define NFTSIM_SRC_COUPLING_H // Forward declaration to break circular collaboration class Coupling; -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "nf.h" // NF; #include "output.h" // Output; @@ -52,4 +52,4 @@ double Coupling::operator[]( size_type node ) const { return P[node]; } -#endif //NEUROFIELD_SRC_COUPLING_H +#endif //NFTSIM_SRC_COUPLING_H diff --git a/src/coupling_diff_arctan.cpp b/src/coupling_diff_arctan.cpp index a85a6d0..3af8e4c 100644 --- a/src/coupling_diff_arctan.cpp +++ b/src/coupling_diff_arctan.cpp @@ -11,7 +11,7 @@ // Main module header #include "coupling_diff_arctan.h" // CouplingDiffArctan; -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "coupling.h" // Coupling; #include "population.h" // Population; diff --git a/src/coupling_diff_arctan.h b/src/coupling_diff_arctan.h index 3da196e..e480172 100644 --- a/src/coupling_diff_arctan.h +++ b/src/coupling_diff_arctan.h @@ -11,7 +11,7 @@ #ifndef COUPLING_DIFF_ARCTAN_H #define COUPLING_DIFF_ARCTAN_H -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "coupling.h" // Coupling #include "propagator.h" // Propagator; diff --git a/src/coupling_ramp.cpp b/src/coupling_ramp.cpp index 9f00f38..78b88b1 100644 --- a/src/coupling_ramp.cpp +++ b/src/coupling_ramp.cpp @@ -16,7 +16,7 @@ // Main module header #include "coupling_ramp.h" // CouplingRamp; -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "population.h" // Population; #include "propagator.h" // Propagator; diff --git a/src/coupling_ramp.h b/src/coupling_ramp.h index 5860b60..69e2b05 100644 --- a/src/coupling_ramp.h +++ b/src/coupling_ramp.h @@ -16,10 +16,10 @@ + param[in] pairs : total number of pairs of (nu, time) to define the segments */ -#ifndef NEUROFIELD_SRC_COUPLINGRAMP_H -#define NEUROFIELD_SRC_COUPLINGRAMP_H +#ifndef NFTSIM_SRC_COUPLINGRAMP_H +#define NFTSIM_SRC_COUPLINGRAMP_H -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "coupling.h" // Coupling; #include "population.h" // Population; @@ -46,4 +46,4 @@ class CouplingRamp : public Coupling { ~CouplingRamp() override; }; -#endif // NEUROFIELD_SRC_COUPLINGRAMP_H +#endif // NFTSIM_SRC_COUPLINGRAMP_H diff --git a/src/de.h b/src/de.h index b72f9ee..8430dba 100644 --- a/src/de.h +++ b/src/de.h @@ -6,8 +6,8 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_DE_H -#define NEUROFIELD_SRC_DE_H +#ifndef NFTSIM_SRC_DE_H +#define NFTSIM_SRC_DE_H // C++ standard library headers #include // std::vector; @@ -129,4 +129,4 @@ class RK4 : public Integrator { } }; -#endif //NEUROFIELD_SRC_DE_H +#endif //NFTSIM_SRC_DE_H diff --git a/src/dendrite.cpp b/src/dendrite.cpp index f32a68b..28aa051 100644 --- a/src/dendrite.cpp +++ b/src/dendrite.cpp @@ -9,7 +9,7 @@ // Main module header #include "dendrite.h" // Dendrite; -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "coupling.h" // Coupling; #include "de.h" // RK4; diff --git a/src/dendrite.h b/src/dendrite.h index 19dd961..7ca6af8 100644 --- a/src/dendrite.h +++ b/src/dendrite.h @@ -6,13 +6,13 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_DENDRITE_H -#define NEUROFIELD_SRC_DENDRITE_H +#ifndef NFTSIM_SRC_DENDRITE_H +#define NFTSIM_SRC_DENDRITE_H // Forward declaration to break circular collaboration class Dendrite; -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "coupling.h" // Coupling; #include "de.h" // DE; RK4; diff --git a/src/dendrite_integral.cpp b/src/dendrite_integral.cpp index acd0fc3..8ba9134 100644 --- a/src/dendrite_integral.cpp +++ b/src/dendrite_integral.cpp @@ -10,7 +10,7 @@ // Main module header #include "dendrite_integral.h" // DendriteIntegral; -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "coupling.h" // Coupling; #include "propagator.h" // Propagator; diff --git a/src/dendrite_integral.h b/src/dendrite_integral.h index 95e097d..4632b0d 100644 --- a/src/dendrite_integral.h +++ b/src/dendrite_integral.h @@ -8,10 +8,10 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_DENDRITE_INTEGRAL_H -#define NEUROFIELD_SRC_DENDRITE_INTEGRAL_H +#ifndef NFTSIM_SRC_DENDRITE_INTEGRAL_H +#define NFTSIM_SRC_DENDRITE_INTEGRAL_H -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "coupling.h" // Coupling; #include "dendrite.h" // Dendrite; @@ -51,4 +51,4 @@ class DendriteIntegral : public Dendrite { void step() override; }; -#endif //NEUROFIELD_SRC_DENDRITE_INTEGRAL_H +#endif //NFTSIM_SRC_DENDRITE_INTEGRAL_H diff --git a/src/dendriteramp.cpp b/src/dendriteramp.cpp index 8df4d1b..3fefa05 100644 --- a/src/dendriteramp.cpp +++ b/src/dendriteramp.cpp @@ -9,7 +9,7 @@ // Main module header #include "dendriteramp.h" // DendriteRamp; -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "coupling.h" // Coupling; #include "de.h" // RK4; diff --git a/src/dendriteramp.h b/src/dendriteramp.h index 55d2cfe..083d106 100644 --- a/src/dendriteramp.h +++ b/src/dendriteramp.h @@ -6,10 +6,10 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_DENDRITERAMP_H -#define NEUROFIELD_SRC_DENDRITERAMP_H +#ifndef NFTSIM_SRC_DENDRITERAMP_H +#define NFTSIM_SRC_DENDRITERAMP_H -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "coupling.h" // Coupling; #include "de.h" // DE; RK4; @@ -53,4 +53,4 @@ class DendriteRamp : public Dendrite { void output( Output& output ) const override; }; -#endif //NEUROFIELD_SRC_DENDRITERAMP_H +#endif //NFTSIM_SRC_DENDRITERAMP_H diff --git a/src/dumpf.cpp b/src/dumpf.cpp index 29baf79..459f918 100644 --- a/src/dumpf.cpp +++ b/src/dumpf.cpp @@ -9,7 +9,7 @@ // Main module header #include "dumpf.h" // Dumpf; -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; // C++ standard library headers diff --git a/src/dumpf.h b/src/dumpf.h index 6dcf042..2dbac47 100644 --- a/src/dumpf.h +++ b/src/dumpf.h @@ -6,10 +6,10 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_DUMPF_H -#define NEUROFIELD_SRC_DUMPF_H +#ifndef NFTSIM_SRC_DUMPF_H +#define NFTSIM_SRC_DUMPF_H -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; // C++ standard library headers diff --git a/src/firing_response.cpp b/src/firing_response.cpp index 80603ce..53b5b6a 100644 --- a/src/firing_response.cpp +++ b/src/firing_response.cpp @@ -4,7 +4,7 @@ Each neural population is associated with a FiringResponse object which produces the soma response governed by a specified equation, for example Sigmoid: \f[ - Insert equation 9 from draft neurofield paper here. + Insert equation 9 from draft nftsim paper here. \f] @author Peter Drysdale, Felix Fung, @@ -13,7 +13,7 @@ // Main module header #include "firing_response.h" // FiringResponse; -// Other neurofield headers +// Other nftsim headers #include "array.h" // Array; #include "configf.h" // Configf; #include "coupling.h" // Coupling; diff --git a/src/firing_response.h b/src/firing_response.h index 13757c5..cbb7bec 100644 --- a/src/firing_response.h +++ b/src/firing_response.h @@ -7,13 +7,13 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_FIRING_RESPONSE_H -#define NEUROFIELD_SRC_FIRING_RESPONSE_H +#ifndef NFTSIM_SRC_FIRING_RESPONSE_H +#define NFTSIM_SRC_FIRING_RESPONSE_H // Forward declaration to break circular collaboration class FiringResponse; -// Other neurofield headers +// Other nftsim headers #include "array.h" // Array; #include "configf.h" // Configf; #include "coupling.h" // Coupling; @@ -62,4 +62,4 @@ const std::vector& FiringResponse::V() const { return v; } -#endif //NEUROFIELD_SRC_FIRING_RESPONSE_H +#endif //NFTSIM_SRC_FIRING_RESPONSE_H diff --git a/src/glutamate_response.cpp b/src/glutamate_response.cpp index aead7db..3653931 100644 --- a/src/glutamate_response.cpp +++ b/src/glutamate_response.cpp @@ -7,7 +7,7 @@ // Main module header #include "glutamate_response.h" // GlutamateResponse; -// Other neurofield headers +// Other nftsim headers #include "array.h" // Array; #include "configf.h" // Configf; #include "dendrite.h" // Dendrite; diff --git a/src/glutamate_response.h b/src/glutamate_response.h index bf4bc53..c2aaf3b 100644 --- a/src/glutamate_response.h +++ b/src/glutamate_response.h @@ -4,13 +4,13 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_GLUTAMATE_RESPONSE_H -#define NEUROFIELD_SRC_GLUTAMATE_RESPONSE_H +#ifndef NFTSIM_SRC_GLUTAMATE_RESPONSE_H +#define NFTSIM_SRC_GLUTAMATE_RESPONSE_H // Forward declaration to break circular collaboration class GlutamateResponse; -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "de.h" // DE; RK4; #include "firing_response.h" // FiringResponse; @@ -45,4 +45,4 @@ class GlutamateResponse : public FiringResponse { const std::vector& glu() const; }; -#endif //NEUROFIELD_SRC_GLUTAMATE_RESPONSE_H +#endif //NFTSIM_SRC_GLUTAMATE_RESPONSE_H diff --git a/src/harmonic.cpp b/src/harmonic.cpp index b0ba10a..d214afb 100644 --- a/src/harmonic.cpp +++ b/src/harmonic.cpp @@ -9,7 +9,7 @@ // Main module header #include "harmonic.h" // Harmonic; -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "population.h" // Population; diff --git a/src/harmonic.h b/src/harmonic.h index 1cd5a55..9217655 100644 --- a/src/harmonic.h +++ b/src/harmonic.h @@ -6,10 +6,10 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_HARMONIC_H -#define NEUROFIELD_SRC_HARMONIC_H +#ifndef NFTSIM_SRC_HARMONIC_H +#define NFTSIM_SRC_HARMONIC_H -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "de.h" // DE; RK4; #include "population.h" // Population; @@ -49,4 +49,4 @@ class Harmonic : public virtual Propagator { void step() override; }; -#endif //NEUROFIELD_SRC_HARMONIC_H +#endif //NFTSIM_SRC_HARMONIC_H diff --git a/src/harmonic_integral.cpp b/src/harmonic_integral.cpp index 7fea146..7c5c493 100644 --- a/src/harmonic_integral.cpp +++ b/src/harmonic_integral.cpp @@ -9,7 +9,7 @@ // Main module header #include "harmonic_integral.h" // HarmonicIntegral; -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "population.h" // Population; diff --git a/src/harmonic_integral.h b/src/harmonic_integral.h index bbaf4f6..f74fe23 100644 --- a/src/harmonic_integral.h +++ b/src/harmonic_integral.h @@ -6,10 +6,10 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_HARMONIC_INTEGRAL_H -#define NEUROFIELD_SRC_HARMONIC_INTEGRAL_H +#ifndef NFTSIM_SRC_HARMONIC_INTEGRAL_H +#define NFTSIM_SRC_HARMONIC_INTEGRAL_H -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "population.h" // Population; #include "propagator.h" // Propagator; @@ -47,4 +47,4 @@ class HarmonicIntegral : public virtual Propagator { void step() override; }; -#endif //NEUROFIELD_SRC_HARMONIC_INTEGRAL_H +#endif //NFTSIM_SRC_HARMONIC_INTEGRAL_H diff --git a/src/long_coupling.cpp b/src/long_coupling.cpp index 9fa1652..0ae7e7e 100644 --- a/src/long_coupling.cpp +++ b/src/long_coupling.cpp @@ -9,7 +9,7 @@ // Main module header #include "long_coupling.h" // LongCoupling; -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "output.h" // Output; #include "population.h" // Population; diff --git a/src/long_coupling.h b/src/long_coupling.h index 6c7f492..29f3b78 100644 --- a/src/long_coupling.h +++ b/src/long_coupling.h @@ -6,10 +6,10 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_LONGCOUPLING_H -#define NEUROFIELD_SRC_LONGCOUPLING_H +#ifndef NFTSIM_SRC_LONGCOUPLING_H +#define NFTSIM_SRC_LONGCOUPLING_H -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "coupling.h" // Coupling; #include "output.h" // Output; @@ -36,4 +36,4 @@ class LongCoupling : public Coupling { void output( Output& output ) const override; }; -#endif //NEUROFIELD_SRC_LONGCOUPLING_H +#endif //NFTSIM_SRC_LONGCOUPLING_H diff --git a/src/main.cpp b/src/main.cpp index a63c0cb..ded9b07 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,7 +1,7 @@ /** @file main.cpp - @brief Implements the main entry point for Neurofield, a multiscale neural field software. + @brief Implements the main entry point for NFTsim, a multiscale neural field software. - NeuroField is capable of simulating scales from a few tenths of a millimetre + NFTsim is capable of simulating scales from a few tenths of a millimetre and a few milliseconds upward. It allows for the specification of models with: + an arbitrary number of neural populations, of different types and with different parameters; @@ -12,7 +12,7 @@ @author Peter Drysdale, Felix Fung, */ -// Neurofield headers +// NFTsim headers #include "configf.h" // Configf; #include "dumpf.h" // Dumpf; #include "solver.h" // Solver; @@ -36,10 +36,10 @@ int main(int argc, char* argv[]) { for( int i=1; i2 ) { @@ -68,9 +68,9 @@ int main(int argc, char* argv[]) { } } } - const string confname = string(iconfarg != 0?argv[iconfarg]:"neurofield.conf"); + const string confname = string(iconfarg != 0?argv[iconfarg]:"nftsim.conf"); if(iconfarg == 0) { - cerr << "Warning: Using neurofield.conf for input by default" << endl; + cerr << "Warning: Using nftsim.conf for input by default" << endl; } auto inputf = new Configf(confname); @@ -95,7 +95,7 @@ int main(int argc, char* argv[]) { } // open file for outputting data - default is confname with .conf suffix - // replaced by .output, so neurofield.conf => neurofield.output. + // replaced by .output, so nftsim.conf => nftsim.output. Dumpf dumpf; int ioutarg = 0; if( argc>2 ) { @@ -120,9 +120,9 @@ int main(int argc, char* argv[]) { } // construct, initialize and solve the neural field theory - Solver neurofield(dumpf); - *inputf>>neurofield; - neurofield.solve(); + Solver nftsim(dumpf); + *inputf>>nftsim; + nftsim.solve(); delete inputf; return EXIT_SUCCESS; diff --git a/src/nf.cpp b/src/nf.cpp index 058e1d1..520426a 100644 --- a/src/nf.cpp +++ b/src/nf.cpp @@ -9,7 +9,7 @@ // Main module header #include "nf.h" // NF; -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "output.h" // Output; diff --git a/src/nf.h b/src/nf.h index 4bcf495..d6497e2 100644 --- a/src/nf.h +++ b/src/nf.h @@ -6,10 +6,10 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_NF_H -#define NEUROFIELD_SRC_NF_H +#ifndef NFTSIM_SRC_NF_H +#define NFTSIM_SRC_NF_H -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; //#include "dumpf.h" // Dumpf; #include "output.h" // Output; @@ -39,4 +39,4 @@ class NF { virtual ~NF(); }; -#endif //NEUROFIELD_SRC_NF_H +#endif //NFTSIM_SRC_NF_H diff --git a/src/output.cpp b/src/output.cpp index 17f288e..4fc4a59 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -9,7 +9,7 @@ // Main module header #include "output.h" // Output; Outlet; -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "dumpf.h" // Dumpf; diff --git a/src/output.h b/src/output.h index 80b8eb6..925ae35 100644 --- a/src/output.h +++ b/src/output.h @@ -6,8 +6,8 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_OUTPUT_H -#define NEUROFIELD_SRC_OUTPUT_H +#ifndef NFTSIM_SRC_OUTPUT_H +#define NFTSIM_SRC_OUTPUT_H // C++ standard library headers #include // std::string; @@ -38,4 +38,4 @@ class Output { operator std::vector() const; }; -#endif //NEUROFIELD_SRC_OUTPUT_H +#endif //NFTSIM_SRC_OUTPUT_H diff --git a/src/population.cpp b/src/population.cpp index 86e9f36..4d350f6 100644 --- a/src/population.cpp +++ b/src/population.cpp @@ -9,7 +9,7 @@ // Main module header #include "population.h" // Population; -// Other neurofield headers +// Other nftsim headers #include "burst.h" // BurstResponse; #include "configf.h" // Configf; #include "coupling.h" // Coupling; diff --git a/src/population.h b/src/population.h index 872a6e7..f60b1c7 100644 --- a/src/population.h +++ b/src/population.h @@ -6,13 +6,13 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_POPULATION_H -#define NEUROFIELD_SRC_POPULATION_H +#ifndef NFTSIM_SRC_POPULATION_H +#define NFTSIM_SRC_POPULATION_H // Forward declaration to break circular collaboration class Population; -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "coupling.h" // Coupling; #include "nf.h" // NF; @@ -60,4 +60,4 @@ class Population : public NF { virtual void outputDendrite( size_type index, Output& output ) const; }; -#endif //NEUROFIELD_SRC_POPULATION_H +#endif //NFTSIM_SRC_POPULATION_H diff --git a/src/propagator.cpp b/src/propagator.cpp index 7a4d2e4..302489a 100644 --- a/src/propagator.cpp +++ b/src/propagator.cpp @@ -9,7 +9,7 @@ // Main module header #include "propagator.h" // Propagator; -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "output.h" // Output; #include "population.h" // Population; diff --git a/src/propagator.h b/src/propagator.h index f9b10a4..3c758dc 100644 --- a/src/propagator.h +++ b/src/propagator.h @@ -7,13 +7,13 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_PROPAGATOR_H -#define NEUROFIELD_SRC_PROPAGATOR_H +#ifndef NFTSIM_SRC_PROPAGATOR_H +#define NFTSIM_SRC_PROPAGATOR_H // Forward declaration to break circular collaboration class Propagator; -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "nf.h" // NF; #include "output.h" // Output; Outlet; @@ -59,4 +59,4 @@ double Propagator::operator[]( size_type node ) const { return p[node]; } -#endif //NEUROFIELD_SRC_PROPAGATOR_H +#endif //NFTSIM_SRC_PROPAGATOR_H diff --git a/src/random.h b/src/random.h index cd1bcb0..4ab8116 100644 --- a/src/random.h +++ b/src/random.h @@ -6,8 +6,8 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_RANDOM_H -#define NEUROFIELD_SRC_RANDOM_H +#ifndef NFTSIM_SRC_RANDOM_H +#define NFTSIM_SRC_RANDOM_H // C++ standard library headers #include // std::mt19937_64; std::normal_distribution; @@ -29,4 +29,4 @@ class Random { ~Random(); }; -#endif // NEUROFIELD_SRC_RANDOM_H +#endif // NFTSIM_SRC_RANDOM_H diff --git a/src/solver.cpp b/src/solver.cpp index 38a4171..3b37feb 100644 --- a/src/solver.cpp +++ b/src/solver.cpp @@ -5,7 +5,7 @@ If you define your own Propagators or Couplings, then, it is in the init member-function of this class that you must create appropriate entries in - order to make those Propagators and Couplings specifiable via neurofield's + order to make those Propagators and Couplings specifiable via nftsim's configuration (.conf) files. @author Peter Drysdale, Felix Fung, @@ -14,7 +14,7 @@ // Main module header #include "solver.h" // Solver; -// Other neurofield headers +// Other nftsim headers #include "bcm.h" // BCM; #include "bcmlong.h" // BCMLong; #include "cadp.h" // CaDP; diff --git a/src/solver.h b/src/solver.h index f82dba5..be4a394 100644 --- a/src/solver.h +++ b/src/solver.h @@ -6,10 +6,10 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_SOLVER_H -#define NEUROFIELD_SRC_SOLVER_H +#ifndef NFTSIM_SRC_SOLVER_H +#define NFTSIM_SRC_SOLVER_H -// Other neurofield headers +// Other nftsim headers #include "array.h" // Array; #include "configf.h" // Configf; #include "coupling.h" // Coupling; @@ -100,4 +100,4 @@ class Solver : public NF { void step() override; }; -#endif //NEUROFIELD_SRC_SOLVER_H +#endif //NFTSIM_SRC_SOLVER_H diff --git a/src/stencil.h b/src/stencil.h index b4f8048..379f542 100644 --- a/src/stencil.h +++ b/src/stencil.h @@ -18,8 +18,8 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_STENCIL_H -#define NEUROFIELD_SRC_STENCIL_H +#ifndef NFTSIM_SRC_STENCIL_H +#define NFTSIM_SRC_STENCIL_H // C++ standard library headers #include // std::string; @@ -77,4 +77,4 @@ void Stencil::operator++ (int) const { } } -#endif //NEUROFIELD_SRC_STENCIL_H +#endif //NFTSIM_SRC_STENCIL_H diff --git a/src/stencil_legacy.h b/src/stencil_legacy.h index 9cb8336..faa34b1 100644 --- a/src/stencil_legacy.h +++ b/src/stencil_legacy.h @@ -12,8 +12,8 @@ @author Peter Drysdale, Felix Fung. */ -#ifndef NEUROFIELD_SRC_STENCIL_LEGACY_H -#define NEUROFIELD_SRC_STENCIL_LEGACY_H +#ifndef NFTSIM_SRC_STENCIL_LEGACY_H +#define NFTSIM_SRC_STENCIL_LEGACY_H // C++ standard library headers #include // std::string; @@ -71,4 +71,4 @@ void StencilLegacy::operator++ (int) const { } } -#endif //NEUROFIELD_SRC_STENCIL_LEGACY_H +#endif //NFTSIM_SRC_STENCIL_LEGACY_H diff --git a/src/tau.cpp b/src/tau.cpp index 6595088..508bc44 100644 --- a/src/tau.cpp +++ b/src/tau.cpp @@ -9,7 +9,7 @@ // Main module header #include "tau.h" // Tau; -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; // C++ standard library headers diff --git a/src/tau.h b/src/tau.h index f5ba5b4..8589b9f 100644 --- a/src/tau.h +++ b/src/tau.h @@ -6,10 +6,10 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_TAU_H -#define NEUROFIELD_SRC_TAU_H +#ifndef NFTSIM_SRC_TAU_H +#define NFTSIM_SRC_TAU_H -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "nf.h" // NF; @@ -34,4 +34,4 @@ class Tau : public NF { friend class Population; }; -#endif //NEUROFIELD_SRC_TAU_H +#endif //NFTSIM_SRC_TAU_H diff --git a/src/timeseries.cpp b/src/timeseries.cpp index 366a2b1..a557708 100644 --- a/src/timeseries.cpp +++ b/src/timeseries.cpp @@ -9,7 +9,7 @@ // Main module header #include "timeseries.h" // Timeseries; TIMESERIES::; -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "random.h" // Random; diff --git a/src/timeseries.h b/src/timeseries.h index 65c1a54..4683e1c 100644 --- a/src/timeseries.h +++ b/src/timeseries.h @@ -6,10 +6,10 @@ @author Peter Drysdale, Felix Fung, */ -#ifndef NEUROFIELD_SRC_TIMESERIES_H -#define NEUROFIELD_SRC_TIMESERIES_H +#ifndef NFTSIM_SRC_TIMESERIES_H +#define NFTSIM_SRC_TIMESERIES_H -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "nf.h" // NF; #include "random.h" // Random; @@ -103,4 +103,4 @@ struct Sine : public Timeseries { }; } // namespace TIMESERIES -#endif //NEUROFIELD_SRC_TIMESERIES_H +#endif //NFTSIM_SRC_TIMESERIES_H diff --git a/src/wave.cpp b/src/wave.cpp index 87974b0..eaac64f 100644 --- a/src/wave.cpp +++ b/src/wave.cpp @@ -17,7 +17,7 @@ // Main module header #include "wave.h" // Wave; -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "population.h" // Population; #include "stencil.h" // Stencil; diff --git a/src/wave.h b/src/wave.h index 63e94f4..c6cc986 100644 --- a/src/wave.h +++ b/src/wave.h @@ -10,10 +10,10 @@ * */ -#ifndef NEUROFIELD_SRC_WAVE_H -#define NEUROFIELD_SRC_WAVE_H +#ifndef NFTSIM_SRC_WAVE_H +#define NFTSIM_SRC_WAVE_H -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "population.h" // Population; #include "propagator.h" // Propagator; @@ -58,4 +58,4 @@ class Wave : public Propagator { void step() override; }; -#endif //NEUROFIELD_SRC_WAVE_H +#endif //NFTSIM_SRC_WAVE_H diff --git a/src/wave_legacy.cpp b/src/wave_legacy.cpp index 71ca8cc..f48621b 100644 --- a/src/wave_legacy.cpp +++ b/src/wave_legacy.cpp @@ -16,7 +16,7 @@ // Main module header #include "wave_legacy.h" // WaveLegacy; -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "population.h" // Population; #include "stencil_legacy.h" // StencilLegacy; diff --git a/src/wave_legacy.h b/src/wave_legacy.h index d80d056..2ab0d51 100644 --- a/src/wave_legacy.h +++ b/src/wave_legacy.h @@ -10,10 +10,10 @@ * */ -#ifndef NEUROFIELD_SRC_WAVE_LEGACY_H -#define NEUROFIELD_SRC_WAVE_LEGACY_H +#ifndef NFTSIM_SRC_WAVE_LEGACY_H +#define NFTSIM_SRC_WAVE_LEGACY_H -// Other neurofield headers +// Other nftsim headers #include "configf.h" // Configf; #include "population.h" // Population; #include "propagator.h" // Propagator; @@ -58,4 +58,4 @@ class WaveLegacy : public Propagator { void step() override; }; -#endif //NEUROFIELD_SRC_WAVE_LEGACY_H +#endif //NFTSIM_SRC_WAVE_LEGACY_H diff --git a/test/data/configs/README.md b/test/data/configs/README.md index e3dedcf..d5a4f89 100644 --- a/test/data/configs/README.md +++ b/test/data/configs/README.md @@ -1,7 +1,7 @@ -#Configs data (neurofield/test/data/configs/) +# Configs data (nftsim/test/data/configs/) This directory contains output files for each of the configuration files -found in the neurofield/configs directory. They are intended to be used +found in the nftsim/configs directory. They are intended to be used as a check of consistent behaviour following code modifications. To check that any modifications that you have made to the code haven't @@ -9,7 +9,7 @@ inadvertently altered its functionality, run: nf_configs --check -where ``nf_configs`` is a bash script found in the neurofield/ directory. +where ``nf_configs`` is a bash script found in the nftsim/ directory. When a --check reveals a difference from the expected output the temporary file used for the check is not removed, this makes it easy to look at the diff --git a/test/numerical/test_eirs_spectrum.m b/test/numerical/test_eirs_spectrum.m index c02997a..ba5ac6c 100644 --- a/test/numerical/test_eirs_spectrum.m +++ b/test/numerical/test_eirs_spectrum.m @@ -1,5 +1,5 @@ function test_output(save_new) - % This function tests the latest neurofield against known results + % This function tests the latest nftsim against known results % nf_run, nf_read and nf_spatial_spectrum need to be on the path if nargin < 1 || isempty(save_new) save_new = 0; diff --git a/utils/configs_compare.py b/utils/configs_compare.py index e1b6008..645e7c3 100755 --- a/utils/configs_compare.py +++ b/utils/configs_compare.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- """ -Compare the current output of neurofield against the stored data for the +Compare the current output of nftsim against the stored data for the configuration files in configs/. USAGE: @@ -23,7 +23,7 @@ #is 'propagator.1.phi', the default node index is 0, so to show an overlay #and difference (current Vs stored) plot for the first output node of the #first propagator's phi for the onepop.conf configuration file, from the main - #neurofield directory just run: + #nftsim directory just run: ./utils/configs_compare.py --diff --overlay #To compare 'example.conf', plotting an overlay and diff, of the 73rd output @@ -64,9 +64,9 @@ # Then, try importing less reliable packages try: - import neurofield + import nftsim except ImportError: - LOG.error("Failed to import neurofield.py...") + LOG.error("Failed to import nftsim.py...") raise ########################################################################### @@ -111,7 +111,7 @@ def find_file(filename, path): #Parse arguments import argparse PARSER = argparse.ArgumentParser( - description="Compare the current output of neurofield to stored output.") + description="Compare the current output of nftsim to stored output.") #Configuration file PARSER.add_argument('-c', '--conf', @@ -182,15 +182,15 @@ def find_file(filename, path): stored_filepath = find_file(stored_filename, test_data_dir) #Copy the stored data to a temporary file - tmp_stored_filepath = '/tmp/neurofield_stored_%s.output' % config_name + tmp_stored_filepath = '/tmp/nftsim_stored_%s.output' % config_name with gzip.open(stored_filepath, 'rb') as f_in, open(tmp_stored_filepath, 'wb') as f_out: shutil.copyfileobj(f_in, f_out) - #Load the stored data into a neurofield object. - stored = neurofield.NF(tmp_stored_filepath) + #Load the stored data into a nftsim object. + stored = nftsim.NF(tmp_stored_filepath) - #Run the config file with the current version, and load data to a neurofield object. - current = neurofield.run(config_filepath) + #Run the config file with the current version, and load data to a nftsim object. + current = nftsim.run(config_filepath) #If requested, plot overlay of stored and current traces. if ARGS.overlay is True: diff --git a/utils/neurofield.py b/utils/nftsim.py similarity index 85% rename from utils/neurofield.py rename to utils/nftsim.py index 9f6ee1d..7ce416a 100644 --- a/utils/neurofield.py +++ b/utils/nftsim.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- """ - Defines a NeuroField Python class that supports + Defines a NFTsim Python class that supports + running a configuration file + loading the output file for visualization and analysis USAGE: - import neurofield - nfobj = neurofield.run('filename.conf','path_to_neurofield_executable') + import nftsim + nfobj = nftsim.run('filename.conf','path_to_nftsim_executable') print(nfobj) this_trace = 'propagator.1.phi' # traces have the form class.obj_index.variable nfobj.plot(this_trace) @@ -15,9 +15,9 @@ OPTIONS: EXAMPLES: - # From the root neurofield directory - import utils.neurofield as neurofield - nfobj = neurofield.run('configs/example.conf', './bin/neurofield') + # From the root nftsim directory + import utils.nftsim as nftsim + nfobj = nftsim.run('configs/example.conf', './bin/nftsim') print(nfobj) nfobj.plot('propagator.1.phi') @@ -34,7 +34,7 @@ __version__ = '0.1.4' import logging -logging.basicConfig(filename='neurofield.log', level=logging.INFO, +logging.basicConfig(filename='nftsim.log', level=logging.INFO, format='%(asctime)s:%(levelname)s:%(message)s') LOG = logging.getLogger(__name__) import os @@ -90,7 +90,7 @@ def __init__(self, nf_output_file): def __repr__(self): out = '' - out += 'NeuroField output\n' + out += 'NFTsim output\n' out += 'Traces: %s\n' % (', '.join(self.fields)) out += 'Start time: %f\n' % (self.time[0]) out += 'Stop time: %f\n' % (self.time[-1]) @@ -139,17 +139,17 @@ def read_conf(self, fid): conf = {} return (conf, skiprows) -def run(filename, neurofield_path='./bin/neurofield'): +def run(filename, nftsim_path='./bin/nftsim'): """ - Run neurofield and store output in NF object... + Run nftsim and store output in NF object... """ filename = filename.replace('.conf', '') - cmd = '%s -i %s.conf -o %s.output' % (neurofield_path, filename, filename) - LOG.info('Running neurofield with command: \n %s \n' % cmd) + cmd = '%s -i %s.conf -o %s.output' % (nftsim_path, filename, filename) + LOG.info('Running nftsim with command: \n %s \n' % cmd) result = os.system(cmd) if result: - LOG.error('The execution of NeuroField did not finish cleanly.') + LOG.error('The execution of NFTsim did not finish cleanly.') sys.exit() else: LOG.info('\nFinished. Output file was written to %s.output\n' % filename)