From 71016935208b9dcb31ae432d0d795cb7e9081737 Mon Sep 17 00:00:00 2001
From: Francesco Carpanese <francesco.carpanese@epfl.ch>
Date: Thu, 31 Jan 2019 10:14:14 +0000
Subject: [PATCH] commit script to get IDS

git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@11365 d63d8f72-b253-0410-a779-e742ad2e26cf
---
 crpptbx/TCV_IMAS/magnetics/imasget_bpol_probe.m | 10 ++++------
 crpptbx/TCV_IMAS/magnetics/imasget_flux_loop.m  | 13 +++++--------
 crpptbx/TCV_IMAS/magnetics/imasget_ip.m         |  6 +++---
 crpptbx/TCV_IMAS/pf_active/imasget_circuit.m    |  7 ++-----
 crpptbx/TCV_IMAS/pf_active/imasget_coil.m       |  4 ++--
 5 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/crpptbx/TCV_IMAS/magnetics/imasget_bpol_probe.m b/crpptbx/TCV_IMAS/magnetics/imasget_bpol_probe.m
index fa270431..591cfe03 100644
--- a/crpptbx/TCV_IMAS/magnetics/imasget_bpol_probe.m
+++ b/crpptbx/TCV_IMAS/magnetics/imasget_bpol_probe.m
@@ -1,18 +1,16 @@
 function [ids_struct_out] =  imasget_bpol_probe(shot, ids_structures)
-% Get bpol probes
+% Get magnetics.bpol_probe
 
-ids_struct_out = {};
 mdsopen(shot);
 tmp = gdat( shot, '\MAGNETICS::BPOL_003');
 
-% Get dimension
-Nprobes = size(tmp.data,2);
-Ntime   = size(tmp.data,1);
+% Get data
 names = tmp.dim{2};
 time = tmp.dim{1};
 data = tmp.data;
 
-% Preallocate dimension
+% Preallocate output structure
+Nprobes = size(tmp.data,2);
 ids_struct_out(1:Nprobes) = ids_structures.magnetics.bpol_probe(1);
 
 
diff --git a/crpptbx/TCV_IMAS/magnetics/imasget_flux_loop.m b/crpptbx/TCV_IMAS/magnetics/imasget_flux_loop.m
index 4bdfa150..0aaef7c0 100644
--- a/crpptbx/TCV_IMAS/magnetics/imasget_flux_loop.m
+++ b/crpptbx/TCV_IMAS/magnetics/imasget_flux_loop.m
@@ -1,21 +1,18 @@
 function ids_struct_out = imasget_flux_loop(shot, ids_structures)
-% Get the bpol_probe signals into IDS structure
+% Get ids field magnetics.fluxx_loop 
 
-ids_struct_out = {};
+% Get data 
 mdsopen(shot);
 tmp = gdat(shot, 'tcv_idealloop("FLUX")');
-
-% Get dimension
-Nprobes = size(tmp.data,2);
-Ntime   = size(tmp.data,1);
 names = tmp.dim{2};
 time = tmp.dim{1};
 data = tmp.data;
 
-% Preallocate dimension
+% Preallocate output structure
+Nprobes = size(tmp.data,2);
 ids_struct_out(1:Nprobes) = ids_structures.magnetics.flux_loop(1);
 
-% Get all the data
+% Put data on ids structure
 for ii=1:Nprobes
     ids_struct_out{ii}.name  = [names{ii}];
     ids_struct_out{ii}.position{1}.r  = mdsvalue('STATIC("R_F"  )[$1]',ids_struct_out{ii}.name);
diff --git a/crpptbx/TCV_IMAS/magnetics/imasget_ip.m b/crpptbx/TCV_IMAS/magnetics/imasget_ip.m
index 46bf07d4..93bbdacc 100644
--- a/crpptbx/TCV_IMAS/magnetics/imasget_ip.m
+++ b/crpptbx/TCV_IMAS/magnetics/imasget_ip.m
@@ -1,16 +1,16 @@
 function [ids_struct_out] = imasget_ip(shot, ids_structures)
-% Get the bpol_probe signals into IDS structure
+% Get magnetics.method{1}.ip
 
 mdsopen(shot);
 tmp = gdat( shot, 'ip_trapeze');
 
-% Get dimension
-Ntime   = size(tmp.data,1);
 time = tmp.dim{1};
 data = tmp.data;
 
 % Preallocate dimension
 ids_struct_out = ids_structures.magnetics.method(1);
+
+% Put data into ids structure
 ids_struct_out{1}.ip.data = data;
 ids_struct_out{1}.ip.time = time;
 
diff --git a/crpptbx/TCV_IMAS/pf_active/imasget_circuit.m b/crpptbx/TCV_IMAS/pf_active/imasget_circuit.m
index eefd036b..c3644aa2 100644
--- a/crpptbx/TCV_IMAS/pf_active/imasget_circuit.m
+++ b/crpptbx/TCV_IMAS/pf_active/imasget_circuit.m
@@ -1,11 +1,13 @@
 function [ids_struct_out] =  imasget_circuit(shot, ids_structures)
 
 mdsopen(shot)
+
 %% Get power supply/coils names for each circuit.
 [coil_names2ids, power_supply_names2ids, circuit_names2ids, mds_paths2ids, ~] =  pf_active_definition();
 % Get dimension
 ncircuits2ids = numel(circuit_names2ids);
 
+% Preallocate memory and get data
 ids_struct_out(1:ncircuits2ids) = ids_structures.pf_active.circuit(1);
 for ii=1:ncircuits2ids
     
@@ -13,14 +15,9 @@ for ii=1:ncircuits2ids
     ids_struct_out{ii}.current.data = tmpdata.data;
     ids_struct_out{ii}.current.time = tmpdata.dim{1};
     
-    
     %ids_struct_out{ii}.connection = 
-    
-    
 end
 
-
-
 %%
 %{
 % 19 circuits + TF (19 rectifiers power supplies) + FPS
diff --git a/crpptbx/TCV_IMAS/pf_active/imasget_coil.m b/crpptbx/TCV_IMAS/pf_active/imasget_coil.m
index 2f72aeef..49a73a28 100644
--- a/crpptbx/TCV_IMAS/pf_active/imasget_coil.m
+++ b/crpptbx/TCV_IMAS/pf_active/imasget_coil.m
@@ -4,10 +4,10 @@ function [ids_struct_out] =  imasget_coil(shot, ids_structures)
 % TODO add logic to get the current in the coils only onces.
 
 % Coils that can be characterized by R, Z and a 
-% crosssectional area are described as distinct coils with a single element this also corresponds to coils with distinct TCV names). 
+% crosssectional area are described as distinct coils with a single element, this also corresponds to coils with distinct TCV names). 
 % Elements can be used in the future to refine the spatial 
 % description of each coil. 
-% the circular conductor of G-coils approximated by a square of equal 
+% The circular conductor of G-coils approximated by a square of equal 
 % crosssectional area.
 % Each coil has a positive turnsign. The return current in T_003 is 
 % dealt with in the circuit description and in the machine mapping. 
-- 
GitLab