LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Logarithmic Binning Histogram

by this way I miss the data in short times. I need the fine bins also in short times.

0 Kudos
Message 11 of 18
(829 Views)

@Noa_A wrote:

I mean how can I define "np.logspace" in LabView to wire it to the interval of LabView histogram.


I suppose you could try creating your own Histogram using an XY graph - and define the X point for each Y, but that seems OTT.
but you seem to think that you know better than all the people at NI who develop Graphs for academia and industry, so maybe you've got a niche requirement - or maybe you've misunderstood what you're looking at. 😉

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 12 of 18
(828 Views)

In my case the x scale is time. I miss the data in small x.

0 Kudos
Message 13 of 18
(825 Views)

Thanks for your helpful answer. 

0 Kudos
Message 14 of 18
(823 Views)

Hi Noa,

 


@Noa_A wrote:

The problem is that I dont want to use Python. I just want to have the bins that are equally spaced in the x scale (that is logarithmic) all in labview.


Use the GeneralHistogram function and provide your own "bins" array!

 


@Noa_A wrote:

I mean how can I define "np.logspace" in LabView


By using the log10/power functions you can easily calculate your bin borders. After all it's simple math:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 15 of 18
(809 Views)

Hi GerdW,

Thanks a lot. That is exactly what I want.

 

Actually, I'm new in LabView, I did this as you said.

Now, in the bin array part I'm not sure I'm doing the correct thing or not.

 

Here, I'm trying to make the bin width equal to 2 and set the inclusion to upper (just as an example).

Noa_A_0-1641565857664.png

Do you think is this correct way to do that or I'm completely wrong?

 

Best

0 Kudos
Message 16 of 18
(803 Views)

@Noa_A wrote:

Actually, I'm new in LabView, 


Start with the training resources listed at the top of the forum. Once you learn that it is spelled LabVIEW, you will be 10% closer. 😄

 


@Noa_A wrote:

Do you think is this correct way to do that or I'm completely wrong?

 


No, nothing here makes any sense!!! If you want help, attach your VI and some data. Pictures are often useless to tell what's wrong (with some exceptions

 

 

altenbach_0-1619056360492.png

0 Kudos
Message 17 of 18
(791 Views)

Hi Noa,

 


@Noa_A wrote:

Now, in the bin array part I'm not sure I'm doing the correct thing or not.

 

Here, I'm trying to make the bin width equal to 2 and set the inclusion to upper (just as an example).

 

Do you think is this correct way to do that or I'm completely wrong?


To add to Christians answer (I agree on that "image of code" topic, too!):

You are not "doing the right thing"! When you want logarithmic binning you (usually) don't use the same size of the bin!

  • With linear binning your bins are (usually) of same size, so you can ADD binsize to lower bin limit to determine the upper bin limit.
  • With logarithmic scaling your bins should have the same proportions (on a logarithmic scale), so you usually MULTIPLY a constant to the lower bin limit to determine the upper bin limit…
  • Generic advice: with "linear scales" you use ADD/SUB operations, with "logarithmic scales" you use MULTIPLY/DIVIDE operations…

 

In fact you could use each pair of elements from that array of bins to set them as lower/upper limit, then choose a mode where the upper limit is not included in the bin!

 

More problems:

  • Why do you use log10(x)? In my image I showed you how to use the 10^x function to calculate logarithmic steps…
  • Why don't you use the +1/-1 functions when you want to add/sub exactly 1?
  • Why do you use a while loop when you know the number of loop iterations before entering the loop? EVERY (other) programming language recommends to use FOR loops in such cases! And with LabVIEW you get autoindexing for free…
  • Why don't you use more descriptive labels for all your controls/indicators?
  • Why don't you cleanup the code? (In your case even the AutoCleanup tool will improve the code…)
  • What's the point of setting the log(x) elements as bin "inclusion" setting (after conversion to U32)? Did you read the LabVIEW help for that function, which explains the expected values for that item? (I guess you want to use the "Lower" inclusion mode - as described in the help! RTFM…)

Well: if you would attach "code" instead of an "image of code" I might be tempted to edit that code. But unfortunately we cannot edit/debug/run "images of code" with LabVIEW…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 18 of 18
(782 Views)