https://hal.archives-ouvertes.fr/hal-02960741
Raw File
Tip revision: a402d485d58ae710ace7c0c1477caf73137c2d28 authored by Software Heritage on 31 December 2012, 00:00:00 UTC
hal: Deposit 1060 in collection hal
Tip revision: a402d48
setup_once.m
function setup_once(varargin)

%%  Setup 
% 
%   Will automatically download and install needed toolboxes, and download
%   data (approximately 4 GB)
% 
%   For this function an internet connection is required.  

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                        
% Nearfield ACoustic HOlography with Sparse regularization (NACHOS)
% Version 1.0                                    
%     
% Copyright 2012 Antoine Peillot, Fran蔞is Ollivier, Gilles Chardon, 
%                Laurent Daudet, Nancy Bertin, R幦i Gribonval
% 
% For all details please refer to README.TXT
%
% This software is a free software distributed under the terms of the GNU 
% Public License version 3 (http://www.gnu.org/licenses/gpl.txt). You can 
% redistribute it and/or modify it under the terms of this licence.                                        
%                                                                                                                                                      
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

clc;

FS=filesep;

fprintf('\n ********************************************************************');
fprintf('\n\n This script will install all you need to reproduce the figures\n from the paper');
fprintf('\n\n "Nearfield Acoustic Holography using sparse regularization and\n compressive sampling principles"');
fprintf('\n\n by G. Chardon, A. Peillot, F. Ollivier, N. Bertin, R. Gribonval, and L. Daudet');
fprintf('\n\n accepted for publication in the Journal of Acoustical Society of America (JASA)');
fprintf('\n\n It contains the following toolboxes:');
fprintf('\n Sparsify Toolbox version 0.4');
fprintf('\n SPGL1 version 1.7');
fprintf('\n\n ********************************************************************');

fprintf('\n\n The toolbox will be installed in: ');
fprintf('\n %s%s\n',pwd,FS);

fprintf('\n ********************************************************************');
fprintf('\n\n IMPORTANT: YOU MUST HAVE AN INTERNET CONNECTION');
fprintf('\n YOU CANNOT INSTALL THIS TOOLBOX WITHOUT ONE!');
fprintf('\n BEWARE: the download can be long (4 GB)');
fprintf('\n\n ********************************************************************');
install_ack = input('\n\n Do you wish to continue: ([y]/n)? ','s');

if strcmp(install_ack,'"n"'),
  install_ack = 'n';
end

if install_ack == 'n',
  return;
else
  fprintf('\n\n Installation now beginning...');

end


thisPath=pwd;
thisSubPaths=genpath(thisPath);
addpath(thisSubPaths);


%% Load sparsify

if ~exist('greed_pcgp.m','file')
    fprintf('\n ******************************************************************');
    fprintf('\n\n Initialising Sparsify Setup');
    
    try
        Sparsify_path = [pwd,FS,'toolbox',FS,'sparsify'];
        if exist([Sparsify_path, FS, 'sparsify_0_4.zip'],'file'),
            Sparsify_zip=[Sparsify_path, FS, 'sparsify_0_4.zip'];
        else
            Sparsify_zip='http://www.see.ed.ac.uk/~tblumens/sparsify/sparsify_0_4.zip';
            fprintf('\n\n Downloading toolbox, please be patient\n\n');
        end
        unzip(Sparsify_zip,Sparsify_path);
        Sparsify_p=genpath(Sparsify_path);
        addpath(Sparsify_p);
        fprintf('\n Sparsify Installation Successful\n');
    catch
        fprintf('\n Sparsify Installation Failed\n');
    end
    cd(thisPath);
else
    fprintf('\n ******************************************************************');
    fprintf('\n\n Sparsify is already installed');
end

%% Load SPGL1

if ~exist('spg_bpdn.m','file')
    fprintf('\n ******************************************************************');
    fprintf('\n\n Initialising SPGL1 Setup');
    
    try
        Spg_path = [pwd,FS,'toolbox',FS];
       if exist([Spg_path, FS, 'spgl1-1.7.zip'],'file'),
           Spg_zip=[Spg_path, FS, 'spgl1-1.7.zip'];
       else
            Spg_zip='http://www.cs.ubc.ca/~mpf/downloads/spgl1-1.7.zip';
            fprintf('\n\n Downloading toolbox, please be patient\n\n');
       end
        unzip(Spg_zip,Spg_path);
        Spg_p=genpath(Spg_path);
        addpath(Spg_p);
        fprintf('\n SPGL1 Installation Successful\n');
    catch
        fprintf('\n SPGL1 Installation Failed\n');
    end
    cd(thisPath);
else
    fprintf('\n ******************************************************************');
    fprintf('\n\n SPGL1 is already installed');
end

%% Load data files
%% debug test

if ~exist('VibroSig.dat','file')
    fprintf('\n ******************************************************************');
    fprintf('\n\n Initialising Data Download');
    
    try
        data_path = [pwd,FS,'data',FS];
       if exist([data_path, FS, 'nachosdb.zip'],'file'),
           data_zip=[data_path, FS, 'nachosdb.zip'];
       else
            data_zip='ftp://ftp.irisa.fr/local/nachos/nachosdb.zip';
            fprintf('\n\n Downloading data, please be patient\n\n');
       end
        unzip(data_zip,data_path);
        data_p=genpath(data_path);
        addpath(data_p);
        fprintf('\n Data download successful\n');
    catch
        fprintf('\n Data download failed\n');
	fprintf('\n The data was made available online in 2012 on the repository\n');
	fprintf('\n     ftp://ftp.irisa.fr/local/nachos/nachosdb.zip \n');
	fprintf('\n In 2020 it was attributed a DOI on Zenodo\n');
	fprintf('\n     https://doi.org/10.5281/zenodo.4113940\n');
    end
    cd(thisPath);
else
    fprintf('\n ******************************************************************');
    fprintf('\n\n Data is already downloaded');
end

fprintf('\n ******************************************************************');
fprintf('\n\n Installation Complete!');


fprintf('\n\n For more information on the installed toolboxes see');
fprintf('\n\n Sparsify: http://www.see.ed.ac.uk/~tblumens/sparsify/sparsify.html');
fprintf('\n\n SPGL1: http://www.cs.ubc.ca/labs/scl/spgl1/');
fprintf('\n\n ******************************************************************');
fprintf('\n\n');
back to top