Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Pygaze TSV File - Tobii Pro SDK

Sorry for cross posting this issue here https://github.com/esdalmaijer/PyGaze/issues/123

I am using a Tobii tx300 with opensesame and I am experiencing an issue with the way the TSV file in open sesame is logging information.

While the time stamps and the rest of the raw data is logged to the tsv file, in some cases this is logged in the wrong columns (see photo), when logging a message (e.g. start trial or stop trial).

I should point that this appears to be random, and for that reason it makes it hard to just correct it by writing a R script or something of sorts. It kinda forces you to double check and correct for this manually., by readjusting the time-stamp to it's column, the message as well as some of the gaze values (Gazepoints, validity and pupil).

@esdalmaijer do you have any idea of what may be causing this?

Just for reference, this is how a similar message should be logged

and this should match these column labels

Thank you,

Cheers!

Helio

Comments

  • Sorry the photos where not attached to the post.

    here is the example of the problem

    this is how a similar message should be logged

    and the column labels


  • Hello,

    I am sorry, I can't help. I just post because I am facing exactly the same problem with X3-120 Tobii tracker... And yes, it seems quite difficult to correct that through a script (I am currently trying in VBA).

    I am also curious to know the reasons of this.

    Best regards,

    Damien

  • Hello,

    While waiting the issue is solved, I have created a small VBA (Excel ; sorry ! :) ) program that seems to handle this problem. I am definitly not an expert, so the program is probably not optimal, and it likely contains some bugs (though, as far as I know, it worked well for me). I provide it as such as it might help.

    Sub modif_Tobii_OS_errors()
    
        Dim var_cell As Object
        Dim string_to_modify As String
        Dim num_line_error As Long
        Dim num_column_error As Long
        Dim last_line As Long
        Dim c As Range
        
        last_line = Cells(100000, "A").End(xlUp).Row                            'determine the last row of the table
        num_line_error = Cells(1, 1).End(xlDown).Row                            'find the first problem row (i.e. with first cell empty)
        
        While num_line_error < last_line
               
            'find the problematic cell in the row (i.e. containing "var", or "start" or "stop")
            Set var_cell = Rows(num_line_error).Find("var")
            If var_cell Is Nothing Then
                Set var_cell = Rows(num_line_error).Find("start")
                If var_cell Is Nothing Then
                    Set var_cell = Rows(num_line_error).Find("stop")
                End If
            End If
            
            num_column_error = var_cell.Column - 1
            string_to_modify = Cells(num_line_error, num_column_error)
        
            'move temporarily the second line cells on the right
            Range(Cells(num_line_error + 1, num_column_error + 1), Cells(num_line_error + 1, 14)).Value _
                    = Range(Cells(num_line_error + 1, 2), Cells(num_line_error + 1, 15 - num_column_error)).Value
            Range(Cells(num_line_error + 1, 2), Cells(num_line_error + 1, 15 - num_column_error)).ClearContents
            
            'Determine the "normal" length of the cell to modify (I check the cell just above, which is a bit hazardous, but I did not found a better way...)
            len_string = Len(Cells(num_line_error, num_column_error).End(xlUp))
            'and then move the "excess" toward the second line first cell
            Cells(num_line_error + 1, 1) = Right(string_to_modify, Len(string_to_modify) - len_string)
            'and clear it
            Cells(num_line_error, num_column_error) = Left(string_to_modify, len_string)
            
            'Move the "var" cell content
            Cells(num_line_error + 1, 2) = Cells(num_line_error, num_column_error + 1)
            Cells(num_line_error, num_column_error + 1).ClearContents
            
            'move definitly the second line cells on the top (first line)
            Range(Cells(num_line_error, num_column_error + 1), Cells(num_line_error, 14)).Value _
                    = Range(Cells(num_line_error + 1, num_column_error + 1), Cells(num_line_error + 1, 14)).Value
            Range(Cells(num_line_error + 1, num_column_error + 1), Cells(num_line_error + 1, 14)).ClearContents
            
            'Go to the next problematic line
            num_line_error = Cells(num_line_error + 2, 1).End(xlDown).Row
                
        Wend
        
    End Sub
    

    Now, I will try to automatize the modification of several files at once.

    @heliocuve please tell me if it helps and works for you. Please also tell me if you have news !

    Cheers,

    Damien

  • Hello,

    While waiting the issue is solved, I have created a small VBA (Excel ; sorry ! :) ) program that seems to handle this problem. I am definitly not an expert, so the program is probably not optimal, and it likely contains some bugs (though, as far as I know, it worked well for me). I provide it as such as it might help.

    Sub modif_Tobii_OS_errors()
    
        Dim var_cell As Object
        Dim string_to_modify As String
        Dim num_line_error As Long
        Dim num_column_error As Long
        Dim last_line As Long
        Dim c As Range
        
        last_line = Cells(100000, "A").End(xlUp).Row                            'determine the last row of the table
        num_line_error = Cells(1, 1).End(xlDown).Row                            'find the first problem row (i.e. with first cell empty)
        
        While num_line_error < last_line
               
            'find the problematic cell in the row (i.e. containing "var", or "start" or "stop")
            Set var_cell = Rows(num_line_error).Find("var")
            If var_cell Is Nothing Then
                Set var_cell = Rows(num_line_error).Find("start")
                If var_cell Is Nothing Then
                    Set var_cell = Rows(num_line_error).Find("stop")
                End If
            End If
            
            num_column_error = var_cell.Column - 1
            string_to_modify = Cells(num_line_error, num_column_error)
        
            'move temporarily the second line cells on the right
            Range(Cells(num_line_error + 1, num_column_error + 1), Cells(num_line_error + 1, 14)).Value _
                    = Range(Cells(num_line_error + 1, 2), Cells(num_line_error + 1, 15 - num_column_error)).Value
            Range(Cells(num_line_error + 1, 2), Cells(num_line_error + 1, 15 - num_column_error)).ClearContents
            
            'Determine the "normal" length of the cell to modify (I check the cell just above, which is a bit hazardous, but I did not found a better way...)
            len_string = Len(Cells(num_line_error, num_column_error).End(xlUp))
            'and then move the "excess" toward the second line first cell
            Cells(num_line_error + 1, 1) = Right(string_to_modify, Len(string_to_modify) - len_string)
            'and clear it
            Cells(num_line_error, num_column_error) = Left(string_to_modify, len_string)
            
            'Move the "var" cell content
            Cells(num_line_error + 1, 2) = Cells(num_line_error, num_column_error + 1)
            Cells(num_line_error, num_column_error + 1).ClearContents
            
            'move definitly the second line cells on the top (first line)
            Range(Cells(num_line_error, num_column_error + 1), Cells(num_line_error, 14)).Value _
                    = Range(Cells(num_line_error + 1, num_column_error + 1), Cells(num_line_error + 1, 14)).Value
            Range(Cells(num_line_error + 1, num_column_error + 1), Cells(num_line_error + 1, 14)).ClearContents
            
            'Go to the next problematic line
            num_line_error = Cells(num_line_error + 2, 1).End(xlDown).Row
                
        Wend
        
    End Sub
    

    Now, I will try to automatize the modification of several files at once.

    @heliocuve please tell me if it helps and works for you. Please also tell me if you have news !

    Cheers,

    Damien

    Thanked by 1heliocuve
  • Hi @Damien


    thanks so much for this, it's really cool that this solution works for you. I will try it tomorrow once I get to the lab and will let you know.


    Cheers,

    Helio

Sign In or Register to comment.