mdsplus icon indicating copy to clipboard operation
mdsplus copied to clipboard

feature: jtraverser2 dynamically convert non-native floating formats

Open zack-vii opened this issue 1 year ago • 6 comments

  • this is an untested attempt to address issue #2576.
  • this is a cheap way to intercept unsupported dtypes converting them to native types.
  • it may be more performant to convert only in getValue/setValue/getAtomic ... but requires sub-classes of each Float32/64 and Compex32/64 as well as their Array variants.
  • this does not mark DTYPE_F etc. as supported but merely allows to import them from serialized sources.
  • this will not preserve the original dtype (mdsip cannot do raw float_x other than FT and FS)

zack-vii avatar Sep 05 '23 22:09 zack-vii

maybe one can test this and/or write an appropriate unit test

zack-vii avatar Sep 05 '23 22:09 zack-vii

Timo, I was testing your changes, but then I realized this will not work, because Float32(b) returns back already the wrong answer. And indeed, the call: (Float32)Mds.getLocal().getDescriptor("FS_FLOAT($)", new Float32(b)); does not work.

santorofer avatar Sep 08 '23 20:09 santorofer

hm if the data gets into Float32 via deserialization, it should contain the original byte code of a F_Float. the tdicall should use this byte code unchanged and feed it to FS_FLOAT. The returned bytcode for a FS float should deserialize into a Float32 with FS_FLOAT dtype.. well in theory .. I will check where it takes a different turn

zack-vii avatar Sep 09 '23 05:09 zack-vii

it seems the problem is that mdsip supports neither F_FLOAT nor G_FLOAT nor D_FLOAT as argument extension.

mdsconnect('thread://1')
Connected: user
1
mdsvalue('DECOMPILE($)', 1.234G0)
"1.234D0"

As you can see the value was transformed from G_FLOAT (G) to FT_FLOAT (D) when passed down the mdsip protocol. Hence mdsplus-api cannot use the mdsip backend to convert.

zack-vii avatar Apr 02 '24 12:04 zack-vii

@santorofer this time it should work, took me long enough to pick this one up again but here it hopefully is ;)

zack-vii avatar Apr 02 '24 14:04 zack-vii

Hi Timo, no problem. Excellent, I will test it and approve it as soon as I can.

santorofer avatar Apr 03 '24 18:04 santorofer