Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added data path example. #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion shablona/shablona.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,26 @@
from matplotlib import mlab
from scipy.special import erf
import scipy.optimize as opt
import os.path as op

def get_data_path(absolute=True):
"""Use special attribute __file__ to return the path to the module data folder.

Parameters
----------
absolute : bool
If True, return an absolute path, as opposed to a path
relative to the current working directory.

Returns
-------
data_path : str
Path to the data folder within this module."""

if absolute:
return op.join(op.dirname(op.abspath(__file__)),'data')
else:
return op.join(op.dirname(__file__),'data')

def transform_data(data):
"""
Expand Down Expand Up @@ -195,4 +214,4 @@ def predict(self, x):
Predicted values of the dependent variable, corresponding to
values of the independent variable.
"""
return self.model.func(x, *self.params)
return self.model.func(x, *self.params)