Skip to content

Instantly share code, notes, and snippets.

@YaronBlinder
Created August 26, 2016 15:24
Show Gist options
  • Save YaronBlinder/a029df5c84f39a892f01dfd97b1258d5 to your computer and use it in GitHub Desktop.
Save YaronBlinder/a029df5c84f39a892f01dfd97b1258d5 to your computer and use it in GitHub Desktop.
class CalcSCPlugin(BasePlugin): # REQUIRED
consumes_cols = ['filenames'] # REQUIRED
provides_cols = ['SpatialCorrelation'] # REQUIRED
def __init__(self, df):
super(CalcSCPlugin, self).__init__(df) # REQUIRED
def process(self, window_size): # TYPICAL
def _helper(filenames):
SC = calculateSC(filenames,spatial_correlation=True,window_size=window_size)
return {'SpatialCorrelation': SC}
new_df = self._df.apply(_helper) # Do some computation
self.result = new_df # REQUIRED
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment