Skip to content

Commit

Permalink
Temporary fix to rolling
Browse files Browse the repository at this point in the history
  • Loading branch information
Suchismit4 committed Jan 8, 2025
1 parent b2dbe57 commit 241c4d9
Show file tree
Hide file tree
Showing 26 changed files with 669 additions and 1,025 deletions.
Binary file added apple_tsla_ema.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions bckup.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Extract the data as a JAX array
if isinstance(self.obj, xr.DataArray):
data = self.obj.data
elif isinstance(self.obj, xr.Dataset):
# Handle Dataset by applying rolling to each DataArray within
rolled_data = {}
for var in self.obj.data_vars:
rolled = self.reduce(
self.obj[var],
dim=self.dim,
window=self.window,
func=func,
**kwargs
)
rolled_data[var] = rolled
return xr.Dataset(rolled_data, coords=self.obj.coords)
else:
raise TypeError("Unsupported xarray object type.")

# Apply the u_roll method from TimeSeriesOps
rolled_array = TimeSeriesOps.u_roll(
data=data,
window_size=self.window,
func=func,
overlap_factor=kwargs.get('overlap_factor', None)
)

# Create a new xarray object with the rolled data
rolled_obj = self.obj.copy(data=rolled_array)

Loading

0 comments on commit 241c4d9

Please sign in to comment.