DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

DIAdem Dataplugin read binary file

I use .airaw binary file. I want to make a dataplugin for DIAdem. I am on processing now. But, I have a few questions about that.

 

Q. Data Format is down below. How can I write the script for multiple read?

- ex) CH0, CH1, CH2, CH0, CH1,CH2 ...(N1 times, 3 channels) CH4, CH5, CH4, CH5... (N2 times, 2 channels)

- Because of this I need to read CH0,1,2 data N1 times first and then move to CH4,5 data N2 times.

- N1 and N2 is different

- Each data group has a different number of channels

 

Q. Channel is automatically assigned to the data followed by there dim creation order?

0 Kudos
Message 1 of 8
(4,191 Views)

The binary block supports channels with contiguous values as described for your data format.

Depending on the data layout, you can use one ore multiple binary block to define your channels.

 

Channels created with the binary block are not assigned automatically, but you need to define a target group. The loading order of the channels is defined by the order of adding channels from the block to the group.

 

  Dim oGroup
  Set oGroup = Root.ChannelGroups.Add("group")
  ...  
  Dim oBlock, N1
  Set oBlock = file.GetBinaryBlock()
  N1 = 3
  Dim i
  For i = 1 To NumberOfChannels
    Dim chn
    Set chn  = oBlock.Channels.Add("chn" & i, eR64, N1)
    oGroup.Channels.AddDirectAccessChannel(chn)
  Next

 

0 Kudos
Message 2 of 8
(4,091 Views)

Thanks for your help. I will test it!

 

I have a questions about your example.

According to your script, you define the multiple channels defined 'chn1..n' under the 'oBlock'. In that case, If I define the five channels, than data will be recorded as above.

Ch1 Data1 Data6...

Ch2 Data2 Data7...

Ch3 Data3 Data8...

Ch4 Data4 Data9...

Ch5 Data5 Data10...

Is that right?

But, What I want to do is down below.

Ch1 Data1 Data4...

Ch2 Data2 Data5...

Ch3 Data3 Data6...

Ch4 Data7 Data9...

Ch5 Data8 Data10...

Is that possible if I use your example? Is this case need a multiple binary block?

 

Please help me, I am newbie. Thanks.

0 Kudos
Message 3 of 8
(3,711 Views)

Hi,

 

I tested the example that you sent.

The result is down below. (Number of Channel = 5, N1 = 2)

Ch1 Data1 Data2...

Ch2 Data3 Data4...

Ch3 Data5 Data6...

Ch4 Data7 Data8...

Ch5 Data9 Data10...

 

As I mentioned in previous reply, Call specified channel group in multiple times and go to the next channel group is my goal. Reference is above reply.

I am very appreciate for your help.

0 Kudos
Message 4 of 8
(3,655 Views)

Hi, 

my understanding of the data layout was wrong.

 

Please try (and adjust as needed) the following script.

Dim oGroup
  Set oGroup = Root.ChannelGroups.Add("group")
  ...
  Dim oBlock, N1, N2
  N1 = 4
  N2 = 6
  Set oBlock = File.GetBinaryBlock()
' Read 3 channels with channels length N1
  oBlock.BlockLength = N1
  Dim i
  For i = 1 To 3
    Dim chn
    Set chn = oBlock.Channels.Add("chn_" & i, eR64)
    oGroup.Channels.AddDirectAccessChannel(chn)
  Next
  ...
' Read 2 channels with channel length N2
  oBlock.BlockLength = N2
  oBlock.Position = FilePositionForNextChannels
  For i = 1 To 2
    Dim chn
    Set chn = oBlock.Channels.Add("chn_" & i, eR64)
    oGroup.Channels.AddDirectAccessChannel(chn)
  Next

 

0 Kudos
Message 5 of 8
(3,585 Views)

Hi,

Thanks for reply. It is very helpful to me. I tested that you gave. Result is down below. Data is from 0 to 50.

Spoiler

Option Explicit

Sub ReadStore(File)

Dim oGroup
Set oGroup = Root.ChannelGroups.Add("group")
'...
Dim oBlock, N1, N2
N1 = 4
N2 = 6
Set oBlock = File.GetBinaryBlock()
' Read 3 channels with channels length N1
oBlock.BlockLength = N1
Dim i
For i = 1 To 3
Dim chn
Set chn = oBlock.Channels.Add("chn_" & i, eI32)
oGroup.Channels.AddDirectAccessChannel(chn)
Next
'...
' Read 2 channels with channel length N2
oBlock.BlockLength = N2
oBlock.Position = 40
For i = 1 To 2
'Dim chn
Set chn = oBlock.Channels.Add("chn_" & i+3, eI32)
oGroup.Channels.AddDirectAccessChannel(chn)
Next

End Sub

I use this code. the result was..

Sample_Test.PNG

It looks like File.Position in the same block cannot acts as a divider of the file. Also N1,N2 is not working. Only the bigger number is working.

 

So, Using your code as a reference, I use one more block and channel group for dividing file. Source code is down below.

Spoiler

Option Explicit

Sub ReadStore(File)

Dim oGroup
Set oGroup = Root.ChannelGroups.Add("Block1")
'...
Dim oBlock, N1, N2
N1 = 4
N2 = 6
Set oBlock = File.GetBinaryBlock()
' Read 3 channels with channels length N1
oBlock.BlockLength = N1
Dim i
For i = 1 To 3
Dim chn
Set chn = oBlock.Channels.Add("chn_" & i, eI32)
oGroup.Channels.AddDirectAccessChannel(chn)
Next
'...
' Read 2 channels with channel length N2
Dim oBlock2, oGroup2
Set oGroup2 = Root.ChannelGroups.Add("Block2")
Set oBlock2 = File.GetBinaryBlock()
oBlock2.BlockLength = N2
oBlock2.Position = 40
For i = 1 To 2
'Dim chn
Set chn = oBlock2.Channels.Add("chn_" & i+3, eI32)
oGroup2.Channels.AddDirectAccessChannel(chn)
Next

End Sub

Also the result was..

Sample_Test_2.PNG

As a result, this is what I want.

But, In this case, I used 2 blocks and 2 groups.

 

This is my last questions..

Is it possible to make this structure using one block and group?

Did I something wrong when I use your example?

Please let me know if I did something wrong.

0 Kudos
Message 6 of 8
(3,569 Views)

+ Question

 

Is this case, DataplugIn read only once. But my file have a multiple set of this data structure. What can I do for it?

0 Kudos
Message 7 of 8
(3,563 Views)

There is no restriction where to add a direct access channel from the block. How blocks and groups are connected is up to you. You can add add each channel of a block to an own group, or add channels from different blocks to one group.

If you have more data structures in you file, just create a new block and assign the resulting channels to the group of your choice.

0 Kudos
Message 8 of 8
(3,492 Views)