From 81f9df69442d686bed368ac6db2180cd482f1acb Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 1 Jun 2010 08:30:56 -0400 Subject: [PATCH] Use relative imports (PEP 328) for calibcant sibling imports. --- calibcant/T_analyze.py | 8 +++++--- calibcant/__init__.py | 2 +- calibcant/analyze.py | 10 ++++++---- calibcant/bump.py | 8 +++++--- calibcant/bump_analyze.py | 6 ++++-- calibcant/calibrate.py | 16 +++++++++------- calibcant/common.py | 3 ++- calibcant/config.py | 1 + calibcant/vib_analyze.py | 13 +++++++++---- 9 files changed, 42 insertions(+), 25 deletions(-) diff --git a/calibcant/T_analyze.py b/calibcant/T_analyze.py index d4ddf72..faf8856 100755 --- a/calibcant/T_analyze.py +++ b/calibcant/T_analyze.py @@ -33,13 +33,15 @@ The relevant physical quantities are : """ import numpy -import common # common module for the calibcant package -import config # config module for the calibcant package + import data_logger -import linfit from splittable_kwargs import splittableKwargsFunction, \ make_splittable_kwargs_function +import .common +import .config + + def C_to_K(celsius) : "Convert Celsius -> Kelvin." return celsius + 273.15 diff --git a/calibcant/__init__.py b/calibcant/__init__.py index 05f8fad..34670a5 100644 --- a/calibcant/__init__.py +++ b/calibcant/__init__.py @@ -21,4 +21,4 @@ # write to Trevor King, Drexel University, Physics Dept., 3141 Chestnut St., # Philadelphia PA 19104, USA. -from common import VERSION +from .common import VERSION diff --git a/calibcant/analyze.py b/calibcant/analyze.py index c485009..626e3ea 100755 --- a/calibcant/analyze.py +++ b/calibcant/analyze.py @@ -47,13 +47,15 @@ Which are related by the parameters : """ import numpy + +import data_logger from splittable_kwargs import splittableKwargsFunction, \ make_splittable_kwargs_function -import data_logger -import common # common module for the calibcant package -import config # config module for the calibcant package -import T_analyze # T_analyze module for the calibcant package +import .common +import .config +import .T_analyze + kb = 1.3806504e-23 # Boltzmann's constant in J/K diff --git a/calibcant/bump.py b/calibcant/bump.py index 04e8b19..d2f83ba 100644 --- a/calibcant/bump.py +++ b/calibcant/bump.py @@ -73,11 +73,13 @@ A family name without any _* extension (e.g. bump()), import numpy import time + import data_logger -import piezo.z_piezo_utils as z_piezo_utils import FFT_tools -import linfit -from calibcant_bump_analyze import bump_analyze +import piezo.z_piezo_utils as z_piezo_utils + +from .bump_analyze import bump_analyze + LOG_DATA = True # quietly grab all real-world data and log to LOG_DIR LOG_DIR = '$DEFAULT$/calibrate_cantilever' diff --git a/calibcant/bump_analyze.py b/calibcant/bump_analyze.py index 3783936..8291b0e 100755 --- a/calibcant/bump_analyze.py +++ b/calibcant/bump_analyze.py @@ -47,12 +47,14 @@ slope Vphoto/Vout is converted to photoSensitivity with bump_analyze(). import numpy import scipy.optimize -import common # common module for the calibcant package -import config # config module for the calibcant package + import data_logger from splittable_kwargs import splittableKwargsFunction, \ make_splittable_kwargs_function +import .common +import .config + @splittableKwargsFunction() def Vzp_bits2nm(data_bits, zpGain=config.zpGain, diff --git a/calibcant/calibrate.py b/calibcant/calibrate.py index a485bf4..5789f7f 100755 --- a/calibcant/calibrate.py +++ b/calibcant/calibrate.py @@ -104,17 +104,19 @@ which make automating the calibration procedure more straightforward. import numpy import time + +import FFT_tools import piezo.z_piezo_utils as z_piezo_utils from splittable_kwargs import splittableKwargsFunction, \ make_splittable_kwargs_function -import FFT_tools -import common -import config -import bump_analyze -import T_analyze -import vib_analyze -import analyze +import .common +import .config +import .bump_analyze +import .T_analyze +import .vib_analyze +import .analyze + # bump family diff --git a/calibcant/common.py b/calibcant/common.py index 590d2b7..ece7832 100644 --- a/calibcant/common.py +++ b/calibcant/common.py @@ -21,7 +21,8 @@ # write to Trevor King, Drexel University, Physics Dept., 3141 Chestnut St., # Philadelphia PA 19104, USA. -import config +import .config + VERSION="0.4" diff --git a/calibcant/config.py b/calibcant/config.py index 131651d..0594488 100644 --- a/calibcant/config.py +++ b/calibcant/config.py @@ -26,6 +26,7 @@ and workflow.""" import piezo.z_piezo as z_piezo + DEFAULT_TEMP = 22 # assume 22 deg C LOG_DATA = True # quietly grab all real-world data and log to LOG_DIR LOG_DIR = '$DEFAULT$/calibrate_cantilever' diff --git a/calibcant/vib_analyze.py b/calibcant/vib_analyze.py index 0a9e1e5..67d7519 100755 --- a/calibcant/vib_analyze.py +++ b/calibcant/vib_analyze.py @@ -33,15 +33,18 @@ The relevent physical quantities are : """ import os, time, numpy -import GnuplotBiDir # used for fitting lorentzian -import scipy.optimize # alternative for fitting lorentzian -import common # common module for the calibcant package -import config # config module for the calibcant package +import GnuplotBiDir # can be used for fitting lorentzian +import scipy.optimize # can be used for fitting lorentzian + import data_logger import FFT_tools from splittable_kwargs import splittableKwargsFunction, \ make_splittable_kwargs_function +import .common +import .config + + PLOT_GUESSED_LORENTZIAN=False @splittableKwargsFunction() @@ -550,3 +553,5 @@ if __name__ == '__main__' : if options.ofilename != None : ofile.close() + +# LocalWords: calibcant AFM -- 2.26.2