블로그 이미지
환무

Notice

Recent Post

Recent Comment

Recent Trackback

Archive

calendar

1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
  • total
  • today
  • yesterday
2018. 4. 12. 11:11 Study/Magnetic tweezers

offset data 읽어서 바닥면 정의



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%  Top level section 1: FX1_DETERMINE_ZOFFSET  %%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 

if 1

    

    %%% This is the first section in a series of routines to analyze

    %%% force-extension data taken with the new multi bead code for MT

    %%% (J. P. Cnossen, D. Dulin and N. H. Dekker Rev Sci Instrum 85, (2014).)

    %%%

    %%% This section is used to determine the z-offset for each bead

    %%% ---

    %%% To determine the z-offsets, record bead position traces under conditions

    %%% where the beads are essentially at the surface, either by going to very

    %%% low (essentially zero) stretching force or by going to a large number

    %%% of supercoils /turns under low forces.

    %%%

    %%% - Set the file names and path informaiton in the "DATA" block below.

    %%% The variable "DATA" controls which data sets are read and analyzed.

    %%%

    %%% - The code determines the offset by smoothing the position traces with a

    %%% window of Nsmooth points abd takes the minimum of the smoothed traces

    %%% as the surface position = z-offset

    %%%

    %%% - The results get saved into a file of which the name is set through the

    %%% "output_name" variable. Format is first colum = bead number, second

    %%% column = offset in mum

    %%%

    %%% Author: Jan Lipfert

    %%% Date: 2013-09-16

    

    clear all; clc; close all;

    

    

    %%% Index to select which data set to run

    DATA = 1;

    

    

    %%% Write here some descriptive text about your data

    %%% ---

    %%% Example data set on FX measurements; M270 beads, 21 kbp DNA

    if DATA ==1

        traces_file = 'offset.txt';

        motors_file = 'offset_motors.txt';

        output_name = 'FX_offsets.txt';

        Nref = 1;

    end

   %% 읽을 파일 및 출력할 파일에 대한 이름 정의    


    Nsmooth = 100;

    

    

    %%%%%%%%%%%%%%%%%%%%%%%

    %%%--- Read in data ---

    %%%%%%%%%%%%%%%%%%%%%%%

    

    data = load(traces_file);

    zmag = load(motors_file); % for this example, motor file contains just the data of zmag

   %% 바닥면에 대한 bead data와 자석의 높이에 대한 정보값 loading    

    

    %%%--- Parse the bead data ---

    % For this example, there is just one bead, which is already corrected by reference

    % bead. The dimensions of y and z are the only columns saved for this example.

    for i=1

        display(['Parsing data for bead ' num2str(i) ' of ' num2str(1)])

        bead(i).time = 1:length(data(:,1));

        bead(i).x = data(:,1);

        bead(i).y = data(:,2);

        bead(i).z = data(:,3);

    end

       %% bead 구조체에 loading 한 data 할당

    %%% --- Plot the motor information --- %%%

    if 1

        %%% Plot the magnet height information

        figure(100);clf; hold on; box on; %%% Magnet rot. vs. time

        faketime = 1:length(zmag);

        plot(faketime , zmag, 'r-')

        set(gca, 'fontsize', 16, 'linewidth', 1, 'fontweight', 'bold','TickLength',[0.02 0.02]);

        xlabel('Time (frames)'); ylabel('Zmag (mm)')

        title('Motor height')

        

    end

    

    z_offsets = [];

    %%% Loop over beads and show the height information

    if 1

        

        

        for i=1 % for this example, there is just one bead

            figure(1); clf; hold on; box on;

            plot(bead(i).time, bead(i).z, 'k-', 'linewidth', 1)

            

            %%% Smooth and find minimum

            smooth_z = smooth(bead(i).z, Nsmooth, 'moving');

            plot(bead(i).time, smooth_z, 'r-', 'linewidth', 2)

            

            %[min_z ind] = min(smooth_z);

            [max_z ind] = max(smooth_z);

            plot(bead(i).time(ind), smooth_z(ind), 'bx', 'linewidth', 2, 'markersize', 20)

            

            %z_offsets = [z_offsets min_z];

            z_offsets = [z_offsets max_z];

         %%  우리 장치에서는 가장 큰 값이 바닥면에 대한 값으로 추출

            

            set(gca, 'fontsize', 16, 'linewidth', 1, 'fontweight', 'bold','TickLength',[0.02 0.02]);

            xlabel('Time (s)'); ylabel('z (um)')

            title(['Bead # ' num2str(i)])

            pause;

            

        end

    end

    

    

    %%% Plot the offsets

    if 1

        figure(2); clf; hold on; box on;

        plot(1, z_offsets, 'bo', 'linewidth', 2, 'markersize', 20)

        set(gca, 'fontsize', 16, 'linewidth', 1, 'fontweight', 'bold','TickLength',[0.02 0.02]);

        xlabel('Bead #'); ylabel('z-offset (um)')

        

    end

    

    %%% Save the data

    if 1

        foo = [(1)' z_offsets'];

        save(output_name, 'foo', '-ascii')

        

    end

       %% 바닥면에 대한 정보 추출 하여 저장

    

end



'Study > Magnetic tweezers' 카테고리의 다른 글

FX4_ANALYZE_Lp_Lc  (0) 2018.04.12
FX3_ANALYZE  (0) 2018.04.12
FX2_LOAD_RAW  (0) 2018.04.12
force analysis Matlab code by Nynke Dekker lab(2014-Dec-3)  (0) 2018.04.12
장비 세부 내역  (0) 2018.04.06
posted by 환무