Open msimar opened 9 years ago
Hi msimar!
I tested the examples as you had and managed to replicate the error. Turns out the Python code for the client (https://github.com/bwrc/midas/wiki/Creating-a-client) contained some typos which have now been fixed.
For reference heres the output I get with the new client code: $ python3 client.py {'metric_a_Ch1_1_3': 0.8459284727850395}
-jt
Thanks, it works. now getting an output !!
How metric evaluation happens in Midas from raw data ?
Hi!
How metric evaluation happens in Midas from raw data ?
- Metric functions are (usually) internal class methods of the node.
- You make metric functions "visible" to the MIDAS by adding them to the self.metric_functions list in init method
- Each metric function must take at least one argument. The first positional argument is the data the user specified during their request. So for example
http://localhost:8080/example_node_A/metric/metric_b:Ch1/0.01
would call metric function 'metric_b' using 0.01 seconds of data from channel 'Ch1' This means the first positional argument of 'metric_b' is a dict containing channel names and data values. For the example query above the input argument would be this (underlying data has a sampling rate of 500 Hz):
{'data': [[6.0, 7.0, 8.0, 9.0]], 'names': ['Ch1']}
It is also possible to call a metric function with multiple channels. Example:
http://localhost:8080/example_node_A/metric/metric_b:Ch1,Ch2/0.01
{'data': [[74.0, 75.0, 76.0, 77.0], [74.0, 75.0, 76.0, 77.0]], 'names': ['Ch1', 'Ch2']}
The midas_node_example_A.py is a little bit misleading because the method 'metric_b' does not calculate anything from the input argument. Heres an example metric function that calculates the mean of the first channel from the data it got as input.
def metric_b(self, x):
result = numpy.mean(x['data'][0])
return result
Hi Midas Team
As per my observation, the step by step guide to run midas and do some test is missing in the documentation. I follows the example:
Start stream : midas_stream_example.py Start Node A : midas_node_example_A.py config.ini node_A Start Node B : midas_node_example_B.py config.ini node_B Start Dispatcher : midas_dispatcher_example.py config.ini dispatcher
then what should be the next step ?
I created client as mention in wiki. I am getting following output : $ python client.py {'metric_a': 'unknown metric and/or channel', '3': 'unknown metric and/or channel', '1': 'unknown metric and/or channel', 'Ch1': 'unknown metric and/or channel'}
Kindly guide on how to proceed further.