Testing & Logging

The next big thing I have to work on, is creating test programs I can run, to auto test my main programs.  Considering all the functions and variables, this will probably take a bit of time to complete.

Right now, I just manually test the program aspects that get changed, such as creating graphs when the graph functions change.  This takes up a lot of time, and it’s only going to take more time as things progress further.  However, I don’t want to rush my test code, since its going to be used a LOT!  So I’ll set aside some time to plan it out a bit.  What it does, how and why.

In other news, I have taken a sensor on 2 trips, recording the whole time.  For one, this gave me a 9MB Motion database file 🙂  This should help greatly in stress testing some of the graph features.  Since motion can record up to 4 times per second, I need to find a way to filter that data, so it doesn’t have over 14,000 graph points in a hour’s time or less.  

I was thinking, if a data point is within 2 Seconds of the last one AND the difference is less than variance (say 0.1), skip it.  I can also set the time and variance as variables at the top, so they can be changed. That should cut down on a lot of the noise, yet leave flexibility to adjust for whatever the need may be.  Or I could just use one variable, so if it’s over X variance, it records for say 15 seconds, and resets that timmer if X variance happens again during the time.  This would give a balance of fairly accurate recordings during an event, while recording nothing if its been still after 15 seconds.  

Come to think of it, I should probably add a config file on the sensor units themselves for variables that might be useful to change, depending on the situation.

In other news, I found out there is a included module in Python for logging.  I found it when I was going through PyCharm EDU lessons.  So that should clean up some of my code and allow a more universal experience.  

I have already swapped the logger in my main py file, thanks to word replacement in Notepad++.  PyCharm wouldn’t let me do it through refactoring though, because I was changing it from a function (message_print_log) to logger.info(), and PyCharm really didn’t want to change from no period thingy to something with a period in it.  

I do like the logger so far, it seems simple yet flexible.  I expect to be fully using it, instead of my home grown one in a few days time with minimal effort.  I do have to change how my logging window functions though… In fact I’ll probably just open up the log file itself in a text editor to “open” the log.  

Until next time.

Edit: I forgot to mention, I have all my code on GitHub now!  (All 4 programs since I started coding in June 2018).  

https://github.com/chad-ermacora

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>