Skip to content
Snippets Groups Projects
Commit 4ae4c0d1 authored by Luke Simons's avatar Luke Simons
Browse files

Revert changes to tcv2ids and adding tcv_get_deploymentinfo.m

parent 490db962
No related branches found
No related tags found
1 merge request!174Add tcv get ids soft x rays to tcv imas functions
......@@ -117,25 +117,6 @@ for i=1:length(params_tcv2ids.ids_names)
tmp = gdat(shot,gdat_params);
ids_from_tcv.(ids_to_get) = tmp.(ids_to_get);
ids_from_tcv.([ids_to_get '_description']) = tmp.([ids_to_get '_description']);
% Retrieve versioning information from .this-deployment.info
if ~isempty(ids_from_tcv.(ids_to_get).code.name)
library_gitinfo= ...
tcv_get_deploymentinfo(fullfile(fileparts(which(ids_from_tcv.(ids_to_get).code.name)),'.this-deployment.info'));
ids_from_tcv.(ids_to_get).code.commit = library_gitinfo.git_commit;
ids_from_tcv.(ids_to_get).code.version = library_gitinfo.git_tag;
ids_from_tcv.(ids_to_get).code.repository =library_gitinfo.gitlab_project_url;
end
for ii = 1:numel(ids_from_tcv.(ids_to_get).code.library)
if ~isempty(ids_from_tcv.(ids_to_get).code.library{ii}.name)
library_gitinfo= ...
tcv_get_deploymentinfo(fullfile(fileparts(which(ids_from_tcv.(ids_to_get).code.library{ii}.name)),'.this-deployment.info'));
ids_from_tcv.(ids_to_get).code.library{ii}.commit = library_gitinfo.git_commit;
ids_from_tcv.(ids_to_get).code.library{ii}.version = library_gitinfo.git_tag;
ids_from_tcv.(ids_to_get).code.library{ii}.repository =library_gitinfo.gitlab_project_url;
end
end
end
if nargout>=2
......
function info = tcv_get_deploymentinfo(function_name)
% Reads a deployment info file and extracts relevant details
% Author: L. Simons
% Date: 07/03/25
%
% Args:
% function_name: String, name of function
%
% Returns:
% info: Struct containing extracted information
% Initialize output struct
info = struct();
info.deployment_date='';
info.git_tag='';
info.git_commit='';
info.gitlab_project_url='';
try
filepath=fullfile(fileparts(which(function_name)),'.this-deployment.info');
info.repository=fileparts(filepath);
% Check if file exists
if exist(filepath, 'file') ~= 2
error('File does not exist: %s', filepath);
end
% Open file for reading
fid = fopen(filepath, 'r');
if fid == -1
error('Could not open file: %s', filepath);
end
% Read file line by line
while ~feof(fid)
line = fgetl(fid);
if ischar(line)
tokens = regexp(line, '^(\w+):\s(.+)$', 'tokens');
if ~isempty(tokens)
key = tokens{1}{1};
value = strtrim(tokens{1}{2});
% Store relevant fields in the struct
switch key
case 'DEPLOYMENT_DATE'
info.deployment_date = value;
case 'GIT_TAG'
info.git_tag = value;
case 'GIT_COMMIT'
info.git_commit = value;
case 'GIT_TAG_DATE'
info.git_tag_date = value;
case 'GITLAB_PROJECT_URL'
info.gitlab_project_url = value;
end
end
end
end
% Close the file
fclose(fid);
catch
warning('Failed to read .deployment at filepath: %s',filepath);
end
end
......@@ -36,7 +36,6 @@ ids_soft_x_rays_description = struct();
% Load the soft_x_rays geometry
sxr_geom=sxr_load_geometry();
sxr_data=rc_load_diodes(shot,'diag_name','sxr');
status=numel(sxr_data.data)>0;
%get gdat version, FIXME: Need to write function
......@@ -122,13 +121,13 @@ if status
ids_soft_x_rays.channel{ii}.validity = 0; % FIXME: Always valid data
ids_soft_x_rays.channel{ii}.validity = 0*ones(1,nchannel);
ids_soft_x_rays.code.name = 'rc_load_diodes';
ids_soft_x_rays.code.description = ['rc_load_diodes, RADCAM gitlab repo, loads' ...
ids_bolometer.code.name = 'rc_gti_prep';
ids_bolometer.code.description = ['rc_load_diodes, RADCAM gitlab repo, loads' ...
'the signal from the SXR diodes in arbitrary units.'];
radcam_gitinfo = tcv_get_deploymentinfo(ids_soft_x_rays.code.name);
ids_soft_x_rays.code.commit=library_gitinfo.git_commit;
ids_soft_x_rays.code.version=library_gitinfo.git_tag;
ids_soft_x_rays.code.repository=library_gitinfo.git_project_url;
ids_bolometer.code.commit='';
ids_soft_x_rays.code.version='';
ids_soft_x_rays.code.repository= ...
'https://gitlab.epfl.ch/spc/tcv/diag/radcam/';
ids_soft_x_rays.code.parameters='''diag_name'',''sxr''';
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment