-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathfix_path.m
More file actions
108 lines (81 loc) · 2.97 KB
/
fix_path.m
File metadata and controls
108 lines (81 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
% Spinach setup script. Nobody ever reads the documentation,
% so hopefully they would see this function and run it. If
% no input arguments are supplied, that means the user did
% not even read this header - oy vey, then we assume a PhD
% student with a laptop. Otherwise, there are a few specific
% config options for different system types. Syntax:
%
% fix_path(config_style)
%
% ilya.kuprov@weizmann.ac.il
%
% <https://spindynamics.org/wiki/index.php?title=fix_path.m>
function fix_path(config_style)
% Default config style
if ~exist('config_style','var')
config_style='noob';
end
% Check consistency
grumble(config_style);
% Run the configuration
switch config_style
case {'noob','reset'}
% Status report
disp('Resetting Matlab path...');
% Reset Matlab path to default
restoredefaultpath();
% Status report
disp('Updating Matlab path...');
% Add Spinach directories to path
addpath(genpath('etc'),'-begin');
addpath(genpath('experiments'),'-begin');
addpath(genpath('interfaces'),'-begin');
addpath(genpath('kernel'),'-begin');
% Run existential checks
existentials();
% Report to the console
disp('Spinach is ready to run.');
case 'add'
% Status report
disp('Updating Matlab path...');
% Keep revious path, add Spinach
addpath(genpath('etc'),'-begin');
addpath(genpath('experiments'),'-begin');
addpath(genpath('interfaces'),'-begin');
addpath(genpath('kernel'),'-begin');
% Run existential checks
existentials();
% Report to the console
disp('Spinach is ready to run.');
case 'remove'
% Status report
disp('Updating Matlab path...');
% Keep revious path, remove Spinach
rmpath(genpath('etc'));
rmpath(genpath('experiments'));
rmpath(genpath('interfaces'));
rmpath(genpath('kernel'));
% Report to the console
disp('Spinach folders have been removed from Matlab path.');
otherwise
% Complain and bomb out
error('unknown configuration style.');
end
end
% Consistency enforcement
function grumble(config_style)
if ~ischar(config_style)
error('config_style must be a character string.');
end
end
% Listening to Dirac was a dreadful experience. We accepted Dirac's ideas
% and fell under their influence only when we read his papers. But at a
% seminar... Dirac would come in, no smile, no enthusiasm. He would take a
% piece of chalk in his long fingers and start writing formulae on the
% board, without saying a word. After a while, Born couldn't stand it:
% "Paul, tell us, what are you writing?" Dirac, still writing, reluctantly
% started to speak: "W minus alpha ar pi ar minus alpha zero m c and all
% this multiplied by psi, then alpha mu by alpha nu..." and so on in the
% same vein - and he sincerely believed that he was explaining.
%
% Yuri B. ("Georg") Rumer