From 36e0340bd118ca036c1b0c0a0e97bb18050e96de Mon Sep 17 00:00:00 2001 From: Olivier Sauter <olivier.sauter@epfl.ch> Date: Fri, 26 Apr 2019 09:34:31 +0000 Subject: [PATCH] debugged core_profiles and added/tested to zcv2ids2database git-svn-id: https://spcsvn.epfl.ch/repos/TCV/gdat/trunk@11795 d63d8f72-b253-0410-a779-e742ad2e26cf --- crpptbx/TCV_IMAS/tcv2ids.m | 4 ++-- crpptbx/TCV_IMAS/tcv2ids2database.m | 10 ++++++++-- crpptbx/TCV_IMAS/tcv_get_ids_core_profiles.m | 8 ++++---- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/crpptbx/TCV_IMAS/tcv2ids.m b/crpptbx/TCV_IMAS/tcv2ids.m index bd3289a7..1e6ea138 100644 --- a/crpptbx/TCV_IMAS/tcv2ids.m +++ b/crpptbx/TCV_IMAS/tcv2ids.m @@ -11,7 +11,7 @@ function [ids_from_tcv,varargout] = tcv2ids(shot,varargin); % mdsconnect('localhost:5555') % % varargin{1}: ids to load, by default all defined so far (if empty or empty string or not given) -% {'equilibrium', 'magnetics', 'pf_active','wall'} or a subset +% {'equilibrium', 'magnetics', 'pf_active','wall','core_profiles'} or a subset % % varargout{1}: return also the ids in array of structure with the names, to allow easy use of plotallids % @@ -21,7 +21,7 @@ p = inputParser; % no required inputs here so one can call with empty args and get defaults parameters % effectively required inputs should have defaults as empty p.addOptional('shot', [], @(x) (isnumeric(x) && isscalar(x) && (x == round(x)))); % integer -p.addOptional('ids_names', {'equilibrium', 'magnetics', 'pf_active','wall', 'tf'}, @(x) isempty(x) | (ischar(x) || iscell(x))); % char or cell array +p.addOptional('ids_names', {'equilibrium', 'magnetics', 'pf_active','wall', 'tf','core_profiles'}, @(x) isempty(x) | (ischar(x) || iscell(x))); % char or cell array p.parse; defaults_tcv2ids = p.Results; % to keep track of defaults diff --git a/crpptbx/TCV_IMAS/tcv2ids2database.m b/crpptbx/TCV_IMAS/tcv2ids2database.m index 1aeb4eef..677a4ea2 100644 --- a/crpptbx/TCV_IMAS/tcv2ids2database.m +++ b/crpptbx/TCV_IMAS/tcv2ids2database.m @@ -2,12 +2,18 @@ % script to get TCV data as ids and then write them on the database % +mdsconnect('localhost:5555'); +aa=mdsvalue('1+2'); +if aa ~= 3 + error('problem with mdsconnect?'); +end + shot=40000; shot=62745; -run_out=999; +run_out=1; occurence=0; -ids2get = {'equilibrium', 'magnetics', 'pf_active','wall'}; % default will load all defined so far +ids2get = {'equilibrium', 'magnetics', 'pf_active','wall','core_profiles'}; % default will load all defined so far [ids_from_tcv,idsok] = tcv2ids(shot,ids2get); %% can plot with: [plotids_H] = plotids([],idsok.ids{1},idsok.ids{2}); diff --git a/crpptbx/TCV_IMAS/tcv_get_ids_core_profiles.m b/crpptbx/TCV_IMAS/tcv_get_ids_core_profiles.m index 6668273e..2a7dd14e 100644 --- a/crpptbx/TCV_IMAS/tcv_get_ids_core_profiles.m +++ b/crpptbx/TCV_IMAS/tcv_get_ids_core_profiles.m @@ -114,13 +114,13 @@ for it=1:length(ids_cores_profiles.time) ids_cores_profiles.profiles_1d{it}.electrons.temperature_fit.measured_error_upper = temp_1d.te_rho.error_bar(:,it_thom(it)); ids_cores_profiles.profiles_1d{it}.electrons.temperature_fit.time_measurement = temp_1d.te_rho.t(it_thom(it)); ids_cores_profiles.profiles_1d{it}.electrons.temperature_fit.rho_tor_norm = temp_1d.te_rho.grids_1d.rhotornorm(:,it_thom(it)); - ids_cores_profiles.profiles_1d{it}.electrons.temperature_fit.source = 'Thomson, interpos fit'; + ids_cores_profiles.profiles_1d{it}.electrons.temperature_fit.source = {'Thomson, interpos fit'}; ids_cores_profiles.profiles_1d{it}.electrons.density = temp_1d.fit.ne_rho.data(:,it); ids_cores_profiles.profiles_1d{it}.electrons.density_fit.measured = temp_1d.ne_rho.data(:,it_thom(it)); ids_cores_profiles.profiles_1d{it}.electrons.density_fit.measured_error_upper = temp_1d.ne_rho.error_bar(:,it_thom(it)); ids_cores_profiles.profiles_1d{it}.electrons.density_fit.time_measurement = temp_1d.ne_rho.t(it_thom(it)); ids_cores_profiles.profiles_1d{it}.electrons.density_fit.rho_tor_norm = temp_1d.ne_rho.grids_1d.rhotornorm(:,it_thom(it)); - ids_cores_profiles.profiles_1d{it}.electrons.density_fit.source = 'Thomson, interpos fit'; + ids_cores_profiles.profiles_1d{it}.electrons.density_fit.source = {'Thomson, interpos fit'}; ids_cores_profiles.profiles_1d{it}.electrons.pressure_thermal = 1.6022e-19.*ids_cores_profiles.profiles_1d{it}.electrons.density ... .* ids_cores_profiles.profiles_1d{it}.electrons.temperature; end @@ -168,9 +168,9 @@ if ~isempty(temp_1d.cxrs_rho.ti.fit.data) it_raw = iround_os(temp_1d.ti.raw.t,ids_cores_profiles.time); for it=1:length(ids_cores_profiles.time) % ids_cores_profiles.profiles_1d{it}.ion{1}.temperature_fit = temp_1d.ti.fit(:,it_ti(it)); - ids_cores_profiles.profiles_1d{it}.ion{1}.density_fit.source = 'from Zeff and ne profile'; + ids_cores_profiles.profiles_1d{it}.ion{1}.density_fit.source = {'from Zeff and ne profile'}; ids_cores_profiles.profiles_1d{it}.t_i_average_fit.measured = temp_1d.ti.raw.data(:,it_raw(it)); - ids_cores_profiles.profiles_1d{it}.t_i_average_fit.source = 'from CXRS on C usually'; + ids_cores_profiles.profiles_1d{it}.t_i_average_fit.source = {'from CXRS on C usually'}; end end -- GitLab