Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions Examples/base/plot_baseclass1.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ def from_pars(cls, A: float = 1, f: float = 1, p: float = 0):
return cls(A, f, p)

def __call__(self, t):
return self.A.raw_value * np.sin(2 * np.pi * self.f.raw_value * t + self.p.raw_value)
return self.A.value * np.sin(2 * np.pi * self.f.value * t + self.p.value)

def plot(self, time, axis=None, **kwargs):
if axis is None:
axis = plt
else:
axis.set_title(f'A={self.A.raw_value}, F={self.f.raw_value}, P={self.p.raw_value}')
axis.set_title(f'A={self.A.value}, F={self.f.value}, P={self.p.value}')
p = axis.plot(time, self(time), **kwargs)
return p

Expand Down
2 changes: 1 addition & 1 deletion examples_old/example1.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

def fit_fun(x):
# In the real case we would gust call the evaluation fn without reference to the BaseObj
return b.c.raw_value + b.m.raw_value * x
return b.c.value + b.m.value * x


f = Fitter()
Expand Down
2 changes: 1 addition & 1 deletion examples_old/example1_dream.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

def fit_fun(x):
# In the real case we would gust call the evaluation fn without reference to the BaseObj
return b.c.raw_value + b.m.raw_value * x
return b.c.value + b.m.value * x


f = Fitter()
Expand Down
4 changes: 2 additions & 2 deletions examples_old/example2.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ def _defaults(self):

@property
def gradient(self):
return self.m.raw_value
return self.m.value

@property
def intercept(self):
return self.c.raw_value
return self.c.value

def fit_func(self, x: np.ndarray) -> np.ndarray:
return self.gradient * x + self.intercept
Expand Down
4 changes: 2 additions & 2 deletions examples_old/example3.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ def gradient(self):
if self.interface:
return self.interface.get_value('m')
else:
return self.m.raw_value
return self.m.value

@property
def intercept(self):
if self.interface:
return self.interface.get_value('c')
else:
return self.c.raw_value
return self.c.value

def fit_func(self, x: np.ndarray) -> np.ndarray:
if self.interface:
Expand Down
4 changes: 2 additions & 2 deletions examples_old/example4.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,14 +407,14 @@ def gradient(self):
if self.interface:
return self.interface().get_value("m")
else:
return self.m.raw_value
return self.m.value

@property
def intercept(self):
if self.interface:
return self.interface().get_value("c")
else:
return self.c.raw_value
return self.c.value

def __repr__(self):
return f"Line: m={self.m}, c={self.c}"
Expand Down
4 changes: 2 additions & 2 deletions examples_old/example5_broken.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,14 @@ def gradient(self):
# if self.interface:
# return self.interface().get_value('m')
# else:
return self.m.raw_value
return self.m.value

@property
def intercept(self):
# if self.interface:
# return self.interface().get_value('c')
# else:
return self.c.raw_value
return self.c.value

def __repr__(self):
return f"Line: m={self.m}, c={self.c}"
Expand Down
2 changes: 1 addition & 1 deletion examples_old/example_dataset2.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

def fit_fun(x, *args, **kwargs):
# In the real case we would gust call the evaluation fn without reference to the BaseObj
return b.c.raw_value + b.m.raw_value * x
return b.c.value + b.m.value * x


f = Fitter()
Expand Down
2 changes: 1 addition & 1 deletion examples_old/example_dataset2pt2_broken.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

def fit_fun(x, *args, **kwargs):
# In the real case we would gust call the evaluation fn without reference to the BaseObj
return b.c.raw_value + b.m.raw_value * x
return b.c.value + b.m.value * x


nx = 1E3
Expand Down
2 changes: 1 addition & 1 deletion examples_old/example_dataset3.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

def fit_fun(x, *args, **kwargs):
# In the real case we would gust call the evaluation fn without reference to the BaseObj
return np.sin(2*np.pi*(x[:, 0] + b.s_off.raw_value)) * np.cos(2*np.pi*(x[:, 1] + b.c_off.raw_value))
return np.sin(2*np.pi*(x[:, 0] + b.s_off.value)) * np.cos(2*np.pi*(x[:, 1] + b.c_off.value))


f = Fitter()
Expand Down
4 changes: 2 additions & 2 deletions examples_old/example_dataset3pt2.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

def fit_fun(x, *args, **kwargs):
# In the real case we would gust call the evaluation fn without reference to the BaseObj
return np.sin(2*np.pi*(x[:, 0] + b.s_off.raw_value)) * np.cos(2*np.pi*(x[:, 1] + b.c_off.raw_value))
return np.sin(2*np.pi*(x[:, 0] + b.s_off.value)) * np.cos(2*np.pi*(x[:, 1] + b.c_off.value))


fig, ax = plt.subplots(2, 3, sharey=True, sharex=True)
Expand All @@ -55,7 +55,7 @@ def fit_fun(x, *args, **kwargs):
p1 = d[f'computed_{minimizer}'].plot(ax=ax[0, idx], cbar_kwargs={'cax': cbar_ax1})
p2 = d[f'dz_{minimizer}'].plot(ax=ax[1, idx], cbar_kwargs={'cax': cbar_ax2})
ax[0, idx].set_title(f'{minimizer}')
ax[1, idx].set_title('s_off - {:0.03f}\nc_off - {:0.03f}'.format(b.s_off.raw_value, b.c_off.raw_value))
ax[1, idx].set_title('s_off - {:0.03f}\nc_off - {:0.03f}'.format(b.s_off.value, b.c_off.value))
ax[0, idx].set_aspect('equal', 'box')
ax[1, idx].set_aspect('equal', 'box')
fig.subplots_adjust(right=0.8)
Expand Down
2 changes: 1 addition & 1 deletion examples_old/example_dataset4.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

def fit_fun(x, *args, **kwargs):
# In the real case we would gust call the evaluation fn without reference to the BaseObj
return b.c.raw_value + b.m.raw_value * x
return b.c.value + b.m.value * x


f = Fitter()
Expand Down
2 changes: 1 addition & 1 deletion examples_old/example_dataset4_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def from_params(cls, amplitude: float = 1, phase: float = 0, period: float = 2*n

def fit_fun(self, x, *args, **kwargs):
# In the real case we would gust call the evaluation fn without reference to the BaseObj
return self.amplitude.raw_value * np.sin((x + self.phase.raw_value)/self.period.raw_value)
return self.amplitude.value * np.sin((x + self.phase.value)/self.period.value)

b = Wavey.from_params()
bb = Wavey.from_params(1.1, 0.1, 1.9*np.pi)
Expand Down
Loading