plateform stringclasses 1
value | repo_name stringlengths 13 113 | name stringlengths 3 74 | ext stringclasses 1
value | path stringlengths 12 229 | size int64 23 843k | source_encoding stringclasses 9
values | md5 stringlengths 32 32 | text stringlengths 23 843k |
|---|---|---|---|---|---|---|---|---|
github | lnls-fac/MatlabMiddleLayer-master | fit_load_lattice_model.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/uvx/orbit_find/fit_load_lattice_model.m | 3,246 | utf_8 | 731533e7ef415009d3cbe4535c0a89c9 | function r = fit_load_lattice_model(r0)
global THERING
r = r0;
if any(strcmpi(r.flags, 'load_the_ring')) && exist(r.parms.the_ring_fname, 'file')
load('the_ring_orb.mat');
r.the_ring = the_ring;
else
% loads default ring model
lnls1_set_server('','','');
lnls1;
r.the_ring = THERING;
end
% ad... |
github | lnls-fac/MatlabMiddleLayer-master | find_orbit_offsets.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/uvx/orbit_find/find_orbit_offsets.m | 7,108 | utf_8 | f0c998f6c0d9fa63cb500edc6a7d6757 | function find_orbit_offsets
r.flags = {...
'~4d', 'load_ids', '~add_fakecorrectors', '~load_correctors', ...
'~change_quads', 'change_hkicks', 'change_vkicks', 'load_the_ring', 'save_the_ring', ...
'~plot_codx', '~plot_cody', 'plot_orb'...
};
r.parms.families = {'A2QF01', 'A2QF03', 'A2QF05', 'A2QF07... |
github | lnls-fac/MatlabMiddleLayer-master | power_supply_signatures.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/uvx/orbit_find/power_supply_signatures.m | 3,530 | utf_8 | 10b5dc16546d59328bfcfaab0cd8cbca | function r = power_supply_signatures
fclose('all'); close('all'); clc;
r.parms.the_ring_fname = 'the_ring_orb.mat';
r.flags = {'save_the_ring','load_the_ring'};
r.parms.families = {'A2QF01', 'A2QF03', 'A2QF05', 'A2QF07', 'A2QF09', 'A2QF11', 'A2QD01', 'A2QD03', 'A2QD05', 'A2QD07', 'A2QD09', 'A2QD11', 'A6QF01', 'A6QF0... |
github | lnls-fac/MatlabMiddleLayer-master | analysis3.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/uvx/orbit_find/RIP/analysis3.m | 21,947 | utf_8 | 86a7c95bccacfd2ed13cae01db210b2e | function analysis3
clc; fclose('all'); close('all');
r.flags = {'4d', 'load_ids', 'add_fakecorrectors', '~load_correctors', 'change_quads', 'change_hkicks', 'change_vkicks', '~load_the_ring'};
r.parms.delta_kick = 10e-6;
r.parms.h_weight = 1.0;
r.parms.v_weight = 1.0;
r.parms.nr_changes = 2;
r.parms.delta_K =... |
github | lnls-fac/MatlabMiddleLayer-master | analysis4.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/uvx/orbit_find/RIP/analysis4.m | 3,144 | utf_8 | 4c91495cb468ff88892ce4f8348a7f27 | function analysis4
r.flags = {'~4d', 'load_ids', '~add_fakecorrectors', '~load_correctors', '~change_quads', 'change_hkicks', 'change_vkicks', 'load_the_ring', 'save_the_ring'};
r.parms.families = {'A2QF01'};
r.parms.nr_sgvalues.A2QF01 = 2;
r.parms.the_ring_fname = 'the_ring_orb.mat';
r.parms.delta_pos = 001e-6; % ... |
github | lnls-fac/MatlabMiddleLayer-master | analysis2.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/uvx/orbit_find/RIP/analysis2.m | 25,694 | utf_8 | fc88e31dd5a441d89733f4c503733dbd | function analysis2
r = [];
fclose('all'); close('all'); clc;
r.h_weight = 1.0;
r.v_weight = 0.0;
r.change_quads = false;
r.change_dips = false;
r.the_ring = load_lattice_model;
%r.families = get_measured_data(r, {'A2QD01', 'A2QD03', 'A2QD05', 'A2QD07', 'A2QD09', 'A2QD11', 'A2QF01', 'A2QF03', 'A2QF05', 'A2QF07',... |
github | lnls-fac/MatlabMiddleLayer-master | analysis.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/uvx/orbit_find/RIP/analysis.m | 32,471 | utf_8 | f450de1e3892cdf944518c0e18312dfe | function analysis
% initializations
global THERING
clc; fclose('all'); close('all');
THERING = load_lattice_model;
plotbeta;
% random machines (1st machine is the nominal machine)
r.nr_machines = 1;
r.k_rms = 0.5 / 100;
r.machines = gen_random_machines(THERING, r.nr_machines, r.k_rms);
% optics
r.optics = ... |
github | lnls-fac/MatlabMiddleLayer-master | LNLS1Link.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/uvx/lnls1link_server/LNLS1Link.m | 7,527 | UNKNOWN | 4aaee91995946fbfdfb6ef6db68e1dea | function LNLS1Link
% Emulador MATLAB do dervidor LNLS1LinkS
%
% Esta fun��o emula o servidor LNLS1LinkS dando acesso a seus clientes
% conectados via TCP/IP sockets �s leituras e ajustes da m�quina, que � um
% modelo AT/MML (simulator).
%
% Hist�rico
%
% 2011-04-06: modificada rotina que retorna Fam�lia a par... |
github | lnls-fac/MatlabMiddleLayer-master | epu_field.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/epu/epu_field.m | 899 | utf_8 | 22d01c047db6f3a6764e955e1185b568 | function field = epu_field(epu, varargin)
if isempty(varargin)
field = epu_field_registered_points(epu);
else
field = epu_field_nonregistered_points(epu, varargin{1});
end
function field = epu_field_registered_points(epu)
for i=1:length(epu.registered_points)
mag1 = epu_get_mag(epu, epu.regist... |
github | lnls-fac/MatlabMiddleLayer-master | epu_set_tags_one_magnitude.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/epu/epu_set_tags_one_magnitude.m | 785 | utf_8 | e3b9d354c5eb0c0d0e7a07d7863b848f | function epu = epu_set_tags_one_magnitude(epu0)
epu = epu0;
% independent types
BLOCKS = [[0 0 1];[0 0 -1];[0 1 0];[0 -1 0]]';
% associated tags
TAGS = [0 1 2 3];
for i=1:length(epu.csd)
idx = get_block_type(epu.csd(i).mag, BLOCKS);
epu.csd(i).tag = TAGS(idx);
end
for i=1:length(epu.cse)
... |
github | lnls-fac/MatlabMiddleLayer-master | epu_set_tags_16_blocks_independent.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/epu/epu_set_tags_16_blocks_independent.m | 1,064 | utf_8 | 7194b04749e8c43f0e52401ad08b3270 | function epu = epu_set_tags_16_blocks_independent(epu0)
epu = epu0;
% independent types
BLOCKS_CSD = [[0 0 1];[0 0 -1];[0 1 0];[0 -1 0]]';
BLOCKS_CSE = [[0 0 1];[0 0 -1];[0 1 0];[0 -1 0]]';
BLOCKS_CIE = [[0 0 1];[0 0 -1];[0 1 0];[0 -1 0]]';
BLOCKS_CID = [[0 0 1];[0 0 -1];[0 1 0];[0 -1 0]]';
% associated tags... |
github | lnls-fac/MatlabMiddleLayer-master | lnls_naff.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/optimize_dynapt/lnls_naff.m | 1,101 | utf_8 | 25bd53cb96b5478c422fb82fbd531eef | function lnls_naff(data, init_tunes)
% lnls_naff
%
% Analise de Frequencias Fundamentais
%
% Examplo:
%
% global THERING;
% data = ringpass(THERING, [0.0001 0 0.0001 0 0 0]', 1024);
% tunes = lnls_naff(data(1,:), [24.26, 13.18]);
options.Display = 'off';
options.TolFun = 1e-15;
[x,fval,exitflag,outpu... |
github | lnls-fac/MatlabMiddleLayer-master | lnls_optimize_dynapt.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/optimize_dynapt/lnls_optimize_dynapt.m | 8,084 | utf_8 | 692bd7cbd596adb9bbb79efb98a5b530 | function r = lnls_optimize_dynapt(the_ring)
clc;
result_fname = 'result0000.mat';
try rmappdata(0, 'TuneRespM'); catch end;
if ~exist(result_fname,'file')
if ~exist('the_ring','var')
global THERING;
THERING = sirius_si_lattice('AC20');
the_ring = THERING;
end
... |
github | lnls-fac/MatlabMiddleLayer-master | tracy3_read_machines_generate_flat_file.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/tracy3/tracy3_read_machines_generate_flat_file.m | 3,034 | utf_8 | 367ba6ec1ebe3e264d8dfb69bd28e3b5 | function tracy3_read_machines_generate_flat_file(archive_name,inicio)
%function tracy3_read_machines_generate_flat_file(archive_name)
%function tracy3_read_machines_generate_flat_file(archive_name,inicio)
%
% History
%
% 2013-05-01: Ximenes. Adicionei opção de browser pelo arquivo com máquinas aleatórias. Também adicio... |
github | lnls-fac/MatlabMiddleLayer-master | tracy3_dynamic_aperture_radial.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/tracy3/tracy3_dynamic_aperture_radial.m | 1,384 | utf_8 | 815dfde176f213dca8f1f2f1833a4fb7 | function tracy3_dynamic_aperture_radial(nr_calcs, the_ring, idx)
global THERING;
colors = {[0,0,1],[1,0,0],[0,0.8,0],[1,1,0],[0,1,1],[1,0,1]};
if ~exist('nr_calcs', 'var')
nr_calcs = 1;
colors = {[0,0,0]};
end
if ~exist('the_ring','var')
the_ring = THERING;
idx = 1;
end
fig = [];
for i=1:nr_calcs
... |
github | lnls-fac/MatlabMiddleLayer-master | trackcpp_run_dynap_calc_random_machines.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/trackcpp/trackcpp_run_dynap_calc_random_machines.m | 21,164 | utf_8 | ed5e53cc647814a0372c8fb65a1a2c70 | function trackcpp_run_dynap_calc_random_machines(path, use_default, inpfile)
if ~exist('use_default','var'), use_default = false; end
% users selects submachine
prompt = {'Submachine (bo/si)', 'dynap_xy (yes/no)', 'dynap_ex (yes/no)', 'dynap_ma (yes/no)',...
'dynap_pxa (yes/no)', 'dynap_pya (yes/no)'};
gen_... |
github | lnls-fac/MatlabMiddleLayer-master | trackcpp_read_machs_generate_flat_file.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/trackcpp/trackcpp_read_machs_generate_flat_file.m | 3,049 | utf_8 | dfdd223f45a6bc6ca95862fe9300d43d | function trackcpp_read_machs_generate_flat_file(archive_name,inicio)
%function tracy3_read_machines_generate_flat_file(archive_name)
%function tracy3_read_machines_generate_flat_file(archive_name,inicio)
%
% History
%
% 2013-05-01: Ximenes. Adicionei opção de browser pelo arquivo com máquinas aleatórias. Também adicion... |
github | lnls-fac/MatlabMiddleLayer-master | trackcpp_da_ma_lt_colormap.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/trackcpp/trackcpp_da_ma_lt_colormap.m | 10,624 | utf_8 | a614a9c0b58431c0f1aacbd456cb75b3 | function trackcpp_da_ma_lt_colormap(path)
% users selects submachine
prompt = {'Submachine (bo/si)', 'energy [GeV]', 'Plot Loss Rate? (y/n)','Types of plots'};
defaultanswer = {'si', '3.0','n','ma xy ex'};
answer = inputdlg(prompt,'Select submachine, energy and nr of plots', 1, defaultanswer);
if isempty(answer), retu... |
github | lnls-fac/MatlabMiddleLayer-master | trackcpp_da_ma_lt.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/trackcpp/trackcpp_da_ma_lt.m | 12,346 | utf_8 | 52704df23add2198d749ecdbae6f5d20 | function trackcpp_da_ma_lt(path)
% users selects submachine
prompt = {'Submachine (bo/si)', 'energy [GeV]', 'Number of plots','Types of plots'};
defaultanswer = {'si', '3.0', '2','ma xy ex'};
answer = inputdlg(prompt,'Select submachine, energy and nr of plots', 1, defaultanswer);
if isempty(answer), return; end;
energ... |
github | lnls-fac/MatlabMiddleLayer-master | non_modal_data_acquisition.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/read_data_bbb/non_modal_data_acquisition.m | 17,562 | utf_8 | d6024e7dccbd05b54d9a18e8a13e5e41 | function varargout = non_modal_data_acquisition(varargin)
% NON_MODAL_DATA_ACQUISITION M-file for non_modal_data_acquisition.fig
% NON_MODAL_DATA_ACQUISITION, by itself, creates a new NON_MODAL_DATA_ACQUISITION or raises the existing
% singleton*.
%
% H = NON_MODAL_DATA_ACQUISITION returns the handle to ... |
github | lnls-fac/MatlabMiddleLayer-master | gencoswin.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/read_data_bbb/gencoswin.m | 3,060 | utf_8 | 03217bfaf6dd2bc34f7ea84eba1bea90 | function [w,msg] = gencoswin(varargin)
%GENCOSWIN Returns one of the generalized cosine windows.
% GENCOSWIN returns the generalized cosine window specified by the
% first string argument. Its inputs can be
% Window name - a string, any of 'hamming', 'hann', 'blackman'.
% N - length of th... |
github | lnls-fac/MatlabMiddleLayer-master | sextupolar_1storder_drive_terms.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/DA_optimization/sextupolar_1storder_drive_terms.m | 2,431 | utf_8 | bb47f83d8ba9668027f36938148d6ad6 | function sext = sextupolar_1storder_drive_terms(sext,n_per,tunes)
indcs = 1:length(sext);
betax = getcellstruct(sext,'betax',indcs);
betay = getcellstruct(sext,'betay',indcs);
etax = getcellstruct(sext,'etax',indcs);
mux = getcellstruct(sext,'mux',indcs);
muy = getcellstruct(sext,'muy',indcs);
mu = [mux, muy]... |
github | lnls-fac/MatlabMiddleLayer-master | quadrupolar_1storder_drive_terms.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/DA_optimization/quadrupolar_1storder_drive_terms.m | 2,139 | utf_8 | b4ba522141f8b9d4b1a72bacabbd809c | function chrom = quadrupolar_1storder_drive_terms(beta,eta,mu,SPos)
betax = beta(:,1);
etax = eta(:,1);
betay = beta(:,2);
chrom(:,1) = -(1/4)*betax; %h11001
chrom(:,2) = (1/4)*betay; %h00111
chrom(:,3) = -(1/2)*betax.^(1/2).*etax.*(exp(1i*mu*[2 0]')); %h10002
chrom(:,4) = -(1/8)*betax.*(exp(1i*mu*[4 0]'))... |
github | lnls-fac/MatlabMiddleLayer-master | nonlinearBSC_calc.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/nonlinear_beam_stay_clear/nonlinearBSC_calc.m | 7,489 | utf_8 | 826794a08286f9f963dcf009ffd64f10 | function r = nonlinearBSC_calc(the_ring, n_per)
% nonlinearBSC_calc(the_ring, nper)
%
% calcula o beam stay clear nao linear para o primeiro superperiodo da rede
% the_ring, que possui n_per periodos. cam_vac eh o valor do raio da camara
% ao long do anel. O calculo deve ser rodado da pasta onde queira-se que os
% dado... |
github | lnls-fac/MatlabMiddleLayer-master | add_kick_elements_at_id_locations.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/fofb/add_kick_elements_at_id_locations.m | 2,201 | utf_8 | c30d3e041fd472ecc8cc954b7e1d9b43 | function the_ring = add_kick_elements_at_id_locations(the_ring_original, nr_kicks)
% the_ring = add_kick_elements_at_id_locations(the_ring_original)
%
% Substitutes driftspaces at the ID locations for drift_kick_drift elements
% in order to simulate the ID dipolar field errors.
%
% the_ring_original: original THERING m... |
github | lnls-fac/MatlabMiddleLayer-master | analysis_id_dipolar_perturbations.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/fofb/analysis_id_dipolar_perturbations.m | 1,557 | utf_8 | 26f1b6e81832399a66df13ffeb610175 | function r = analysis_id_dipolar_perturbations
% flags that control calculation flow and options
flags = {'cod6d', 'gaussian'};
% parameters
nr_kicks = 10;
% inits
RandStream.setDefaultStream(RandStream('mt19937ar','seed', 131071));
% loads initial lattice model
the_ring = load_lattice_model(flags);
% adds kick ... |
github | lnls-fac/MatlabMiddleLayer-master | fofb_on_IDs.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/fofb/fofb_on_IDs.m | 14,506 | utf_8 | b22dc465d2ee5721c0c9cdd5575a9fdf | function r = fofb_on_IDs
%% input parameters
r.parms.brho = 10; % magnetic rigidity of the beam [T.m]
r.parms.nr_ids = 20; % number of IDs to include
r.parms.max_bx_int1 = 2 *1e-6; % [T.m]
r.parms.max_by_int1 = 2 *1e-6; % [T.m]
r.parms.nr_kicks = 10; % number of distrib... |
github | lnls-fac/MatlabMiddleLayer-master | fofbsim_response_matrix_details.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/fofb/fofbsim/fofbsim_response_matrix_details.m | 13,150 | utf_8 | fe7a9d67b99d2f3e6fe163fa6dd3fffb | function varargout = fofbsim_response_matrix_details(varargin)
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @fofbsim_response_matrix_details_OpeningFcn, ...
... |
github | lnls-fac/MatlabMiddleLayer-master | fofbsim_disturbance_details.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/fofb/fofbsim/fofbsim_disturbance_details.m | 10,080 | utf_8 | bca1f099b8c98315b05667824a7767b0 | function varargout = fofbsim_disturbance_details(varargin)
% Begin initialization code - DO NOT EDIT
gui_Singleton = 0;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @fofbsim_disturbance_details_OpeningFcn, ...
... |
github | lnls-fac/MatlabMiddleLayer-master | replicate_ss.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/fofb/fofbsim/replicate_ss.m | 283 | utf_8 | 4f01f3a7fbf9b58ea7fabede1369a53d | % Replicate a M x N dynamic system expressend on a state-space
% representation. The resulting system is a nM x nN system.
function [A,B,C,D] = replicate_ss(A,B,C,D,n)
A = replicate_matrix(A,n);
B = replicate_matrix(B,n);
C = replicate_matrix(C,n);
D = replicate_matrix(D,n); |
github | lnls-fac/MatlabMiddleLayer-master | fofbsim.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/fofb/fofbsim/fofbsim.m | 31,593 | utf_8 | c31a6f9f14848912367b571c23819ef8 | function varargout = fofbsim(varargin)
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @fofbsim_OpeningFcn, ...
'gui_OutputFcn', @fofbsim_Out... |
github | lnls-fac/MatlabMiddleLayer-master | fofbsim_controller_details.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/fofb/fofbsim/fofbsim_controller_details.m | 3,654 | utf_8 | 9ec12c56d2182099b4ccbcbc8cda074a | function varargout = fofbsim_controller_details(varargin)
% Begin initialization code - DO NOT EDIT
gui_Singleton = 0;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @fofbsim_controller_details_OpeningFcn, ...
... |
github | lnls-fac/MatlabMiddleLayer-master | fofbsim_correction_matrix_details.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/fofb/fofbsim/fofbsim_correction_matrix_details.m | 2,115 | utf_8 | 561caea76bc7edb3d47a2972a9d1a9b7 | function varargout = fofbsim_correction_matrix_details(varargin)
% Begin initialization code - DO NOT EDIT
gui_Singleton = 0;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @fofbsim_correction_matrix_details_OpeningFcn, .... |
github | lnls-fac/MatlabMiddleLayer-master | build_ss_matrices.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/fofb/fofbsim/build_ss_matrices.m | 3,104 | utf_8 | 51c862f0ffb814191323b90c4554e1a4 | % Build state-space matrices of dynamics subsystems
function ss_matrices = build_ss_matrices(ss_matrices, config, controller_config, dynamics_neglection_factor)
% In order to optimize the simulation, the power supply dynamics and vacuum chamber dynamics can be
% disabled (passed through) whether the response times... |
github | lnls-fac/MatlabMiddleLayer-master | fofbsim_reference_orbit_details.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/fofb/fofbsim/fofbsim_reference_orbit_details.m | 5,188 | utf_8 | a6543a753cb3e16551289d167ceea1ad | function varargout = fofbsim_reference_orbit_details(varargin)
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @fofbsim_reference_orbit_details_OpeningFcn, ...
... |
github | lnls-fac/MatlabMiddleLayer-master | build_default_simulation_parameters.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/fofb/fofbsim/build_default_simulation_parameters.m | 1,486 | utf_8 | 434722b6170863de128017003a86b17a | % Complete missing simulation parameters fields with default values
function config = build_default_simulation_parameters(config)
[n_bpm, n_corr] = size(config.beam_response_matrix);
% Default response matrix: 1x1 matrix, with unitay gain. 1 horizontal BPM reading and 1 horizontal corrector
if isempty(config.be... |
github | lnls-fac/MatlabMiddleLayer-master | replicate_matrix.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/fofb/fofbsim/replicate_matrix.m | 243 | utf_8 | 1ff63e4c3e88470213b732f4ca92d03b | % Replicates matrix along the diagonal
function new_A = replicate_matrix(A,n)
new_A = zeros(n*size(A,1),n*size(A,2));
n_lin = size(A,1);
n_col = size(A,2);
for i=1:n
new_A((i-1)*n_lin+1:i*n_lin, (i-1)*n_col+1:i*n_col) = A;
end |
github | lnls-fac/MatlabMiddleLayer-master | fofbsim_help.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/fofb/fofbsim/fofbsim_help.m | 1,403 | utf_8 | 3c9aa4902efe4eb8c26a431435a9747d | function varargout = fofbsim_help(varargin)
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @fofbsim_help_OpeningFcn, ...
'gui_OutputFcn', @f... |
github | lnls-fac/MatlabMiddleLayer-master | build_results.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/fofb/fofbsim/build_results.m | 1,571 | utf_8 | d3c747e4548451a8f7317488d9b5c76a | % Build simulation results structure
function simulation_results = build_results(config, simulation_time, simulation_outputs)
n_pts = length(simulation_time);
[n_bpm, n_corr] = size(config.beam_response_matrix);
actual_pos = simulation_outputs(:,1:n_bpm);
pos_deviation = actual_pos - repmat(config.beam_refere... |
github | lnls-fac/MatlabMiddleLayer-master | calc_trajectory.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/calc_2dfield_from_at_model/calc_trajectory.m | 3,045 | utf_8 | df9f9953272a8476a8c21320eacb7c45 | function r = calc_trajectory(path_length, init_position, runge_kutta_flags)
% function traj = calc_trajectory(path_length, init_position)
%
% INPUT
% path_length [mm]: comprimento total de trajet?ria. A metade do comprimento em s<0 e metade em s>0.
% initial_pos [mm/a.]: condicoes iniciais [x;y;z;beta_x;be... |
github | lnls-fac/MatlabMiddleLayer-master | calc_field_on_rk_trajectory.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/calc_2dfield_from_at_model/calc_field_on_rk_trajectory.m | 6,955 | utf_8 | ee65da6814d6cff37ade5f44373e5fdd | function rk_traj = calc_field_on_rk_trajectory(rk_traj0, perp_grid)
rk_traj = rk_traj0;
xgrid = perp_grid.points;
monomials = perp_grid.monomials;
max_dy_a = 0;
max_dy_b = 0;
on_axis_idx = find(xgrid == 0);
h1 = figure;
h2 = figure;
% removes fields of rk_traj, if rk traj was loaded
if isfield(rk_traj, 'by_polynom... |
github | lnls-fac/MatlabMiddleLayer-master | generate_bump.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/cod_bumps/generate_bump.m | 1,460 | utf_8 | 0a763229cb813b42174b5542608a5c07 | function generate_bump
OCS0 = load('OCS.mat'); OCS0 = OCS0.OCS;
[DeviceList, Family, ErrorFlag] = common2dev('bpm_s_04_b', 'bpmx');
bpm1 = dev2elem('bpmx', DeviceList);
[DeviceList, Family, ErrorFlag] = common2dev('bpm_s_04_c', 'bpmx');
bpm2 = dev2elem('bpmx', DeviceList);
pos = getfamilydata('bpmx','Position... |
github | lnls-fac/MatlabMiddleLayer-master | localized_bumps.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/cod_bumps/localized_bumps.m | 5,367 | utf_8 | de6f1cf08e5234c17e32e03a2bd59a16 | function localized_bumps
global THERING;
the_ring = THERING;
%% parameters with desired localized kicks
bump_x = 1e-3;
bump_y = 1e-3;
nr_cms = 5*2;
%% selects half straight section and calc indices for upstream and downstream correctors
hcm = findcells(the_ring, 'FamName', 'hcm');
vcm = findcells(the_ring, 'FamNa... |
github | lnls-fac/MatlabMiddleLayer-master | sext_opt2.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/emittance_optimization/sext_opt2.m | 8,034 | utf_8 | d0c37395cc26e7c2539dd594dd2c5a39 | function sext_opt2
global THERING;
%the_ring = define_max_iv;
the_ring = define_mba5;
THERING = the_ring;
the_ring = improve_sextupoles(the_ring);
%sxt_idx = 1:length(the_ring);
sxt_idx = findcells(the_ring, 'PolynomB');
% sxt =getcellstruct(the_ring, 'PolynomB', sxt_idx, 1, 3);
% sxt_idx = sxt... |
github | lnls-fac/MatlabMiddleLayer-master | sext_opt.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/emittance_optimization/sext_opt.m | 3,997 | utf_8 | 7e1dcd26cd199bf259b30e4b2711c9ed | function sext_opt
%the_ring = define_5ba_e0p35;
the_ring = define_max_iv;
twiss = calctwiss(the_ring);
sl = zeros(size(twiss.betax));
chrom0 = [-100;-70];
r1 = get_chroms(chrom0, twiss, sl);
r2 = get_dtunes(twiss, sl);
M = calc_respm(chrom0, twiss, sl);
best.tshift = Inf;
for i=1:size(M,2)
fo... |
github | lnls-fac/MatlabMiddleLayer-master | ramp_tracking.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/booster/ramp_behavior/ramp_tracking.m | 4,735 | UNKNOWN | b918c179f646d1d563bbca45893419e4 | function ramp_tracking()
global THERING;
THERING = sirius_bo_lattice;
setradiation('on'); setcavity('on');
the_ring = THERING;
circ = findspos(the_ring, length(the_ring)+1);
T0 = circ/299792458;
%% Define ramp
nturns = 1;
Tint = nturns*T0;
freq = 2;
dt = 0.0:Tint:(0.5/freq);
E0 = 150e6;
Einf = 3e9;
Et = gam... |
github | lnls-fac/MatlabMiddleLayer-master | equilibrium_parameters.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/booster/ramp_behavior/equilibrium_parameters.m | 3,089 | utf_8 | ef073de9e229dbfe34455a0c38787cf6 | function equilibrium_parameters()
freq = 2;
T0 = 496.8/299792458;
dt = 0.0:10*T0:(0.5/freq);
gama0 = 150/0.511;
gamainf = 3e3/0.511;
[gamat dgamatdt] = energy_ramp(gamainf, gama0, freq, dt(1:end));
%rampa linear:
% tf = sum(dt<0.2);
% Vi = 200e3;
% Vf = 1000e3;
% Vramp = Vi+(Vf-Vi)/dt(tf)*dt(1:tf);... |
github | lnls-fac/MatlabMiddleLayer-master | sirius_injection.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/injection_simulation/sirius_injection.m | 18,965 | utf_8 | 8f5fbba99cf076e22458d7c75e75f593 | function sirius_injection()
%% PARAMETERS
p.bo_version = 'BO.V05.03';
p.ts_version = 'TS.V03.04';
p.si_version = 'SI.V24.01';
p.ts_mode = 'M1';
p.nr_particles = 1000; % nr_particles in simulation
p.bo_coupling = 0.10; % booster transverse coupling (<1.0)
p.bo_kickex_kick = 2.46... |
github | lnls-fac/MatlabMiddleLayer-master | perform_feedback.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/coupling_feeback/perform_feedback.m | 1,892 | utf_8 | b4449aa8036a38d3f91e127f2a6af0ff | function fb_data = perform_feedback(...
rand_mach, rand_mach_goal, indices, response, corr_params)
fb_strens = zeros(length(rand_mach), length(indices.qs(:)));
for i=1:length(rand_mach)
fprintf(' . correcting machine %02i...\n', i);
goal_tilt = lnls_calc_coupling(rand_mach_goal{i});
... |
github | lnls-fac/MatlabMiddleLayer-master | analyze_results.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/coupling_feeback/analyze_results.m | 3,082 | utf_8 | a9e0a5e8fe5f9e950ed2ba4e43882b9c | function analyze_results(r)
show_summary_nominal(r.ring, r.indices, r.sim_anneal);
coup_goal = show_summary_machines(r.rand_mach_coup, r.indices, 'Goal Coupling');
coup_ini = show_summary_machines(r.rand_mach_coup_ids, r.indices, 'Uncorrected');
coup_fin = show_summary_machines(r.rand_mach_coup_ids_fb,... |
github | lnls-fac/MatlabMiddleLayer-master | sirius_coupling_feedback.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/coupling_feeback/sirius_coupling_feedback.m | 5,196 | utf_8 | 73f75a04e3a461ce20c6ba60a5e61b9e | function r = sirius_coupling_feedback(lattice_version, run_nominal, run_response, run_feedback)
fol = fullfile(...
lnls_get_root_folder(), 'MatlabMiddleLayer', 'Release', ...
'lnls', 'fac_scripts', 'sirius', 'coupling_feeback');
pathCell = regexp(path, pathsep, 'split');
onPath = any(strcmp(... |
github | lnls-fac/MatlabMiddleLayer-master | tune_from_stripline.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/tune_measurements/tune_from_stripline.m | 6,127 | utf_8 | 5fef9c73639cd91b89e68c440377b3eb | function tune_from_stripline
clc; delete(timerfindall);
%% units
m = 1; mm = 1e-3; um = 1e-6; s = 1; Hz = 1; urad = 1e-6;
%% loads initial AT model
the_ring = load_initial_lattice_model;
%% nominal lattice parameters
twiss = calctwiss(the_ring);
tunex = twiss.mux(end) / 2 / pi; frac_tunex = tunex - floor(tunex... |
github | lnls-fac/MatlabMiddleLayer-master | interpolate_field.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/magnet_modelling/interpolate_field.m | 4,273 | utf_8 | 275648003fd8e66700ebd11a70ca383a | function field = interpolate_field(r)
% function field = interpolate_field(r)
%
% returns interpolated field at point 'r'
%
% INPUT
% r: point in space where field is to be interpolated. units: [m]
%
% OUTPUT
% field: interpolated field. units: [T]
%
% History:
% 2013-05-17: new version
% 2011-11-25: versao rev... |
github | lnls-fac/MatlabMiddleLayer-master | maxwell_field_reconstruction.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/magnet_modelling/maxwell_field_reconstruction.m | 1,460 | utf_8 | 7f8004e75aa8f322bae8d66a38df91f9 | function maxwell_field_reconstruction(order)
% Maxwell fiels reconstruction
% ============================
% Bx = Bx^(0) + Bx^(1) y + Bx^(2) y^2 /2 + ...
% By = By^(0) + By^(1) y + By^(2) y^2 /2 + ...
% Bz = Bz^(0) + Bz^(1) y + Bz^(2) y^2 /2 + ...
%
% dBx/dy = dBy/dx -> Bx^(n+1) = dBy^(n)/dx
% dBz/dy = dBy/dz ... |
github | lnls-fac/MatlabMiddleLayer-master | calibrate_at_model.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/magnet_modelling/calibrate_at_model.m | 4,856 | utf_8 | b84319caf2bfdc8d82cb0c7144e68940 | function [at_model M_fieldmap M_atmodel K_fieldmap K_atmodel] = calibrate_at_model(at_traj, at_model0, fieldmap_track, parms_track, monomials, runge_kutta_flags, calibration)
s_max = at_traj.s(end);
at_model = at_model0;
%monomials_subset = setdiff(monomials, [1]);
monomials_subset = monomials;
% calibrates Polynom... |
github | lnls-fac/MatlabMiddleLayer-master | booster_insert_segmented_models.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/magnet_modelling/booster_insert_segmented_models.m | 4,582 | utf_8 | 3bfb55b58fbb57aa42f73bdd3331b603 | function the_ring = booster_insert_segmented_models
the_ring = sirius_bo_lattice;
% calcs original tunes
fprintf('--- calc_ing original tunes ---\n');
[~, tunes0] = twissring(the_ring,0,1:length(the_ring)+1);
%r = lnls_calc_optics(the_ring, '6d');
% inserts QD quadrupoles (renormalizes strengths)
fprintf('--- in... |
github | lnls-fac/MatlabMiddleLayer-master | generate_model_segmentation.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/magnet_modelling/generate_model_segmentation.m | 6,089 | utf_8 | c6635cfdc6fdbffefb563c0eecaa3037 | function r = generate_model_segmentation(traj, model_len, monomials, load_flag, config_path)
fname = fullfile(config_path, 'model_segmentation.mat');
changed_state = false;
x = NaN;
if exist(fname,'file') && strcmpi(load_flag, 'load')
load(fname);
elseif exist(fname,'file') && strcmpi(load_flag, 'load_return')
... |
github | lnls-fac/MatlabMiddleLayer-master | calc_model_by_polynom.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/magnet_modelling/calc_model_by_polynom.m | 2,223 | utf_8 | bf13a7c0855545f6a3333be1fdde42df | function [by_polynom errors integ_multipoles stray_multipoles] = calc_model_by_polynom(traj, seg)
by_polynom = NaN(1,size(traj.by_polynom,2));
errors = NaN(1,size(traj.by_polynom,2));
if isempty(seg), return; end;
t = add_seg_points_to_ref_traj(traj, seg);
ds = diff(t.s);
p1m = 0.5*(t.by_polynom(1:end-1,:) + t.by_po... |
github | lnls-fac/MatlabMiddleLayer-master | calc_field_on_rk_trajectory.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/magnet_modelling/calc_field_on_rk_trajectory.m | 5,250 | utf_8 | 816cc28b71907896f7ec100312b47342 | function rk_traj = calc_field_on_rk_trajectory(rk_traj0, perp_grid, verbose_off)
if exist('verbose_off','var')
verbose_off = true;
else
verbose_off = false;
end
rk_traj = rk_traj0;
xgrid = perp_grid.points;
monomials = perp_grid.monomials;
max_dy_a = 0;
max_dy_b = 0;
on_axis_idx = find(xgrid == 0);
if ~ver... |
github | lnls-fac/MatlabMiddleLayer-master | insert_segmented_model.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/magnet_modelling/insert_segmented_model.m | 4,499 | utf_8 | 631c4c1596969f4a8cca942b69db220d | function the_ring = insert_segmented_model(the_ring_original, file_name, family_name, marker_name)
bpm_label = 'BPM';
hcm_label = 'HCM';
vcm_label = 'VCM';
the_ring = the_ring_original;
% registers positions of BPMs, HCMs and VCMs
idx = findcells(the_ring, 'FamName', bpm_label); bpm_spos = findspos(the_ring, idx); t... |
github | lnls-fac/MatlabMiddleLayer-master | find_intersection_point.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/magnet_modelling/find_intersection_point.m | 1,606 | utf_8 | b79fd450458ef7a74cf2db3223972b40 |
function [s_intersection, x_perp, idx] = find_intersection_point(traj, sf_coord)
% function s_intersection = find_intersection_point(traj, sf_coord)
%
% finds s position in 'traj' at which normal line defined in 'sf_coord' intersects the trajectory
%
% Obs:
% O algortimo funciona da seguinte maneira: a trajet?ria ? ... |
github | lnls-fac/MatlabMiddleLayer-master | load_fieldmap.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/magnet_modelling/load_fieldmap.m | 6,968 | utf_8 | dd12c4bc646b1e32b0e38823b175db49 | function load_fieldmap(file_name, type)
fmaps{1}.fname = file_name;
fmaps{1}.data_index = 1;
[fmaps{1}.data fmaps{1}.magnet] = read_fieldmap_from_file(file_name);
% define posicionamento default no sistema de coordenadas
fmaps{1}.strength = 1;
fmaps{1}.shift_z = 0;
fmaps{1}.shift_x = 0;
fmaps{1}.angle_y = 0;
fmaps... |
github | lnls-fac/MatlabMiddleLayer-master | get_fmaps_boundingbox.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/magnet_modelling/get_fmaps_boundingbox.m | 2,278 | utf_8 | c99d90e121e903b1ca244129c4a44166 | function [zmin zmax xmin xmax] = get_fmaps_boundingbox
% function [zmin zmax xmin xmax] = get_fmaps_boundingbox
%
% Retorna vetor com bounding box de todos os mapas habilitados (strength ~= 0).
% O bounding box ? definido no sistema de coordenadas global.
%
% OUTPUT
% [zmin zmax xmin xmax] (mm) : bounding box.
%
% H... |
github | lnls-fac/MatlabMiddleLayer-master | simul_vibrations.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/ground_motion_effects/simul_vibrations.m | 4,360 | utf_8 | 817dbeb6b67798c47bdad2a86e7bbaa6 | function simul_vibrations
p.mode = 'AC20';
p.coupling = 1 * 0.01;
p.nr_machines = 100;
p.rmsx_withingirders = 20 * 1e-9; % m
p.rmsy_withingirders = 20 * 1e-9; % m
p.rmsx_withinmagnets = 0 * 1e-9; % m
p.rmsy_withinmagnets = 0 * 1e-9; % m
p.the_ring = sirius_lattice_girder3(p.mode);
%p.the_ring = singl... |
github | lnls-fac/MatlabMiddleLayer-master | calc_cod_sigma_from_vibrations.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/ground_motion_effects/calc_cod_sigma_from_vibrations.m | 10,886 | utf_8 | 79a6ada29faacf24711a63317c0c937d | function calc_cod_sigma_from_vibrations
clc;
close('all');
p.coupling = 1.0 * 0.01;
p.maxp = 10.0 * 0.01;
p.selection = {'mia', 'mib', 'mc'};
%p.selection = 'all';
%p = girder0_AC20(p);
%p = girder1_AC20(p);
%p = girder2_AC20(p);
p = girder3_AC20(p);
%p = girder0_AC10(p);
%p = girder1_AC10... |
github | lnls-fac/MatlabMiddleLayer-master | ids_symmetrize.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/insertion_devices/optics_matching/ids_symmetrize.m | 4,675 | utf_8 | 1147d042fef8ea930bfbaee61a6fcc77 | function [the_ring, quad_strength] = ids_symmetrize(the_ring, params)
% Start at the last mc marker to preserve sections numbers
idx = findcells(the_ring, 'FamName', 'mc'); idx = idx(end)-1;
the_ring = circshift(the_ring,[0,-idx]);
mc = unique(sort([1 findcells(the_ring, 'FamName', 'mc') length(the_ring)]));
% Repl... |
github | lnls-fac/MatlabMiddleLayer-master | show_changes_in_quadrupole_strengths_for_machine_with_id.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/insertion_devices/optics_matching/show_changes_in_quadrupole_strengths_for_machine_with_id.m | 4,072 | utf_8 | da1a179208f1fe85e3dd2e7dd3e0d081 | function show_changes_in_quadrupole_strengths_for_machine_with_id(the_ring1,the_ring2)
if ~exist('the_ring1','var'), load('the_ring0.mat'); the_ring1 = the_ring; end
if ~exist('the_ring2','var'), load('the_ring_withids.mat'); the_ring2 = the_ring; end
if ~exist('knobs','var'), knobs = {'QFA','QDA','QFB','QDB1','QDB2',... |
github | lnls-fac/MatlabMiddleLayer-master | study_rolloff.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/insertion_devices/id_modelling/study_rolloff.m | 3,570 | utf_8 | 7af01f34dbb9915b62f3309184512e71 | function ID = create_ID(id_def)
% cleanup
clc; fclose('all'); close('all');
addpath('epu');
% ID basic parameters
% units
mm = 1; Tesla = 1;
id_def.id_label = 'TEST_EPU80_PV';
id_def.period = 80 * mm;
id_def.nr_periods = 38;
id_def.magnetic_gap = 16.0 * mm;
id_def.cassette_... |
github | lnls-fac/MatlabMiddleLayer-master | calc_ID_dtune.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/insertion_devices/id_modelling/calc_ID_dtune.m | 3,841 | utf_8 | 270d7b188032611c342129f4d4ee5012 | function calc_ID_dtune(id_mat_file_name, ebeam_def)
% cleanup
clc; fclose('all'); close('all');
% reads data from ID model mat file
%id_mat_file_name = fullfile('EPU50', 'EPU50_PH - KICKTABLES.mat');
if ~exist('id_mat_file_name','var')
[FileName,PathName,~] = uigetfile('*.mat','Select mat file with ... |
github | lnls-fac/MatlabMiddleLayer-master | create_ID.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/insertion_devices/id_modelling/create_ID.m | 6,302 | utf_8 | 1974966e61a578903b4c95e63defbce1 | function ID = create_ID(id_def, nr_periods_init)
% cleanup
clc; fclose('all'); close('all');
addpath('epu');
% ID basic parameters
if ~exist('id_def','var')
ids = ID_definitions();
%id_def = ids.SCW3T;
%id_def = ids.SCW4T;
%id_def = ids.W2T;
%id_def = ids.U18;
%id_def = ids.U19;
... |
github | lnls-fac/MatlabMiddleLayer-master | calc_ID_rolloff.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/insertion_devices/id_modelling/calc_ID_rolloff.m | 2,330 | utf_8 | 4f3a1cf8edb7b47bf3b9f30b9516d65e | function calc_ID_rolloff(id_def)
% cleanup
%clc; fclose('all'); close('all');
addpath('epu');
% ID basic parameters
if ~exist('id_def','var')
ids = ID_definitions();
%id_def = ids.SCW3T;
%id_def = ids.W2T;
%id_def = ids.U18;
%id_def = ids.EPU50_PH;
%id_def = ids.EPU50_PC;
%id_def = ids.EPU... |
github | lnls-fac/MatlabMiddleLayer-master | search_nr_periods_for_field_convergence.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/insertion_devices/id_modelling/search_nr_periods_for_field_convergence.m | 2,077 | utf_8 | 0d1c6b2a6d32be3505b382949697ada3 | function nr_periods = search_nr_periods_for_field_convergence(id_def, nr_periods_init)
nr_periods = nr_periods_init;
id_model = create_id_model(id_def, nr_periods);
fs = calc_field(id_def, id_model);
while (true)
nr_periods = nr_periods + 4;
id_model = create_id_model(id_def, nr_periods);
new_fs = calc_fie... |
github | lnls-fac/MatlabMiddleLayer-master | generate_kicktable.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/insertion_devices/id_modelling/generate_kicktable.m | 10,981 | UNKNOWN | 74f5d416dea43dd252212b2f1946ec0b | function ID = generate_kicktable(id_mat_file_name)
% cleanup
clc; fclose('all'); close('all');
addpath('epu');
% reads data from ID model mat file
%id_mat_file_name = fullfile('EPU50', 'EPU50_PC - ID.mat');
%id_mat_file_name = fullfile('EPU80','EPU80_PH - ID.mat');
%id_mat_file_name = fullfile('U25','U25 - I... |
github | lnls-fac/MatlabMiddleLayer-master | epu_field.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/insertion_devices/id_modelling/epu/epu_field.m | 899 | utf_8 | 22d01c047db6f3a6764e955e1185b568 | function field = epu_field(epu, varargin)
if isempty(varargin)
field = epu_field_registered_points(epu);
else
field = epu_field_nonregistered_points(epu, varargin{1});
end
function field = epu_field_registered_points(epu)
for i=1:length(epu.registered_points)
mag1 = epu_get_mag(epu, epu.regist... |
github | lnls-fac/MatlabMiddleLayer-master | epu_create.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/insertion_devices/id_modelling/epu/epu_create.m | 9,964 | UNKNOWN | a069176b93e8c2f6a661570368b4902d | function epu = epu_create(params)
cassette_separation = params.cassette_separation;
magnetic_gap = params.magnetic_gap;
nr_periods = params.nr_periods;
period = params.period;
block_separation = params.block_separation;
block_width = params.block_width;
block_height = params.block_height;
block_length = (per... |
github | lnls-fac/MatlabMiddleLayer-master | epu_set_tags_one_magnitude.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/insertion_devices/id_modelling/epu/epu_set_tags_one_magnitude.m | 785 | utf_8 | e3b9d354c5eb0c0d0e7a07d7863b848f | function epu = epu_set_tags_one_magnitude(epu0)
epu = epu0;
% independent types
BLOCKS = [[0 0 1];[0 0 -1];[0 1 0];[0 -1 0]]';
% associated tags
TAGS = [0 1 2 3];
for i=1:length(epu.csd)
idx = get_block_type(epu.csd(i).mag, BLOCKS);
epu.csd(i).tag = TAGS(idx);
end
for i=1:length(epu.cse)
... |
github | lnls-fac/MatlabMiddleLayer-master | epu_set_tags_16_blocks_independent.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/insertion_devices/id_modelling/epu/epu_set_tags_16_blocks_independent.m | 1,064 | utf_8 | 7194b04749e8c43f0e52401ad08b3270 | function epu = epu_set_tags_16_blocks_independent(epu0)
epu = epu0;
% independent types
BLOCKS_CSD = [[0 0 1];[0 0 -1];[0 1 0];[0 -1 0]]';
BLOCKS_CSE = [[0 0 1];[0 0 -1];[0 1 0];[0 -1 0]]';
BLOCKS_CIE = [[0 0 1];[0 0 -1];[0 1 0];[0 -1 0]]';
BLOCKS_CID = [[0 0 1];[0 0 -1];[0 1 0];[0 -1 0]]';
% associated tags... |
github | lnls-fac/MatlabMiddleLayer-master | analysis_Plot_MinimumGap.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/insertion_devices/radiation_characteristics/analysis_Plot_MinimumGap.m | 2,794 | utf_8 | cd28e23528f0fd037e1050e711631859 | function analysis_Plot_MinimumGap
m = 1;
mm = 0.001 * m; % m
mrad = 0.001; % rad
percent = 0.01;
degree = pi/180;
mA = 0.001;
Tesla = 1;
Params.VerticalAcceptance = 5.77 * mm * mrad;
Params.Spacing = 0.3 * m;
Params.BeamCurrent = 500 * mA;
Params.Coupling = 0.5 * percent;
Pa... |
github | lnls-fac/MatlabMiddleLayer-master | analysis_Plot_MaxBField.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/insertion_devices/radiation_characteristics/analysis_Plot_MaxBField.m | 3,274 | utf_8 | 8169f180e5503f615f6c0893709e03b0 | function analysis_Plot_MaxBField
m = 1;
mm = 0.001 * m; % m
mrad = 0.001; % rad
percent = 0.01;
degree = pi/180;
mA = 0.001;
Tesla = 1;
Params.VerticalAcceptance = 5.77 * mm * mrad;
Params.Spacing = 0.3 * m;
Params.BeamCurrent = 500 * mA;
Params.Coupling = 0.5 * percent;
P... |
github | lnls-fac/MatlabMiddleLayer-master | check_validity_of_chaos_indicator.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/chaos_indicator/check_validity_of_chaos_indicator.m | 3,422 | utf_8 | 5a6beb23f1c85b66aa99f357a9cad445 | function info = check_validity_of_chaos_indicator(lattices)
planes = {'x','y','ep','en'};
info = struct('x', {}, 'y', {}, 'ep', {}, 'en', {});
flag_plot = false;
for i = 1:length(lattices)
si = lattices(i).lattice;
if lattices(i).symmetry ~= 1
mia = findcells(si,'FamName','mia');
si = si(1:... |
github | lnls-fac/MatlabMiddleLayer-master | orbit_correct_transport_lines.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sirius/orbit_correction_transport_lines/orbit_correct_transport_lines.m | 14,205 | utf_8 | 6300c91c8120110b7651aff1f3ba4eab | function orbit_correct_transport_lines
r.tolx = 200e-6;
r.toly = 200e-6;
r.tole = 0.1 / 100;
r.nr_machines = 100;
r.nr_iterations = 5;
%orbit_correct_ltlb(r);
orbit_correct_ltba(r);
function orbit_correct_ltba(r)
% loads transport line model and plots lattice functions
sirius_ltba;
[lt, TwissDataIn] = sirius_ts_l... |
github | lnls-fac/MatlabMiddleLayer-master | calc_tune_spread.m | .m | MatlabMiddleLayer-master/Release/lnls/fac_scripts/sextupole_optimization/calc_tune_spread.m | 1,642 | utf_8 | 7b043ef3f95a38fa5be9878b717cc7ce | function r = calc_tune_spread(p)
global THERING;
r.tune0 = p.tune0;
r.tunes = [];
r.unstable_points = [];
r.stable_points = [];
r.rms = 0;
r.fitness = 0;
ringpassptr = @myringpass;
set_sextupole_values(p);
for i = 1:size(p.points, 1)
traj = ringpassptr(THERING, p.points(i,:)', p.nr_tu... |
github | lnls-fac/MatlabMiddleLayer-master | respmuvx.m | .m | MatlabMiddleLayer-master/Release/lnls/dig_scripts/uvx/respmuvx.m | 5,508 | utf_8 | 1086a4d73926c8accf9e9b879117817c | function [Mcorr, Mss, Mdisp, Mrf] = respmuvx
global THERING;
lnls1;
setoperationalmode(1);
% Orbit and light source markers
bpm_markers = findcells(THERING, 'FamName', 'BPM')';
rad4g_markers = findcells(THERING, 'FamName', 'RAD4G')';
rad15g_markers = findcells(THERING, 'FamName', 'RAD15G')';
ss_markers ... |
github | lnls-fac/MatlabMiddleLayer-master | faplot.m | .m | MatlabMiddleLayer-master/Release/lnls/dig_scripts/uvx/fofb/fa/faplot.m | 4,061 | utf_8 | f43648e4e9472bcc89404c2f3a395404 | function faplot(data, mode, selected_bpm, selected_corr)
start_time = fatimelvrt2m(data.time(1));
time = double(data.time-data.time(1))/1e9; % relative time [s]
if nargin < 2 || isempty(mode)
mode = '';
end
nbpm = size(data.bpm_readings,2)/2;
if nargin < 3 || isempty(selected_bpm)
selected_bpm = 1:nbpm;
else... |
github | lnls-fac/MatlabMiddleLayer-master | faload.m | .m | MatlabMiddleLayer-master/Release/lnls/dig_scripts/uvx/fofb/fa/faload.m | 6,767 | utf_8 | ecb8f3262eeb529a7982dbdea169e186 | function fadata = faload(filenames, selected_bpm, selected_corr, npts)
%
% FALOAD Loads fast acquisition (FA) data from file.
if nargin < 2
selected_bpm = [];
end
if nargin < 3
selected_corr = [];
end
if nargin < 4
npts = [];
end
nmarker = 1;
if ischar(filenames)
try
fil... |
github | lnls-fac/MatlabMiddleLayer-master | farespm.m | .m | MatlabMiddleLayer-master/Release/lnls/dig_scripts/uvx/fofb/fa/farespm.m | 1,839 | utf_8 | 97d431f404641900f41225ab991f822e | function [M, corr_steps, orb_std, corr_std] = farespm(fadata, npts_level)
%FIXME
fadata.bpm_readings = [fadata.bpm_readings; fadata.bpm_readings(1,:)];
fadata.corr_setpoints = [fadata.corr_setpoints; fadata.corr_setpoints(1,:)];
steps = diff(fadata.corr_setpoints,1,1);
posedge = find(steps > 0);
negedge = find(steps ... |
github | lnls-fac/MatlabMiddleLayer-master | intlat.m | .m | MatlabMiddleLayer-master/Release/lnls/at-mml_modified_scripts/intlat.m | 12,250 | utf_8 | f6d46689ce4338a3b53bae1ba98254c5 | function intlat(varargin)
%INTLAT - interactive AT lattice editor
% INTLAT(DIRECTION)
% Direction is the initial angle[rad] of the orbit with respect
% to the plot axis
global THERING
if nargin < 1 | isnumeric(varargin{1})
if nargin == 1
STARTANGLE = varargin{1};
else
STARTANGLE = 0;
end... |
github | lnls-fac/MatlabMiddleLayer-master | drawlattice.m | .m | MatlabMiddleLayer-master/Release/lnls/at-mml_modified_scripts/drawlattice.m | 16,631 | utf_8 | 297f68adef5f14ae7d487aa0beea7d00 | function h = drawlattice(Offset, Scaling, varargin)
%DRAWLATTICE - Draws the AT lattice to a figure
% h = drawlattice(Offset {0}, Scaling {1}, hAxes {gca}, Ldraw, thering)
%
% h - handle to each element drawn
%
% Programmers Notes
% 1. The AT index is stored in the Userdata of each symbol.
% get(h(i),'U... |
github | lnls-fac/MatlabMiddleLayer-master | tango_command.m | .m | MatlabMiddleLayer-master/Release/links/tango/tango_command.m | 14,411 | utf_8 | 02bd9ec98d28cfd4946085624f7435f6 | function tango_command(varargin)
%
[FamilyIndex, AO] = isfamily(varargin{1});
if FamilyIndex
Family = varargin{1};
if length(varargin) >= 1
DeviceList = varargin{2};
commandName = varargin{3};
end
local_command(AO, DeviceList, commandName);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
github | lnls-fac/MatlabMiddleLayer-master | cc_all.m | .m | MatlabMiddleLayer-master/Release/links/sca/source/cc_all.m | 3,589 | utf_8 | efc4057bffe87ee8169fbd44dd3e7056 | function cc_all
disp(['Compiling matlab-channel access link on ', computer,'.'])
if strncmp(computer,'PC',2)
%disp(['Compiling: gpfunc.c']);
%mex -c -IC:\Greg\matlab\links\sca\include\win-x86 C:\Greg\matlab\links\sca\lib\win32-x86\gpfunc.c
%movefile('gpfunc.obj', 'C:\Greg\matlab\links\sca\lib\win32-x86... |
github | lnls-fac/MatlabMiddleLayer-master | untitled.m | .m | MatlabMiddleLayer-master/Release/links/mca/slider/untitled.m | 9,660 | utf_8 | 91eedbe437d5d84be4961387c2d32629 | function varargout = untitled(varargin)
% UNTITLED M-file for untitled.fig
% UNTITLED, by itself, creates a new UNTITLED or raises the existing
% singleton*.
%
% H = UNTITLED returns the handle to a new UNTITLED or the handle to
% the existing singleton*.
%
% UNTITLED('CALLBACK',hObject... |
github | lnls-fac/MatlabMiddleLayer-master | mcaslider.m | .m | MatlabMiddleLayer-master/Release/links/mca/slider/mcaslider.m | 10,254 | utf_8 | 0dc2eceacf4e5c2569992d25c21800e1 | function varargout = mcaslider(varargin)
% MCASLIDER M-file for mcaslider.fig
% MCASLIDER, by itself, creates a new MCASLIDER or raises the existing
% singleton*.
%
% H = MCASLIDER returns the handle to a new MCASLIDER or the handle to
% the existing singleton*.
%
% MCASLIDER('CALLBACK'... |
github | lnls-fac/MatlabMiddleLayer-master | untitled.m | .m | MatlabMiddleLayer-master/Release/links/mca/R3.13.4/mca/slider/untitled.m | 9,660 | utf_8 | 91eedbe437d5d84be4961387c2d32629 | function varargout = untitled(varargin)
% UNTITLED M-file for untitled.fig
% UNTITLED, by itself, creates a new UNTITLED or raises the existing
% singleton*.
%
% H = UNTITLED returns the handle to a new UNTITLED or the handle to
% the existing singleton*.
%
% UNTITLED('CALLBACK',hObject... |
github | lnls-fac/MatlabMiddleLayer-master | mcaslider.m | .m | MatlabMiddleLayer-master/Release/links/mca/R3.13.4/mca/slider/mcaslider.m | 10,254 | utf_8 | 0dc2eceacf4e5c2569992d25c21800e1 | function varargout = mcaslider(varargin)
% MCASLIDER M-file for mcaslider.fig
% MCASLIDER, by itself, creates a new MCASLIDER or raises the existing
% singleton*.
%
% H = MCASLIDER returns the handle to a new MCASLIDER or the handle to
% the existing singleton*.
%
% MCASLIDER('CALLBACK'... |
github | lnls-fac/MatlabMiddleLayer-master | intlat.m | .m | MatlabMiddleLayer-master/Release/at/atgui/intlat.m | 12,008 | utf_8 | 728e87772174914f2f0d0b188c228c47 | function intlat(varargin)
%INTLAT - interactive AT lattice editor
% INTLAT(DIRECTION)
% Direction is the initial angle[rad] of the orbit with respect
% to the plot axis
global THERING
if nargin < 1 | isnumeric(varargin{1})
if nargin == 1
STARTANGLE = varargin{1};
else
STARTANGLE = 0;
end... |
github | lnls-fac/MatlabMiddleLayer-master | readmad.m | .m | MatlabMiddleLayer-master/Release/at/lattice/readmad.m | 7,720 | utf_8 | b387d8d0beb0aac2a556560aca54cc20 | function ATLATTICE = readmad(FILENAME)
%READMAD reads the file output of MAD commands
% TWISS, STRUCTURE, SURVEY.
%
% ATLATTICE = readmad(FILENAME)
%
% READMAD reads the MAD file header to determine the number of elements
% in the lattice, symmetry flag, the number of supperperiods etc.
%
% Then it interprets... |
github | lnls-fac/MatlabMiddleLayer-master | readmad_old.m | .m | MatlabMiddleLayer-master/Release/at/lattice/readmad_old.m | 7,589 | utf_8 | a5b2d7c942847155075cc1b17d27a729 | function ATLATTICE = readmad(FILENAME)
%READMAD - Reads the file output of MAD commands
% TWISS, STRUCTURE, SURVEY.
%
% READMAD reads the MAD file header to determine the number of elements
% in the lattice, symmetry flag, the number of supperperiods etc.
%
% Then it interprets the entry for each element in the... |
github | lnls-fac/MatlabMiddleLayer-master | thinmpoleraddiffm.m | .m | MatlabMiddleLayer-master/Release/at/atphysics/thinmpoleraddiffm.m | 3,006 | utf_8 | 9c934f83e1f4500d880e450a91af7eaf | function [B66, M, rout] = findthinmpoleraddiffm(rin, PolynomA, PolynomB, L, irho, E0, max_order)
%FINDTHINMPOLERADDIFFM
% Physical constants used in calculations
persistent TWOPI CGAMMA M0C2 LAMBDABAR CER CU
if isempty(TWOPI) %Initialize constansts on the first call
TWOPI = 2*pi;
CGAMMA = 8.8... |
github | lnls-fac/MatlabMiddleLayer-master | findelemraddiffmatrix.m | .m | MatlabMiddleLayer-master/Release/at/atphysics/findelemraddiffmatrix.m | 12,009 | utf_8 | de678e361e45754393d48a06ea41c950 | function [B, M, O] = findelemraddifmat(ELEM,orbit,varargin)
%FINDELEMRADDIFMAT calculates element 'radiation diffusion matrix' B
% [B, M, ORBITOUT] = FINDELEMRADDIFMAT(ELEM, ORBITIN);
% Ohmi, Kirata, Oide 'From the beam-envelope matrix to synchrotron
% radiation integrals', Phys.Rev.E Vol.49 p.751 (1994)
%... |
github | lnls-fac/MatlabMiddleLayer-master | findthinmpoleraddiffm.m | .m | MatlabMiddleLayer-master/Release/at/atphysics/findthinmpoleraddiffm.m | 3,006 | utf_8 | 9c934f83e1f4500d880e450a91af7eaf | function [B66, M, rout] = findthinmpoleraddiffm(rin, PolynomA, PolynomB, L, irho, E0, max_order)
%FINDTHINMPOLERADDIFFM
% Physical constants used in calculations
persistent TWOPI CGAMMA M0C2 LAMBDABAR CER CU
if isempty(TWOPI) %Initialize constansts on the first call
TWOPI = 2*pi;
CGAMMA = 8.8... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.