Source code for irfpy.util.irflab_wrapper

""" Command executed in ``from irflab import *``

To start using irfpy interactively, use the following syntex::

    from irflab import *

Then, all the installed ``irfpy`` modules will be imported.

Importing core and third-party library
  * Importing pprint (from pprint import pprint)
  * Importing datetime
  * Importing numpy as np
  * Importing scipy as sp
  * Importing matplotlib.pyplot as plt

from pprint import pprint
import datetime
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt

Loading irfpy.util

import irfpy.util
from irfpy.util import *

print('  * Loading unit calculator (type "help(u)" for help)')
import irfpy.util.unitq as u

print('  * Loading physical constants (type "help(k)" for help)')
import irfpy.util.constant as k

print('  * Loading physical formula (type "help(f)" for help)')
import irfpy.util.physics as f

Setup logger

  * Import logging module
  * Initilized irfpy logger as a name ``logger``


import logging

irflab_handler = logging.StreamHandler()
irflab_formatter = logging.Formatter('[%(levelname)s] %(asctime)s [%(name)s] %(message)s', datefmt='%FT%T')

logger = logging.getLogger('irfpy')
logger.propagate = False

_logger_irflab = logging.getLogger(__name__)

### This should be the end!
irfpy modules
To load all installed irfpy library, type irfpy_init()

_irfpy_irflab_loaded = []

[docs]def irfpy_init(loglevel=None): if loglevel: __oldlevel=_logger_irflab.level _logger_irflab.setLevel(loglevel) def onerrorfunc(name): pass import pkgutil as _pkgutil import irfpy for _v in _pkgutil.walk_packages(onerror=onerrorfunc, path=irfpy.__path__, prefix='irfpy.'): try: # >= python3.6 _n = except: # <= python3.5 _n = _v[1] if _n.count('.') < 2: continue elif _n.endswith('_test'): continue try: if _n not in _irfpy_irflab_loaded: exec('import {}'.format(_n))'Import {}'.format(_n)) _irfpy_irflab_loaded.append(_n) # except ModuleNotFoundError: # New in python3.6 # pass except ImportError: # Old for python3.5 pass if loglevel: _logger_irflab.setLevel(__oldlevel)