From a403e148053b3746490d8e93fbf83ebaad90fe4a Mon Sep 17 00:00:00 2001
From: Olivier Sauter <olivier.sauter@epfl.ch>
Date: Thu, 31 Jan 2019 15:41:54 +0000
Subject: [PATCH] add homogenous_time in options

git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@11383 d63d8f72-b253-0410-a779-e742ad2e26cf
---
 crpptbx/TCV_IMAS/tcv_get_ids_magnetics.m |  4 ++--
 crpptbx/TCV_IMAS/tcv_get_ids_pf_active.m |  2 +-
 crpptbx/TCV_IMAS/tcv_ids_headpart.m      | 10 +++++++++-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/crpptbx/TCV_IMAS/tcv_get_ids_magnetics.m b/crpptbx/TCV_IMAS/tcv_get_ids_magnetics.m
index 9a8720af..883da13a 100644
--- a/crpptbx/TCV_IMAS/tcv_get_ids_magnetics.m
+++ b/crpptbx/TCV_IMAS/tcv_get_ids_magnetics.m
@@ -3,11 +3,11 @@ function [ids_magnetics,ids_magnetics_description,varargout] = tcv_get_ids_magne
 %  [ids_equilibrium,ids_equilibrium_description,varargout] = get_ids_equilibrium_fixed_boundary(shot,varargin);
 %
 
-[ids_magnetics, params_magnetics] = tcv_ids_headpart(shot, ids_magnetics_empty,'magnetics',varargin{:});
+[ids_magnetics, params_magnetics] = tcv_ids_headpart(shot, ids_magnetics_empty,'magnetics','homogeneous_time',0,varargin{:});
 
 [ids_magnetics.bpol_probe]= tcv_get_ids_bpol_probe(params_magnetics.shot, ids_magnetics.bpol_probe(1));
 [ids_magnetics.flux_loop]= tcv_get_ids_flux_loop(params_magnetics.shot, ids_magnetics.flux_loop(1));
 [ids_magnetics.method]= tcv_get_ids_ip(params_magnetics.shot, ids_magnetics.method(1));
 
 %% Temporarely documentation
-ids_magnetics_description = struct([]);
\ No newline at end of file
+ids_magnetics_description = struct([]);
diff --git a/crpptbx/TCV_IMAS/tcv_get_ids_pf_active.m b/crpptbx/TCV_IMAS/tcv_get_ids_pf_active.m
index a2e36745..e78660c2 100644
--- a/crpptbx/TCV_IMAS/tcv_get_ids_pf_active.m
+++ b/crpptbx/TCV_IMAS/tcv_get_ids_pf_active.m
@@ -1,7 +1,7 @@
 function [ids_pf_active,ids_description,varargout] = tcv_get_ids_pf_active(shot, ids_pf_active_empty, varargin)
 
 % Input pharser
-[ids_pf_active, params] = tcv_ids_headpart(shot, ids_pf_active_empty,'pf_active',varargin{:});
+[ids_pf_active, params] = tcv_ids_headpart(shot, ids_pf_active_empty,'pf_active','homogeneous_time',0,varargin{:});
 
 % Get subfield
 [ids_pf_active.coil]= tcv_get_ids_coil(params.shot, ids_pf_active.coil(1));
diff --git a/crpptbx/TCV_IMAS/tcv_ids_headpart.m b/crpptbx/TCV_IMAS/tcv_ids_headpart.m
index 2b49b353..90914a7a 100644
--- a/crpptbx/TCV_IMAS/tcv_ids_headpart.m
+++ b/crpptbx/TCV_IMAS/tcv_ids_headpart.m
@@ -4,6 +4,13 @@ function [ids_generic, params_ids_generic] = tcv_ids_headpart(shot,ids_in,ids_na
 %
 % parses inputs and fill in ids_properties
 %
+%
+% varargin options:
+%
+% 'comment': comment to include in ids_properties
+% 'homogeneous_time': homogeneous_time in ids_properties: 1 (default) if the whole ids has same time, 0 otherwise
+%
+%
 % example:
 %   [ids_equilibrium, params_ids_equilibrium] = tcv_ids_headpart(shot,ids_equil_empty,'equilibrium','comment','your comment');
 %
@@ -17,6 +24,7 @@ p.addOptional('shot', [], @(x) (isnumeric(x) && isscalar(x) && (x == round(x))))
 p.addOptional('ids_in', struct([]), @(x) (isstruct(x)));
 p.addOptional('ids_name', '', @(x) (ischar(x))); % char
 p.addOptional('comment', 'default comment', @(x) isempty(x) || ischar(x)); % char
+p.addOptional('homogeneous_time', 1, @(x) (isnumeric(x) && isscalar(x) && (x == round(x))));
 
 p.parse(shot,ids_in,ids_name);
 defaults_ids_generic = p.Results; % to keep track of defaults
@@ -41,7 +49,7 @@ ids_generic = ids_in;
 % ids_properties
 %
 ids_generic.ids_properties.comment = params_ids_generic.comment;
-ids_generic.ids_properties.homogeneous_time = 1;
+ids_generic.ids_properties.homogeneous_time = params_ids_generic.homogeneous_time;
 ids_generic.ids_properties.source = ['TCV shot #' num2str(params_ids_generic.shot)];
 ids_generic.ids_properties.provider = ['tcv_get_ids_' ids_name];
 ids_generic.ids_properties.creation_date = date;
-- 
GitLab