Skip to content

Issue when loading binary .uff in third-party software #91

Description

@vlef

Hello,

I'm encountering an error when loading a .UFF file generated by pyuff into a third-party software (such as NCode Glyphworks for example).

Importing the file results in abnormal values (cf picture below). This error only occurs when the export is in "binary" format.

Attached are two examples : Binary (incorrect) and ASCII (correct) exports. The only difference is the "Binary" field.

I'm using pyuff 2.4.3

Thanks for your help

image
image
test_ascii.uff.txt
test_binary.uff.txt

Activity

  1. jankoslavic commented on Sep 9, 2024

    @jankoslavic
    Contributor

    I can help you with debugging it. Can you please provide the minimal code you use?

  2. vlef commented on Sep 10, 2024

    @vlef
    Author

    Hi,

    Here is my minimal code, I just change the "binary" variable to export in ASCII or Binary encoding.

    ```
    import numpy as np
    from pyuff import UFF
    
    
    x = np.linspace(0, 1000)
    y = np.sqrt(x)
    
    binary = 0
    
    data = {'type': 58, 'binary': binary, 'id1': 'NONE', 'id2': 'NONE', 'id3': 'NONE',
            'id4': 'NONE', 'id5': 'NONE', 'func_type': 1, 'rsp_ent_name': 'Pt 1',
            'rsp_node': 0, 'rsp_dir': 0, 'ref_ent_name': 'NONE', 'ref_node': 0,
            'ref_dir': 0,
            'ord_data_type': 2, 'num_pts': 0, 'abscissa_spacing': 1, 'abscissa_min': 0,
            'abscissa_inc': 0, 'z_axis_value': 0, 'abscissa_spec_data_type': 17,
            'abscissa_len_unit_exp': 0, 'abscissa_force_unit_exp': 0,
            'abscissa_temp_unit_exp': 0, 'abscissa_axis_lab': 'Time',
            'abscissa_axis_units_lab': 's', 'ordinate_spec_data_type': 8,
            'ordinate_len_unit_exp': 0, 'ordinate_force_unit_exp': 0,
            'ordinate_temp_unit_exp': 0, 'ordinate_axis_lab': 'Displacement',
            'ordinate_axis_units_lab': 'mm', 'orddenom_spec_data_type': 0,
            'orddenom_len_unit_exp': 0, 'orddenom_force_unit_exp': 0,
            'orddenom_temp_unit_exp': 0, 'orddenom_axis_lab': 'NONE',
            'orddenom_axis_units_lab': 'NONE', 'z_axis_spec_data_type': 0,
            'z_axis_len_unit_exp': 0, 'z_axis_force_unit_exp': 0,
            'z_axis_temp_unit_exp': 0,
            'z_axis_axis_lab': 'NONE', 'z_axis_axis_units_lab': 'NONE',
            'data': y,
            'x': x}
    
    uff_file = UFF("test_ascii.uff")
    
    uff_file.write_sets(data)
    
  3. jankoslavic commented on Sep 11, 2024

    @jankoslavic
    Contributor

    Thank you @vlef .
    With the code provided everything works fine on my side. Can you please check you are using the latest version (2.4.3)?
    Did you by any chance write in and existing file? (in this case the new dataset is added at the end)

    Can you please double-check it? (and delete all prior test files, just in case so you do not append data)

  4. vlef commented on Sep 12, 2024

    @vlef
    Author

    Yes I'm using 2.4.3
    No, I create new file, there was no existing file.

    With the code provided everything works fine on my side

    Did you manage to import the generated binary UFF file in a third-party software such as NCode Glyphworks?

  5. jankoslavic commented on Sep 12, 2024

    @jankoslavic
    Contributor

    I am sorry, but I do not have NCode Glyphworks. But the data you provided in binary form is readable and does have the required data. I guess this is a problem of NCode, or?

    It could be that the NCode has problems with double precision. Can you try using single? Be careful that you use the option .write_sets(data, force_double=False) as pyuff by default forces double precision.

    Please report back the progress.

  6. jankoslavic commented on Sep 14, 2024

    @jankoslavic
    Contributor

    @vlef any progress? Can you try exporting from Ncode in binary format and importing it in pyuff?

  7. jankoslavic commented on Sep 25, 2024

    @jankoslavic
    Contributor

    @vlef can we close this issue?

  8. vlef commented on Sep 25, 2024

    @vlef
    Author

    Hi,

    the data you provided in binary form is readable

    Did you read the data with pyuff again? My point is that it is readable with pyuff, but not readable with other softwares (NCode, but also other signal analysis softwares)

    I can export binary signal from NCode and importing in pyuff without issues.

    Yes, I tried also with force_double=False, and the result is the same when importing the output in NCode :

    image

  9. jankoslavic commented on Sep 25, 2024

    @jankoslavic
    Contributor

    Can read the txt file in NCode and save it as binary from there? Please provide the binary file, as exported from NCode, here. I will try to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions