Exemplo n.º 1
0
def process():
    if len(sys.argv) <= 1:  # default behavior, run general test
        print("")
        nfail = module_test_lib.num_import_failures(verb=2)
        print("\nnumber of python import failures = %d\n" % nfail)
        return nfail

    # create elemnnt and initialize options
    MT = ModuleTest()
    MT.init_opts()

    # read options, return on terminal option or bad usage
    rv = MT.read_opts()
    if rv != None:
        if rv: MT.show_failed_command()
        return rv

    # apply options
    rv = MT.process_opts()
    if rv != None:
        if rv: MT.show_failed_command()
        return rv

    # do stuff
    rv = MT.execute()
    if rv != None:
        if rv: MT.show_failed_command()
        return rv
Exemplo n.º 2
0
   def __init__(self, sport, verb=1):
      global g_SER                      # global reference for serial library

      # see if the serial library is available
      if module_test_lib.num_import_failures(['serial']): return None
      import serial
      g_SER = serial

      # main variables
      self.verb         = verb          # verbose level
      self.port_file    = sport         # file for serial port
      self.data_port    = None          # serial data port
      self.swap         = 0             # whether to swap serial bytes

      if self.verb > 1: print('++ initializing serial interface %s...' % sport)
Exemplo n.º 3
0
    def execute(self):

        if self.show_pyver:
            if self.verb <= 1:
                vlist = sys.version.split()
                vstr = vlist[0]
            else:
                vstr = sys.version
            print('python version: %s' % vstr)

        if self.show_platform:
            try:
                import platform
                print('platform: %s' % platform.platform())
            except:
                print('platform: ** module not found')

        if self.show_modtest:
            nfail = module_test_lib.num_import_failures(self.modlist,
                                                        details=1,
                                                        verb=self.verb)
            print("\nnumber of python import failures = %d\n" % nfail)

        return None
Exemplo n.º 4
0
   def set_demo_gui(self):
      """create the GUI for display of the demo data"""
      testlibs = ['numpy', 'wx']
      if module_test_lib.num_import_failures(testlibs):
         return 1
      try:
         import numpy as N, wx
         from afnipy import lib_RR_plot as LPLOT
      except:
         return 1

      self.wx_app = wx.App()
      self.demo_frame = LPLOT.CanvasFrame(title='receiver demo')
      self.demo_frame.EnableCloseButton(True)
      self.demo_frame.Show(True)
      self.demo_frame.style  = 'bar'
      self.demo_frame.xlabel = 'most recent 10 TRs'
      self.demo_frame.ylabel = 'scaled diff_ratio'

      # for the current demo, set an ranges for 10 numbers in [0,10]
      if self.demo_frame.style == 'graph':
         self.demo_frame.set_limits(0,9.1,-0.1,10.1)
      elif self.demo_frame.style == 'bar':
         self.demo_frame.set_limits(0,10.1,-0.1,10.1)
Exemplo n.º 5
0
#!/usr/bin/env python

# python3 status: started

# system libraries
import sys, os

# AFNI libraries (test first)
from afnipy import module_test_lib
g_testlibs = [
    'afnipy.option_list', 'afnipy.afni_util', 'afnipy.lib_system_check'
]
if module_test_lib.num_import_failures(g_testlibs, details=0, verb=1):
    print("\n** failed to load standard AFNI python libraries")
    print("   python version = %s" % sys.version.split()[0])
    sys.exit(1)

# now load AFNI libraries by name
from afnipy import option_list as OL
from afnipy import afni_util as UTIL  # not actually used, but probably will be
from afnipy import lib_system_check as SC

g_dotfiles = ['.profile', '.bash_profile', '.bashrc', '.cshrc', '.tcshrc']

g_help_string = """
=============================================================================
afni_system_check.py    - perform various system checks

This program is intended to be helpful for figuring out AFNI installation
issues.
Exemplo n.º 6
0
#!/usr/bin/env python

# python3 status: started

# library for performing various system checks

import os, sys
from afnipy import module_test_lib as MT

# test dependency libs before proceeding
# note: platform came with python 2.3
testlibs = ['platform', 'afnipy.afni_base', 'afnipy.afni_util']
if MT.num_import_failures(testlibs):
   sys.exit(1)

import platform, glob
from afnipy import afni_base as BASE
from afnipy import afni_util as UTIL

class SysInfo:
   """system info class"""

   def __init__(self, data_root='', verb=1):

      self.system          = platform.system()
      self.home_dir        = os.environ['HOME']
      self.data_root       = data_root
      self.verb            = verb

      self.afni_ver        = ''
      self.afni_label      = ''
Exemplo n.º 7
0
#!/usr/bin/env python

# basically, a GUI to write an afni_proc.py command

import sys, os, copy, math

# system libraries : test, then import as local symbols
from afnipy import module_test_lib
testlibs = ['copy', 'signal']
if module_test_lib.num_import_failures(testlibs): sys.exit(1)
import copy

from afnipy import afni_util as UTIL
from afnipy import lib_subjects as SUBJ
from afnipy import lib_vars_object as VO
from afnipy import lib_uber_skel as USKEL
from afnipy import option_list as OPT

g_command_help = """
===========================================================================
uber_skel.py      - sample uber processing program
                    (based on uber_align_test.py, version 0.2)

        usage:  uber_skel.py

---

This help describes only the command line options to this program, which
enables one to:

        - initialize user variables (for GUI or command line)
Exemplo n.º 8
0
 def test_libraries(self,verb=2):
    """test for existence of needed python libraries"""
    from afnipy import module_test_lib as MLT
    libs = ['os', 'gc', 'numpy', 'wx', 'matplotlib', 'scipy']
    if MLT.num_import_failures(libs,details=1,verb=verb): return 1
    else: return 0