threshold

Making & changing box plugins and external apps
Post Reply
matthieuG
Posts: 54
Joined: Thu Nov 12, 2009 10:22 am
Location: grenoble

threshold

Post by matthieuG »

Hi,

I need a box which convert an analogical signal to a binary one through some constraint. So I will build it, as it doesn't exist, but I would like to see with you what is the best way to be generic, etc.

Exactly, I already have this kind of box but I set it with specific mean. In fact, I combine the ability to check the constraint for an amount of sample. I think now, it would be more generic if I use some boxes to do this : one for cropping samples (select samples), another one to convert this signal to a unique value (mean), and the last one to convert to binary (threshold).

So I can build a box with constraints like ==/value, min/threshold, max/threshold, min||max/thresholds, min&&max/thresholds, etc. I think the last paragraph describe how to add time constraint. Another point could be logical gate : and, or, xor, nor, etc. But maybe a matrix transformation (spatial filter) is enough?!
What do you advise me? (and in which category do I attach these boxes)

Thanks

yrenard
Site Admin
Posts: 645
Joined: Fri Sep 01, 2006 3:39 pm
Contact:

Re: threshold

Post by yrenard »

Dear matthieuG,

sorry I don't understand what you want to do here.

Yann

matthieuG
Posts: 54
Joined: Thu Nov 12, 2009 10:22 am
Location: grenoble

Re: threshold

Post by matthieuG »

OK maybe not so clear...

So I want to convert a filtered EEG signal to a boolean signal (true/false or so 0/1). Are you OK there is no actual box for this?

I already build some boxes for this process but I would like your advices to give you the best one. At this point I am pretty sure the basic box is a binarisation one : convert signal through ==, < or > test (with a parameter : the threshold). But maybe a segmentation is more generic. What do you thing about this?

Next, I need logic gate to allow global boolean operation. Does a box like this already exist? Does a specific box is needed?
I began to implement a specific one but after a while, I noticed the "GeluBox" (elementWiseOperation) can make this (if I upgrade a little bit its abilities : signal/stream matrix + more operator). So do you want that logic functions are processed by a mathematic function (min(x1+x2, 1) ; mod(x1+x2, 1), etc.) or do you want standard logic function as standard function (and, or, xor, etc.). Which compromise do you want : the lower boxes/function ; the lower boxes/functionality?

yrenard
Site Admin
Posts: 645
Joined: Fri Sep 01, 2006 3:39 pm
Contact:

Re: threshold

Post by yrenard »

Dear matthieuG,

I had to upgrade the simple DSP functionalities for some of our research. I just uploaded a those modifications to the SVN. If you update you SVN repository, you'll now be able to use logical operators (<, >, <=, >=, ==, !=, and <>) that return 1 when true, 0 when false. I also added a ternary operator with ? and : as in C++. I also added the possibility to add up to 16 inputs (you should use a, b, c... etc, x still works and is equivalent to a). Last, I added the possibility to work on any kind of streamed matrix by changing the type of the input / output (e.g signal or spectrum).

Tell me if that fits your needs.

Kind regards,
Yann

matthieuG
Posts: 54
Joined: Thu Nov 12, 2009 10:22 am
Location: grenoble

Re: threshold

Post by matthieuG »

It seems a good way.
Does &&, || also possible? Because the basic operation is AND, so it is also available by writing a==1 && b==1...but of course all boolean operators would be better (http://en.wikipedia.org/wiki/Logic_gate : whole operators here).
that's true (a==1+b==1)/2 could be ok if result is in integer...but I don't think so ;)
So my boxes are not yet usefull... the only use could be a dynamic one with the threshold changing...

matthieuG
Posts: 54
Joined: Thu Nov 12, 2009 10:22 am
Location: grenoble

Re: threshold

Post by matthieuG »

about boolean operator, ok. About 16 inputs...so you are integrating the "gelu box"? Do you allow elementwise operation and matrix operation?

yrenard
Site Admin
Posts: 645
Joined: Fri Sep 01, 2006 3:39 pm
Contact:

Re: threshold

Post by yrenard »

Dear matthieuG,

I will add boolean operations so you have everything needed...

This is not Gelu Ionescu's box, this is just an upgrade of the Simple DSP box.

Best regards
Yann

yrenard
Site Admin
Posts: 645
Joined: Fri Sep 01, 2006 3:39 pm
Contact:

Re: threshold

Post by yrenard »

Dear matthieuG,

the latest SVN now includes boolean operators :
  • ! for not
    &, && for and (those two are equivalent)
    |, || for or (those two are equivalent)
    ~, ^ for xor (those two are equivalent)
hope this helps,
best regards,
Yann

matthieuG
Posts: 54
Joined: Thu Nov 12, 2009 10:22 am
Location: grenoble

Re: threshold

Post by matthieuG »

ok thanks,

I watched your grammar. Maybe you could add in CBinaryFunctionSymbols min, max, modulus. I don't see more need at this moment.

yrenard
Site Admin
Posts: 645
Joined: Fri Sep 01, 2006 3:39 pm
Contact:

Re: threshold

Post by yrenard »

Dear matthieuG,

min and max can be easily achieved with ternary and comparison operators. modulus has no sense : we are working on real value.

hope this helps,
Yann

matthieuG
Posts: 54
Joined: Thu Nov 12, 2009 10:22 am
Location: grenoble

Re: threshold

Post by matthieuG »

yes that's true. :?

Post Reply