SaveMySugar/python3-savemysugar.git
8 years agosymbols_distances.gnuplot: fix the pngcairo terminal output file name
Antonio Ospite [Mon, 4 Jan 2016 14:32:21 +0000 (15:32 +0100)]
symbols_distances.gnuplot: fix the pngcairo terminal output file name

8 years agoCallDistanceTransceiver.py: assign a float value to inter_symbol_distance
Antonio Ospite [Mon, 4 Jan 2016 09:39:54 +0000 (10:39 +0100)]
CallDistanceTransceiver.py: assign a float value to inter_symbol_distance

For consistency always assign a float value to inter_symbol_distance, as
it is going to be used in calculations with other float values.

This also fixes an pylint message:

  R:101,12: Redefinition of inter_symbol_distance type from float to int
  (redefined-variable-type)

8 years agoCallDistanceTransceiver.py: clarify the use of a transceiver in DummyModem
Antonio Ospite [Sun, 3 Jan 2016 22:22:46 +0000 (23:22 +0100)]
CallDistanceTransceiver.py: clarify the use of a transceiver in DummyModem

8 years agoPut standard modules imports before other imports
Antonio Ospite [Mon, 4 Jan 2016 09:23:35 +0000 (10:23 +0100)]
Put standard modules imports before other imports

This fixes wrong-import-order message from pylint.

8 years agoCallDistanceTransceiver.py: consider possible delays in transmit_symbol()
Antonio Ospite [Sun, 3 Jan 2016 22:16:44 +0000 (23:16 +0100)]
CallDistanceTransceiver.py: consider possible delays in transmit_symbol()

The ATH command can take some time, resulting in a positive delay; or
the first time.sleep() may terminate earlier resulting in a negative
delay.

In either case compensate for these delays in the second sleep, in order
to try to diverge as little possible from the total nominal symbol
transmission distance.

8 years agoAdd a program to measure the call setup time from Android to PC
Antonio Ospite [Sun, 3 Jan 2016 20:40:26 +0000 (21:40 +0100)]
Add a program to measure the call setup time from Android to PC

8 years agoplot: add some more logs from the Android app
Antonio Ospite [Sun, 3 Jan 2016 20:39:32 +0000 (21:39 +0100)]
plot: add some more logs from the Android app

8 years agoCallDistanceTransceiver.py: use a more conservative call_setup_time_max default
Antonio Ospite [Sun, 3 Jan 2016 20:34:25 +0000 (21:34 +0100)]
CallDistanceTransceiver.py: use a more conservative call_setup_time_max default

8 years agoMorseDistanceModulator.py: improve a comment
Antonio Ospite [Sun, 3 Jan 2016 17:47:09 +0000 (18:47 +0100)]
MorseDistanceModulator.py: improve a comment

Don't refer to "calls" anymore, MorseDistanceModulator is quite generic
and uses the period/pulse terminology.

Improve the grammar too...

8 years agoMorseDistanceModulator.py: be more precise in an error message
Antonio Ospite [Sun, 3 Jan 2016 17:46:21 +0000 (18:46 +0100)]
MorseDistanceModulator.py: be more precise in an error message

8 years agoMove the MorseDistanceModulator class to its own file
Antonio Ospite [Sun, 3 Jan 2016 17:38:34 +0000 (18:38 +0100)]
Move the MorseDistanceModulator class to its own file

8 years agoTODO: mention some of the known issues in the TODO list
Antonio Ospite [Sun, 3 Jan 2016 17:14:29 +0000 (18:14 +0100)]
TODO: mention some of the known issues in the TODO list

8 years agocall_distance_modulation.gnuplot: try to improve the look of xtics labels
Antonio Ospite [Sun, 3 Jan 2016 17:08:43 +0000 (18:08 +0100)]
call_distance_modulation.gnuplot: try to improve the look of xtics labels

Increasing the xtics spacing and decreasing the font size makes the plot
look a little less crowded for long transmissions.

8 years agoCallDistanceTransceiver.py: rename receive_character() to receive_symbol()
Antonio Ospite [Sat, 2 Jan 2016 21:45:52 +0000 (22:45 +0100)]
CallDistanceTransceiver.py: rename receive_character() to receive_symbol()

The name receive_symbol() is more appropriate because the function
receives Morse symbols, not directly text characters.

8 years agoCallDistanceTransceiver.py: make log_symbol() a standalone function
Antonio Ospite [Sat, 2 Jan 2016 15:51:37 +0000 (16:51 +0100)]
CallDistanceTransceiver.py: make log_symbol() a standalone function

There is no need for it to be a method, it does not use "self".

8 years agoCallDistanceTransceiver.py: destination_number does not have to be a member
Antonio Ospite [Sat, 2 Jan 2016 15:46:06 +0000 (16:46 +0100)]
CallDistanceTransceiver.py: destination_number does not have to be a member

The destination_number is only used int he transmit functions, it can
very well be just an argument of the transmit functions.

8 years agoCallDistanceTransceiver.py: rename test_send_receive to test_transmit_receive
Antonio Ospite [Sat, 2 Jan 2016 15:41:19 +0000 (16:41 +0100)]
CallDistanceTransceiver.py: rename test_send_receive to test_transmit_receive

All the other code uses the "transmit" verb instead of "send".

8 years agoCallDistanceTransceiver.py: reset modem.ring_count before receiving
Antonio Ospite [Sat, 2 Jan 2016 15:27:18 +0000 (16:27 +0100)]
CallDistanceTransceiver.py: reset modem.ring_count before receiving

8 years agoCallDistanceTransceiver.py: add a transmission test in test_send_receive()
Antonio Ospite [Sat, 2 Jan 2016 15:25:02 +0000 (16:25 +0100)]
CallDistanceTransceiver.py: add a transmission test in test_send_receive()

8 years agoCallDistanceTransceiver.py: make DummyModem look more like Modem
Antonio Ospite [Sat, 2 Jan 2016 15:20:59 +0000 (16:20 +0100)]
CallDistanceTransceiver.py: make DummyModem look more like Modem

The "response" argument is optional in the get_response() method, this
avoids getting an error when trying to transmit with DummyModem:

  TypeError: get_response() missing 1 required positional argument: 'response'

8 years agoCallDistanceTransceiver.py: use the modulator member in test_send_receive()
Antonio Ospite [Sat, 2 Jan 2016 15:19:16 +0000 (16:19 +0100)]
CallDistanceTransceiver.py: use the modulator member in test_send_receive()

8 years agoCallDistanceTransceiver.py: factor out a MorseDistanceModulator class
Antonio Ospite [Sat, 2 Jan 2016 15:12:16 +0000 (16:12 +0100)]
CallDistanceTransceiver.py: factor out a MorseDistanceModulator class

Abstract the modulation into its own class, this simplifies the code of
the CallDistanceTransceiver class.

While at it also start using the difference between a "period" and
a "pulse" in SymbolTime, some more documentation about what they mean
will be added in some future commit.

8 years agocall_distance_modulation.gnuplot: s/ingoing/incoming/
Antonio Ospite [Thu, 24 Dec 2015 10:02:08 +0000 (11:02 +0100)]
call_distance_modulation.gnuplot: s/ingoing/incoming/

8 years agoDon't add trailing spaces when producing logs
Antonio Ospite [Thu, 24 Dec 2015 09:58:26 +0000 (10:58 +0100)]
Don't add trailing spaces when producing logs

8 years agoAdd tools to plot the symbol distances
Antonio Ospite [Thu, 24 Dec 2015 09:54:22 +0000 (10:54 +0100)]
Add tools to plot the symbol distances

This helps comparing the effect of different parameters values.

8 years agoAdd measure_call_setup_time_to_android.py
Antonio Ospite [Thu, 24 Dec 2015 09:52:14 +0000 (10:52 +0100)]
Add measure_call_setup_time_to_android.py

This makes it easy to measure the call time when using the Android app
as a receiver.

The tool parses the "adb logcat" output and gets info from the
SaveMySugar app log.

8 years agoAdd session_stats.py: a tool to perform some call time analysis on logs
Antonio Ospite [Thu, 24 Dec 2015 09:48:52 +0000 (10:48 +0100)]
Add session_stats.py: a tool to perform some call time analysis on logs

8 years agoplot: add some logs acquired using th Android app as a receiver
Antonio Ospite [Thu, 24 Dec 2015 09:47:06 +0000 (10:47 +0100)]
plot: add some logs acquired using th Android app as a receiver

8 years agoREADME.md: improve wording when explaining how to measure parameters
Antonio Ospite [Thu, 24 Dec 2015 09:45:48 +0000 (10:45 +0100)]
README.md: improve wording when explaining how to measure parameters

8 years agomeasure_ring_distance.py: improve output messages
Antonio Ospite [Thu, 24 Dec 2015 09:45:24 +0000 (10:45 +0100)]
measure_ring_distance.py: improve output messages

8 years agomeasure_call_setup_time.py: don't measure "uncertainty" anymore
Antonio Ospite [Thu, 24 Dec 2015 09:42:27 +0000 (10:42 +0100)]
measure_call_setup_time.py: don't measure "uncertainty" anymore

It's not immediately useful to know the uncertainty now that
CallDistanceTransceiver takes minimum and maximum parameters explicitly.

While at it also adjust a print message to be more descriptive.

8 years agologs: add logs produced with the new parameters
Antonio Ospite [Thu, 24 Dec 2015 09:40:39 +0000 (10:40 +0100)]
logs: add logs produced with the new parameters

8 years agoplot: update logs to the new format
Antonio Ospite [Thu, 24 Dec 2015 09:38:43 +0000 (10:38 +0100)]
plot: update logs to the new format

8 years agocall_distance_modulation.gnuplot: adjust to plot the new logs
Antonio Ospite [Thu, 24 Dec 2015 09:37:22 +0000 (10:37 +0100)]
call_distance_modulation.gnuplot: adjust to plot the new logs

8 years agoCallDistanceTransceiver.py: make test_send_receive() use the new scheme
Antonio Ospite [Thu, 24 Dec 2015 09:34:28 +0000 (10:34 +0100)]
CallDistanceTransceiver.py: make test_send_receive() use the new scheme

In  test_send_receive() use the new way of passing parameters to
CallDistanceTransceiver, and while at it, improve the test adding some
randomness.

8 years agoCallDistanceTransceiver.py: use a min,max scheme instead of avg,uncertainty
Antonio Ospite [Thu, 24 Dec 2015 09:29:29 +0000 (10:29 +0100)]
CallDistanceTransceiver.py: use a min,max scheme instead of avg,uncertainty

Specify parameters using a minimum and a maximum values, like
call_setup_time_min,call_setup_time_max and ring_time_min,ring_time_max.

This makes it more intuitive to measure the stability of the line, and
makes the code more readable too.

8 years agoCallDistanceTransceiver.py: remove a leftover print() statement
Antonio Ospite [Thu, 24 Dec 2015 09:24:30 +0000 (10:24 +0100)]
CallDistanceTransceiver.py: remove a leftover print() statement

8 years agoMorseTranslator.py: don't sanitize away word spaces
Antonio Ospite [Wed, 23 Dec 2015 18:26:51 +0000 (19:26 +0100)]
MorseTranslator.py: don't sanitize away word spaces

Don't strip word spaces when sanitizing strings, those spaces may be
part of the original message.

8 years agoreceive.py: fix a print statement and also flush the output
Antonio Ospite [Wed, 23 Dec 2015 18:24:25 +0000 (19:24 +0100)]
receive.py: fix a print statement and also flush the output

Remove unneeded parentheses in a print statements, and also flush the
output: when using logging and redirection sometimes the output does not
get printed.

8 years agoCallDistanceTransceiver.py: reformat printing the symbols times
Antonio Ospite [Mon, 21 Dec 2015 19:39:30 +0000 (20:39 +0100)]
CallDistanceTransceiver.py: reformat printing the symbols times

Have the same number of spaces on each line, this makes it easier to
plot the data by fields using the space as a field delimiter.

While at it also split the lines as they would be too long according to
PEP8.

8 years agoCallDistanceTransceiver.py: remove unneeded empty line
Antonio Ospite [Mon, 21 Dec 2015 19:30:12 +0000 (20:30 +0100)]
CallDistanceTransceiver.py: remove unneeded empty line

8 years agoCallDistanceTransceiver.py: fix a print format in a debug message
Antonio Ospite [Mon, 21 Dec 2015 19:25:31 +0000 (20:25 +0100)]
CallDistanceTransceiver.py: fix a print format in a debug message

The times here are not exact integers, so print them as float.

8 years agoCallDistanceTransceiver.py: fix an error message
Antonio Ospite [Mon, 21 Dec 2015 19:22:57 +0000 (20:22 +0100)]
CallDistanceTransceiver.py: fix an error message

The error is about call_distance, not ring_distance.

8 years agomeasure_call_setup_time.py: make the output more readable
Antonio Ospite [Mon, 21 Dec 2015 18:41:00 +0000 (19:41 +0100)]
measure_call_setup_time.py: make the output more readable

Sleep _after_ having printed the info about the call, the output flow is
more understandable this way.

While at it also avoid the "First ring" message which is misleading
besides, it was a leftover from measure_ring_distance.py

8 years agoResume command mode after dialing, always
Antonio Ospite [Thu, 17 Dec 2015 17:08:50 +0000 (18:08 +0100)]
Resume command mode after dialing, always

Put a semicolon after the AT command when dialing the destination
number. Without this, some modems won't accept the ATH command and won't
be able to terminate a call before the receiver has answered.

8 years agoCallDistanceTransceiver.py: resume command mode after dialing
Antonio Ospite [Thu, 17 Dec 2015 11:59:41 +0000 (12:59 +0100)]
CallDistanceTransceiver.py: resume command mode after dialing

Put a semicolon after the AT command when dialing the destination
number. Without this, some modems won't accept the ATH command and won't
be able to terminate a call before the receiver has answered.

8 years agoCallDistanceTransceiver.py: don't put the general case in an else
Antonio Ospite [Thu, 17 Dec 2015 11:56:32 +0000 (12:56 +0100)]
CallDistanceTransceiver.py: don't put the general case in an else

Since the code returns when the particular case of the very first call
occurs, there is no need to put the general case in the else.

8 years agoREADME.md: improve wording and make Corrado's name more visible
Antonio Ospite [Thu, 17 Dec 2015 11:55:05 +0000 (12:55 +0100)]
README.md: improve wording and make Corrado's name more visible

8 years agoModem.py: use the more idiomatic "while True" instead of "while 1"
Antonio Ospite [Mon, 14 Dec 2015 18:53:34 +0000 (19:53 +0100)]
Modem.py: use the more idiomatic "while True" instead of "while 1"

8 years agoMorseTranslator.py: remove unneeded code in sanitize_morse()
Antonio Ospite [Mon, 14 Dec 2015 17:31:44 +0000 (18:31 +0100)]
MorseTranslator.py: remove unneeded code in sanitize_morse()

The Morse string will never contain a '|' because it would have been
already replaced in a previous sanitization step.

Also we don't define anywhere that '|' can act as an alternative word
separator, so it should be replaced with a space just like any other
invalid character.

8 years agoMorseTranslator.py: fix sanitize_text
Antonio Ospite [Mon, 14 Dec 2015 16:38:35 +0000 (17:38 +0100)]
MorseTranslator.py: fix sanitize_text

Use a regex more adherent to the characters actually translated, also
follow the order in which the characters appear in the signals table.

8 years agoInitial import
Antonio Ospite [Thu, 10 Dec 2015 21:31:04 +0000 (22:31 +0100)]
Initial import