Author Topic: Ways to access the bin_data array in using the BinAndReduceModifier  (Read 915 times)


  • Newbie
  • *
  • Posts: 2
Hello Dr. Stukowski and everyone,

   I would like to ask for the way to call the bin_data array when using the BinAndReduceModifier in batch-processing, as no similar example could be found in the online documentation. Part of the code is attached:
    modifier = BinAndReduceModifier()
    modifier.bin_count_x = 100      = "coordination"
    modifier.direction      = BinAndReduceModifier.Direction.Vector_1
    modifier.propertyreduction_operation = BinAndReduceModifier.Operation.Mean
    So what is the values in the bin_data array?

Best Regards

Alexander Stukowski

  • Administrator
  • Hero Member
  • *****
  • Posts: 638
Re: Ways to access the bin_data array in using the BinAndReduceModifier
« Reply #1 on: January 05, 2017, 09:38:37 PM »
Hi Leal,

I'm not sure if I can tell you much more than what is already said in the documentation.

Your code is sufficient to set up the modifier. Next you need to call node.compute(). Subsequently, you can access the computed data through the modifier's bin_data property. In this specific case, it refers to a one-dimensional array with 100 entries, holding the mean coordination number of particles within the 100 slices along the x-axis of the simulation cell.

Code: [Select]

mean_coordination = modifier.bin_data
assert(len(mean_coordination) == modifier.bin_count_x)

Let me know if you need further help with this.