Jump to content

G.Treisbach

Members
  • Content Count

    2
  • Joined

  • Last visited

Posts posted by G.Treisbach


  1. Hi, with your VarPyth Demo I'm able to create a numpy array, fill it with data, "transfer" it to python, modify the data, "transfer" it back to delphi and use it in delphi without any problems.

    So far this works perfect.

     

    My problem is, that I have to use  time series data from a measurement device (I would like to calculate a fft with (numpy / scipy)  and do not know on how to transfer my time series data to python.
    Here is my "Pseudo-Code":

    procedure TForm1.FormCreate(Sender: TObject);
    begin
       var np                := Import('numpy');
       var np_array: Variant := np.zeros(10);  // 'normally this will be at least 96000 elements
    
       np_array[0] := 0.00123;
       np_array[1] := 0.43312;
       np_array[2] := 0.20033;
       np_array[3] := 0.00111;
       ...
       and so on
    
       PythonModule.SetVar('np_array', ExtractPythonObjectFrom(np_array));
    end;

    Of cause this doesn’t work, because np_array contains only one element, and this is my numpy-array that is containing 10 elements each set to 0.

    I'm looking for a possibility to create a numpy array in Delphi, fill all elements to the appropriate values and then assign the array to a variant, so that I can use the given mechanism to transfer the data into the python world.

     

    Maybe there is another (better, mor simple) solution available?

     

    Thanks for your help

      Gerhard

×