Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SCDDS-core
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SPC
SCDDS
SCDDS-core
Commits
0537cbbb
Commit
0537cbbb
authored
4 years ago
by
Cristian Galperti
Browse files
Options
Downloads
Patches
Plain Diff
wavegen loader classes tolerates errors during actualization
issuing a warning
parent
866e1df1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
code/classes/SCDclass_mdswgsigarray1.m
+48
-45
48 additions, 45 deletions
code/classes/SCDclass_mdswgsigarray1.m
code/classes/SCDclass_mdswgsigsingle.m
+40
-37
40 additions, 37 deletions
code/classes/SCDclass_mdswgsigsingle.m
with
88 additions
and
82 deletions
code/classes/SCDclass_mdswgsigarray1.m
+
48
−
45
View file @
0537cbbb
...
...
@@ -46,53 +46,56 @@ classdef SCDclass_mdswgsigarray1 < SCDclass_mdswg
methods
function
actualizedata
(
obj
,
shot
)
mdsconnect
(
obj
.
mdsserver
);
mdsopen
(
obj
.
mdstree
,
shot
);
targetfullexpansion
=
[
obj
.
wavegenbasestruct
,
'.'
,
obj
.
wavegentarget
];
if
obj
.
verbose
==
1
fprintf
(
'Actualizing wavegen:
''
%s
''
[%d,%d] <-
''
%s
''
[%d,%d] (%s, shot %d)\n'
,
...
targetfullexpansion
,
obj
.
deststartidx
,
obj
.
deststopidx
,
...
obj
.
tdiexpr
,
obj
.
srcstartidx
,
obj
.
srcstopidx
,
...
obj
.
classname
,
shot
);
end
sourceidxs
=
obj
.
srcstartidx
:
obj
.
srcstopidx
;
destidxs
=
obj
.
deststartidx
:
obj
.
deststopidx
;
assert
(
numel
(
sourceidxs
)
==
numel
(
destidxs
),
'SCDclass_mdswgsigarray1: destination channel count is different w.r.t. source'
);
value
=
obj
.
getdata
();
baseparam
=
obj
.
wavegenbasestruct
;
structparam
=
obj
.
wavegentarget
;
wgentryval
=
evalin
(
'base'
,
baseparam
);
getcurrenttssize
=
sprintf
(
'ddtssamples=numel(wgentryval.%s.Time);'
,
structparam
);
eval
(
getcurrenttssize
);
if
(
ddtssamples
~=
numel
(
value
.
Time
))
% the dd timeseries has different dims w.r.t. the signals
% to be loaded, we have to load the timeseries as it is
assigncmd
=
sprintf
(
'wgentryval.%s=value;'
,
structparam
);
eval
(
assigncmd
);
else
% the dd timeseries has the same size than the signals
% to be loaded, we can do a partial loading
assigncmdtime
=
sprintf
(
'wgentryval.%s.Time=value.Time;'
,
structparam
);
assigncmddata
=
sprintf
(
'wgentryval.%s.Data(:,%d:%d)=value.Data;'
,
structparam
,
obj
.
deststartidx
,
obj
.
deststopidx
);
eval
(
assigncmdtime
);
eval
(
assigncmddata
);
end
try
mdsconnect
(
obj
.
mdsserver
);
mdsopen
(
obj
.
mdstree
,
shot
);
assignin
(
'base'
,
'temp'
,
wgentryval
);
assigncmd
=
sprintf
(
'%s=temp;'
,
baseparam
);
evalin
(
'base'
,
assigncmd
);
evalin
(
'base'
,
'clear temp'
);
targetfullexpansion
=
[
obj
.
wavegenbasestruct
,
'.'
,
obj
.
wavegentarget
];
if
obj
.
verbose
==
1
fprintf
(
'Actualizing wavegen:
''
%s
''
[%d,%d] <-
''
%s
''
[%d,%d] (%s, shot %d)\n'
,
...
targetfullexpansion
,
obj
.
deststartidx
,
obj
.
deststopidx
,
...
obj
.
tdiexpr
,
obj
.
srcstartidx
,
obj
.
srcstopidx
,
...
obj
.
classname
,
shot
);
end
sourceidxs
=
obj
.
srcstartidx
:
obj
.
srcstopidx
;
destidxs
=
obj
.
deststartidx
:
obj
.
deststopidx
;
assert
(
numel
(
sourceidxs
)
==
numel
(
destidxs
),
'SCDclass_mdswgsigarray1: destination channel count is different w.r.t. source'
);
value
=
obj
.
getdata
();
baseparam
=
obj
.
wavegenbasestruct
;
structparam
=
obj
.
wavegentarget
;
wgentryval
=
evalin
(
'base'
,
baseparam
);
getcurrenttssize
=
sprintf
(
'ddtssamples=numel(wgentryval.%s.Time);'
,
structparam
);
eval
(
getcurrenttssize
);
if
(
ddtssamples
~=
numel
(
value
.
Time
))
% the dd timeseries has different dims w.r.t. the signals
% to be loaded, we have to load the timeseries as it is
assigncmd
=
sprintf
(
'wgentryval.%s=value;'
,
structparam
);
eval
(
assigncmd
);
else
% the dd timeseries has the same size than the signals
% to be loaded, we can do a partial loading
assigncmdtime
=
sprintf
(
'wgentryval.%s.Time=value.Time;'
,
structparam
);
assigncmddata
=
sprintf
(
'wgentryval.%s.Data(:,%d:%d)=value.Data;'
,
structparam
,
obj
.
deststartidx
,
obj
.
deststopidx
);
eval
(
assigncmdtime
);
eval
(
assigncmddata
);
end
assignin
(
'base'
,
'temp'
,
wgentryval
);
assigncmd
=
sprintf
(
'%s=temp;'
,
baseparam
);
evalin
(
'base'
,
assigncmd
);
evalin
(
'base'
,
'clear temp'
);
catch
warning
(
'SCDclass_mdswgsigsingle:actualizationerror'
,
'Actualization error for wavegen %s. Actualization skipped.'
,
obj
.
wavegentarget
);
end
end
function
value
=
getdata
(
obj
)
...
...
This diff is collapsed.
Click to expand it.
code/classes/SCDclass_mdswgsigsingle.m
+
40
−
37
View file @
0537cbbb
...
...
@@ -33,45 +33,48 @@ classdef SCDclass_mdswgsigsingle < SCDclass_mdswg
methods
function
actualizedata
(
obj
,
shot
)
mdsconnect
(
obj
.
mdsserver
);
mdsopen
(
obj
.
mdstree
,
shot
);
targetfullexpansion
=
[
obj
.
wavegenbasestruct
,
'.'
,
obj
.
wavegentarget
];
if
obj
.
verbose
==
1
fprintf
(
'Actualizing wavegen:
''
%s
''
[%d] <-
''
%s
''
(%s, shot %d)\n'
,
...
targetfullexpansion
,
obj
.
destidx
,
...
obj
.
tdiexpr
,
...
obj
.
classname
,
shot
);
end
value
=
obj
.
getdata
();
try
mdsconnect
(
obj
.
mdsserver
);
mdsopen
(
obj
.
mdstree
,
shot
);
baseparam
=
obj
.
wavegenbasestruct
;
% name of base workspace structure
structparam
=
obj
.
wavegentarget
;
% name of target field
wgentryval
=
evalin
(
'base'
,
baseparam
);
% structure of wavegen in base workspace
assert
(
isfield
(
wgentryval
,
structparam
),
...
'Wavegen field %s does not exist in target structure %s. '
,
structparam
,
baseparam
)
% assign field from wavegen entry value
ddtssamples
=
numel
(
wgentryval
.
(
structparam
)
.
Time
);
if
ddtssamples
~=
numel
(
value
.
Time
)
% the dd timeseries has different dims w.r.t. the signals
% to be loaded, we have to load the timeseries as it is
wgentryval
.
(
structparam
)
=
value
;
else
% the dd timeseries has the same size than the signals
% to be loaded, we can do a partial loading
wgentryval
.
(
structparam
)
.
Time
=
value
.
Time
;
wgentryval
.
(
structparam
)
.
Data
(:,
obj
.
destidx
)
=
value
.
Data
;
end
assignin
(
'base'
,
'temp'
,
wgentryval
);
assigncmd
=
sprintf
(
'%s=temp;'
,
baseparam
);
evalin
(
'base'
,
assigncmd
);
evalin
(
'base'
,
'clear temp'
);
targetfullexpansion
=
[
obj
.
wavegenbasestruct
,
'.'
,
obj
.
wavegentarget
];
if
obj
.
verbose
==
1
fprintf
(
'Actualizing wavegen:
''
%s
''
[%d] <-
''
%s
''
(%s, shot %d)\n'
,
...
targetfullexpansion
,
obj
.
destidx
,
...
obj
.
tdiexpr
,
...
obj
.
classname
,
shot
);
end
value
=
obj
.
getdata
();
baseparam
=
obj
.
wavegenbasestruct
;
% name of base workspace structure
structparam
=
obj
.
wavegentarget
;
% name of target field
wgentryval
=
evalin
(
'base'
,
baseparam
);
% structure of wavegen in base workspace
assert
(
isfield
(
wgentryval
,
structparam
),
...
'Wavegen field %s does not exist in target structure %s. '
,
structparam
,
baseparam
)
% assign field from wavegen entry value
ddtssamples
=
numel
(
wgentryval
.
(
structparam
)
.
Time
);
if
ddtssamples
~=
numel
(
value
.
Time
)
% the dd timeseries has different dims w.r.t. the signals
% to be loaded, we have to load the timeseries as it is
wgentryval
.
(
structparam
)
=
value
;
else
% the dd timeseries has the same size than the signals
% to be loaded, we can do a partial loading
wgentryval
.
(
structparam
)
.
Time
=
value
.
Time
;
wgentryval
.
(
structparam
)
.
Data
(:,
obj
.
destidx
)
=
value
.
Data
;
end
assignin
(
'base'
,
'temp'
,
wgentryval
);
assigncmd
=
sprintf
(
'%s=temp;'
,
baseparam
);
evalin
(
'base'
,
assigncmd
);
evalin
(
'base'
,
'clear temp'
);
catch
warning
(
'SCDclass_mdswgsigsingle:actualizationerror'
,
'Actualization error for wavegen %s. Actualization skipped.'
,
obj
.
wavegentarget
);
end
end
function
value
=
getdata
(
obj
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment