How can count amount peak of graph ? - Printable Version +- phyphox Forums (https://phyphox.org/forums) +-- Forum: App-Feedback (https://phyphox.org/forums/forumdisplay.php?fid=6) +--- Forum: Experiment editor (new Blockly-based version) (https://phyphox.org/forums/forumdisplay.php?fid=15) +--- Thread: How can count amount peak of graph ? (/showthread.php?tid=2033) |
How can count amount peak of graph ? - Newcomer - 10-31-2024 Hi .This is the first time I have used Phyphox and I have some problems. Now I'm making a simple sensor that measures heart beat rate by acceleration without g(Y-Axis), the graph shows a peak of a graph like an electrocardiogram and we can count a peak of the graph and calculate to BPM Ex.measure in 20s BPM = amount of peak x 3 And this is my question 1. how can count the amount of peak in the graph?. this is the first time and I don't know what blog or function can work. I'm guessing it is a threshold blog but I'm not sure it gonna work 2. Why does the graph not look the same in the app? It looks like it's not stable. I think I missed some setting or something. => After Trial and error just have 0hz no average RE: How can count amount peak of graph ? - Jens Noriʇzsɔɥ - 10-31-2024 You could have a look at the “Motion Stopwatch” that has likely most of the functionality implemented (particularly, check the “many” tab). Personally, I would start with it and kick anything out that looks unneeded – and learn a lot doing that because Sebastian has included some magic… Have you tried a rate of 100 Hz like in the original graph? It could be that you just miss the full height with a lower rate. RE: How can count amount peak of graph ? - Newcomer - 11-01-2024 After I tried dissecting the code, it seemed complex and quite error-prone. So now, I'm attempting to do it in my way. Could you review my code and help me why it's not working? The issue seems to be with the if function count = count+1, and I'm wondering how to write it correctly in this style or simiar logic. acc = input y, acct = input time and idk just need to use append or not simple logic count = 0 if y value > threshold(approximately 0.2) => count = count+1 BPM = count*3(measure in 20s) RE: How can count amount peak of graph ? - Jens Noriʇzsɔɥ - 11-01-2024 It would be much easier if you could simply copy the code into a text file and share it as an attachment. On append: it makes sense to rewatch the part on containers, “keep”, and “append” of the introductory video. The phyphox containers behave quite different to regular variables. For debugging purposes, it makes sense to export the containers that you are working with and verify the data that you would expect is actually in there. HTH a bit. RE: How can count amount peak of graph ? - Newcomer - 11-01-2024 this is my code without an if blog because it can't generate so I know that bug here now i didn't ✓ anything you can see a if blog in previous pic <phyphox xmlns="https://phyphox.org/xml" version="1.18"> <title>New Experiment</title> <category>No Category</category> <data-containers> <container size="0">acc</container> <container size="0">acct</container> <container size="0">accCopy</container> <container size="0">acctCopy</container> <container size="0">max</container> <container size="0">t</container> <container size="0">count</container> <container size="0">BPM</container> </data-containers> <input> <sensor type="linear_acceleration"> <output component="y">acc</output> <output component="t">acct</output> </sensor> </input> <analysis> <append> <input>acc</input> <output>accCopy</output> </append> <append> <input>acct</input> <output>acctCopy</output> </append> <max> <input as="x">acctCopy</input> <input as="y">accCopy</input> <output as="max">max</output> <output as="position">t</output> </max> <multiply> <input>count</input> <input type="value">3</input> <output>BPM</output> </multiply> </analysis> <views> <view label="New View"> <graph label="New Graph"> <input axis="x">acct</input> <input axis="y">acc</input> </graph> <value unit="BPM" label="your heart beat rate is"> <input>BPM</input> </value> </view> </views> </phyphox> RE: How can count amount peak of graph ? - Newcomer - 11-01-2024 time zone gonna kill me, Up until now, I still don't know how to write. I still don't know the purpose of some blogs If anything is wrong, you know I'm just guessing. RE: How can count amount peak of graph ? - Jens Noriʇzsɔɥ - 11-01-2024 It's not so much the time difference but rather the federal holiday here today… RE: How can count amount peak of graph ? - Jens Noriʇzsɔɥ - 11-01-2024 Your project is rather ambitious for first steps with the editor. Perhaps it is a good idea to have an eye on the (technical) documentation of the file format in our wiki: https://phyphox.org/wiki/index.php/Phyphox_file_format RE: How can count amount peak of graph ? - neoaliphant - 11-02-2024 This sounds a biyt like the morse translator experiment that Sebastian wrote for me.... https://phyphox.org/forums/showthread.php?tid=2030&highlight=morse |