# Path: sensbiotk/io/iofox.py
# LSM303DLHC_ACC_SCALE = {'2g': 0x00, '4g': 0x10, '8g': 0x20, '16g': 0x30}
# LSM303DLHC_MAG_SCALE = {'1_3gauss': 0x20, '1_9gauss': 0x40, '2_5gauss': 0x60,
#                         '4_0gauss': 0x80, '4_7gauss': 0xA0, '5_6gauss': 0xC0,
#                         '8_1gauss': 0xE0}
# L3G4200D_SCALE = {'250dps': 0x00, '500dps': 0x10, '2000dps': 0x30}
# SCALE = {'ref_g': 9.81, 'time': 1e-3,
#          'acc': 2.0e-2, 'mag_xy': (1.0 / 670.0), 'mag_z': (1.0 / 600.0),
#          'press': 1.0 / 4096.0 / 1000.0, 'temp': 1.0 / 480.0,
#          'offset_temp': 22.5}
# SEP = ";"
# TIME_OVERFLOW = 8192.0
# def _get_acc_scale():
# def _get_magxy_scale():
# def _get_gyr_scale():
# def _get_time(rawval):
# def _get_acc(rawval):
# def _get_mag(rawval):
# def _get_gyr(rawval):
# def _get_press(rawval):
# def _get_gpio(rawval):
# def _get_temp(rawval):
# def _set_time_scale(val):
# def _set_acc_scale(val):
# def _set_mag_scale(val):
# def _set_gyr_scale(val):
# def _write_header(fid, binfilename):
# def _write_acc_header(fid, binfilename):
# def _write_mag_header(fid, binfilename):
# def _write_gyr_header(fid, binfilename):
# def _write_presst_header(fid, binfilename):
# def _write_gpio_header(fid, binfilename):
# def _write_acc_data(fid, data):
# def _write_data(fid, data):
# def _write_mag_data(fid, data):
# def _write_gyr_data(fid, data):
# def _write_presst_data(fid, data):
# def _write_gpio_data(fid, data):
# def convert_sensors_rawfile(binfilename, accfilename="output_acc.csv",
#                             magfilename="output_mag.csv",
#                             gyrfilename="output_gyr.csv",
#                             presstfilename="output_presst.csv",
#                             gpiofilename="output_gpio.csv"):
# def load_foxacc_csvfile(filename):
# def load_foxmag_csvfile(filename):
# def load_foxgyr_csvfile(filename):
# def load_foxpresst_csvfile(filename):
# def load_foxgpio_csvfile(filename):
# def _spline_resample(sig_x, sig_y, sig_xnew, deg_spline):
# def load_foximu_csvfile(filename_acc, filename_mag, filename_gyr,
#                         dtime, deg_s=1):
# def load_foxcsvfile(filename):
# def save_foxsignals_csvfile(time, acc, mag, gyr, filename):
# def save_foxacc_csvfile(accfilename, time, acc):
# def save_foxmag_csvfile(magfilename, time, mag):
# def save_foxgyr_csvfile(gyrfilename, time, gyr):
# 
# Path: sensbiotk/io/viz.py
# def plot_imu(num, title, time, acc, mag, gyr):
# def plot_show():
# def test1():
# def test2():
# def test3():


import sys
import os
import getopt
import numpy as np
import matplotlib.pyplot as plt
from sensbiotk.io import iofox
from sensbiotk.io import viz
                period = 1 / period
        elif opt in ("-p", "--plot"):
            options.append("-p")
        elif opt in ("-a", "--acc"):
            options.append("-a")
        elif opt in ("-m", "--mag"):
            options.append("-m")
        elif opt in ("-g", "--gyr"):
            options.append("-g")

    if len(filenames) == 0:
        usage()
        sys.exit(2)

    for filename in filenames:
        print "Conversion:", filename
        # Get names file
        basefile, fileacc, filemag, filegyr, fileimu =\
            getnamefiles(filename, newbasename, diroutput)
        # Read and convert file
        answer = iofox.convert_sensors_rawfile(filename,
                                               fileacc,
                                               filemag,
                                               filegyr)
        if answer != "OK":
            usage()
            sys.exit(2)
        # Load ascii files converted
        [myt, acc, mag, gyr] = \
            iofox.load_foximu_csvfile(fileacc, filemag, filegyr, period, 1)

# Path: sensbiotk/io/iofox.py
# LSM303DLHC_ACC_SCALE = {'2g': 0x00, '4g': 0x10, '8g': 0x20, '16g': 0x30}
# LSM303DLHC_MAG_SCALE = {'1_3gauss': 0x20, '1_9gauss': 0x40, '2_5gauss': 0x60,
#                         '4_0gauss': 0x80, '4_7gauss': 0xA0, '5_6gauss': 0xC0,
#                         '8_1gauss': 0xE0}
# L3G4200D_SCALE = {'250dps': 0x00, '500dps': 0x10, '2000dps': 0x30}
# SCALE = {'ref_g': 9.81, 'time': 1e-3,
#          'acc': 2.0e-2, 'mag_xy': (1.0 / 670.0), 'mag_z': (1.0 / 600.0),
#          'press': 1.0 / 4096.0 / 1000.0, 'temp': 1.0 / 480.0,
#          'offset_temp': 22.5}
# SEP = ";"
# TIME_OVERFLOW = 8192.0
# def _get_acc_scale():
# def _get_magxy_scale():
# def _get_gyr_scale():
# def _get_time(rawval):
# def _get_acc(rawval):
# def _get_mag(rawval):
# def _get_gyr(rawval):
# def _get_press(rawval):
# def _get_gpio(rawval):
# def _get_temp(rawval):
# def _set_time_scale(val):
# def _set_acc_scale(val):
# def _set_mag_scale(val):
# def _set_gyr_scale(val):
# def _write_header(fid, binfilename):
# def _write_acc_header(fid, binfilename):
# def _write_mag_header(fid, binfilename):
# def _write_gyr_header(fid, binfilename):
# def _write_presst_header(fid, binfilename):
# def _write_gpio_header(fid, binfilename):
# def _write_acc_data(fid, data):
# def _write_data(fid, data):
# def _write_mag_data(fid, data):
# def _write_gyr_data(fid, data):
# def _write_presst_data(fid, data):
# def _write_gpio_data(fid, data):
# def convert_sensors_rawfile(binfilename, accfilename="output_acc.csv",
#                             magfilename="output_mag.csv",
#                             gyrfilename="output_gyr.csv",
#                             presstfilename="output_presst.csv",
#                             gpiofilename="output_gpio.csv"):
# def load_foxacc_csvfile(filename):
# def load_foxmag_csvfile(filename):
# def load_foxgyr_csvfile(filename):
# def load_foxpresst_csvfile(filename):
# def load_foxgpio_csvfile(filename):
# def _spline_resample(sig_x, sig_y, sig_xnew, deg_spline):
# def load_foximu_csvfile(filename_acc, filename_mag, filename_gyr,
#                         dtime, deg_s=1):
# def load_foxcsvfile(filename):
# def save_foxsignals_csvfile(time, acc, mag, gyr, filename):
# def save_foxacc_csvfile(accfilename, time, acc):
# def save_foxmag_csvfile(magfilename, time, mag):
# def save_foxgyr_csvfile(gyrfilename, time, gyr):
# 
# Path: sensbiotk/io/viz.py
# def plot_imu(num, title, time, acc, mag, gyr):
# def plot_show():
# def test1():
# def test2():
# def test3():


# Path: examples/scripts/fox_raw.py
import sys
import os
import getopt
import numpy as np
import matplotlib.pyplot as plt
from sensbiotk.io import iofox
from sensbiotk.io import viz

                period = 1 / period
        elif opt in ("-p", "--plot"):
            options.append("-p")
        elif opt in ("-a", "--acc"):
            options.append("-a")
        elif opt in ("-m", "--mag"):
            options.append("-m")
        elif opt in ("-g", "--gyr"):
            options.append("-g")

    if len(filenames) == 0:
        usage()
        sys.exit(2)

    for filename in filenames:
        print "Conversion:", filename
        # Get names file
        basefile, fileacc, filemag, filegyr, fileimu =\
            getnamefiles(filename, newbasename, diroutput)
        # Read and convert file
        answer = iofox.convert_sensors_rawfile(filename,
                                               fileacc,
                                               filemag,
                                               filegyr)
        if answer != "OK":
            usage()
            sys.exit(2)
        # Load ascii files converted
        [myt, acc, mag, gyr] = \
            iofox.load_foximu_csvfile(fileacc, filemag, filegyr, period, 1)

        iofox.save_foxsignals_csvfile(myt, acc, mag, gyr,* fileimu)