/usr/share/pyshared/guiqwt/tests/fit.py is in python-guiqwt 2.1.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 CEA
# Pierre Raybaut
# Licensed under the terms of the CECILL License
# (see guiqwt/__init__.py for details)
"""Curve fitting tools"""
SHOW = True # Show test in GUI-based test launcher
import numpy as np
from guiqwt.fit import FitParam, guifit
def test():
x = np.linspace(-10, 10, 1000)
y = np.cos(1.5*x)+np.random.rand(x.shape[0])*.2
def fit(x, params):
a, b = params
return np.cos(b*x)+a
a = FitParam("Offset", 1., 0., 2.)
b = FitParam("Frequency", 2., 1., 10., logscale=True)
params = [a, b]
values = guifit(x, y, fit, params, xlabel="Time (s)", ylabel="Power (a.u.)")
print values
print [param.value for param in params]
if __name__ == "__main__":
test()
|