This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

How can count amount peak of graph ?
#1
Wink 
Hi Big Grin .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

                   
Reply
#2
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… Wink

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.
Reply
#3
Photo 
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)
   
Reply
#4
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.
Reply
#5
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>
Reply
#6
Photo 
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.

   
Reply
#7
It's not so much the time difference but rather the federal holiday here today… Wink
Reply
#8
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
Reply
#9
This sounds a biyt like the morse translator experiment that Sebastian wrote for me....

https://phyphox.org/forums/showthread.ph...ight=morse
Reply


Forum Jump: