| Author |
Message |
Gmartin3
Joined: Oct 19, 2021 Posts: 97
|
Posted: Jul 1, 2026 12:43 AM Post subject: Java code |
|
| I may be able to create Java code to calculate computational entropy. If I can manage that would it be possible to use the custom element to implement it. |
|
 |
jarek
Joined: Oct 22, 2007 Posts: 1098
|
Posted: Jul 4, 2026 5:25 PM Post subject: |
|
Yes, but it may be much easier to do this in ExpressionEvaluator.
Use the advanced property "Declaration" and put all your java function there and then call this function from the main expression. If you work with AI this is the easiest way, because you only implement 1 java method.
For example ask AI to generate "java 1.6 static method <yourname> which takes 1 float number input and outputs 1 entropy value", then in your main expression execute it like this:
yourGeneratedFunction(In1) |
|
 |
Gmartin3
Joined: Oct 19, 2021 Posts: 97
|
Posted: Jul 4, 2026 5:49 PM Post subject: |
|
Thanks for this I do use ai to help with this but the ai says it needs to calculate some non math process that may not work in the expression evaluator.
I have follow-up questions 1 can the xmlnet server accept raw eeg data
Is there a means to get data back into BioEra from xml net server or via serial |
|
 |
Gmartin3
Joined: Oct 19, 2021 Posts: 97
|
Posted: Jul 4, 2026 7:32 PM Post subject: |
|
This is what Claude returned along with the Java expression
Whether it permits full class definitions with static fields (needed for the rolling buffer), or only a single method body — if it’s the latter, the state would need to live somewhere else BioEra provides (a persistent variable mechanism, if one exists). 2. Whether String.substring/StringBuilder are available in its Java subset — some embedded evaluators restrict java.lang to arithmetic only.
Can this be done. |
|
 |
jarek
Joined: Oct 22, 2007 Posts: 1098
|
Posted: Jul 4, 2026 9:36 PM Post subject: |
|
XmlNetServer is used to send BioERa data out to other apps, it can't be used to receive data.
SerialPort, yes, both directions. But please note the serial port uses 8bit integers. So to exchange float numbers you need some wrapper like TextStreamToScalars.
Another way to receive data back to BioEra would be with NetworkServer/NetworkClient and then connect it to TextStreamToScalars.
Yes, you would need a rolling buffer. You can add many methods/functions in the "Declaration", and many local properties/fields. So the rolling buffer can be there too, outside of the main function. I only mentioned one static function which is the simplest form, but many others are possible.
Yes, StringBuilder is possible there too. Pretty much all java is possible there.
This way of using ExpressionEvaluator was succesfully done by other people, it does work, just need to experiment a bit. |
|