-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3dd51fd
Showing
24 changed files
with
7,137 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Sitemap: https://fenke.github.io/corebridge/sitemap.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
[ | ||
{ | ||
"objectID": "aicorebridge.html", | ||
"href": "aicorebridge.html", | ||
"title": "AICore-Bridge", | ||
"section": "", | ||
"text": "source\n\nAICoreModule\n\n AICoreModule ()\n\nInitialize self. See help(type(self)) for accurate signature.\n\nsource\n\n\nAICoreModule.__init__\n\n AICoreModule.__init__ (processor:Callable, save_dir:str, assets_dir:str,\n *args, **kwargs)\n\nInitialize self. See help(type(self)) for accurate signature.\n\n\n\n\nType\nDetails\n\n\n\n\nprocessor\nCallable\ndata processing function\n\n\nsave_dir\nstr\npath where the module can keep files\n\n\nassets_dir\nstr\n\n\n\nargs\n\n\n\n\nkwargs\n\n\n\n\n\n\nsource\n\n\nAICoreModule.call_processor\n\n AICoreModule.call_processor (calldata, **callargs)\n\n\nsource\n\n\nAICoreModule.infer\n\n AICoreModule.infer (data:dict, *_, **kwargs)\n\n\nsource\n\n\nAICoreModule.get_callargs\n\n AICoreModule.get_callargs (**kwargs)\n\nGet arguments for the processor call\n\nsource\n\n\nAICoreModule.get_call_data\n\n AICoreModule.get_call_data (data:dict, recordformat='records',\n timezone='UTC', reversed=False)\n\nConvert data to the processor signature\n\nimport os, addroot\nimport corebridge\n\n\ndef test_function(data:pd.DataFrame, anumber:float=0):\n v = 2*anumber\n return data\n\n\nclass TestAICoreModule(AICoreModule):\n def __init__(self, save_dir, *args, **kwargs):\n super().__init__(test_function, save_dir, None, *args, **kwargs)\n\n\nsave_dir = os.path.join(os.getcwd(), 'cache')\ntest_module = TestAICoreModule(os.path.join(os.getcwd(), 'cache'), 1, 2, num_1=3, num_2=4)\n\nassert test_module.init_args == (1, 2)\nassert test_module.init_kwargs['num_1'] == 3\nassert test_module.init_kwargs['num_2'] == 4\nassert test_module.save_dir == save_dir\n\n\ntest_data = [\n dict(datetimeMeasure='2020-04-01T00:01:11.123Z', value=1.1),\n dict(datetimeMeasure='2020-04-02T00:20:00Z', value=2.3),\n]\nresult = test_module.infer(test_data, timezone='Europe/Amsterdam', anumber=None)\nprint(\"Test Data\\n\", json.dumps(test_data, indent=2))\nprint(\"Result Message\\n\", json.dumps(result['msg'], indent=2))\nprint(\"Result Data\\n\", json.dumps(result['data'], indent=2))\n\nTest Data\n [\n {\n \"datetimeMeasure\": \"2020-04-01T00:01:11.123Z\",\n \"value\": 1.1\n },\n {\n \"datetimeMeasure\": \"2020-04-02T00:20:00Z\",\n \"value\": 2.3\n }\n]\nResult Message\n [\n \"test_function((data: pandas.core.frame.DataFrame, anumber: float = 0))\",\n \"init_args: (1, 2), init_kwargs: {'num_1': 3, 'num_2': 4}\",\n \"lastSeen: False, recordformat: records, timezone: Europe/Amsterdam\",\n \"calldata shape: (2, 1)\",\n \"anumber: 0.0\",\n \"result shape: (2, 1)\"\n]\nResult Data\n [\n {\n \"time\": \"2020-04-01T02:01:11.123000+02:00\",\n \"value\": 1.1\n },\n {\n \"time\": \"2020-04-02T02:20:00+02:00\",\n \"value\": 2.3\n }\n]\n\n\n\n#import corebridge.core\n\n\nfrom corebridge.aicorebridge import AICoreModule\n\nLoading corebridge.aicorebridge 0.2.5 from /home/runner/work/corebridge/corebridge/corebridge/aicorebridge.py\n\n\n\nclass TestAICoreModule(AICoreModule):\n def __init__(self, save_dir, *args, **kwargs):\n super().__init__(test_function, save_dir, None, *args, **kwargs)\n \ntest_module = TestAICoreModule(os.path.join(os.getcwd(), 'cache'), 1, 2, num_1=3, num_2=4)\n\nassert test_module.init_args == (1, 2)\nassert test_module.init_kwargs['num_1'] == 3\nassert test_module.init_kwargs['num_2'] == 4\nassert test_module.save_dir == save_dir\n\n\ntest_data = [\n dict(datetimeMeasure='2020-04-01T00:01:11.123Z', value=1.1),\n dict(datetimeMeasure='2020-04-02T00:20:00Z', value=2.3),\n]\nresult = test_module.infer(test_data, timezone='Europe/Amsterdam', anumber=None)\nprint(\"Test Data\\n\", json.dumps(test_data, indent=2))\nprint(\"Result Message\\n\", json.dumps(result['msg'], indent=2))\nprint(\"Result Data\\n\", json.dumps(result['data'], indent=2))\n\nTest Data\n [\n {\n \"datetimeMeasure\": \"2020-04-01T00:01:11.123Z\",\n \"value\": 1.1\n },\n {\n \"datetimeMeasure\": \"2020-04-02T00:20:00Z\",\n \"value\": 2.3\n }\n]\nResult Message\n [\n \"test_function((data: pandas.core.frame.DataFrame, anumber: float = 0))\",\n \"init_args: (1, 2), init_kwargs: {'num_1': 3, 'num_2': 4}\",\n \"lastSeen: False, recordformat: records, timezone: Europe/Amsterdam\",\n \"calldata shape: (2, 1)\",\n \"anumber: 0.0\",\n \"result shape: (2, 1)\"\n]\nResult Data\n [\n {\n \"time\": \"2020-04-01T02:01:11.123000+02:00\",\n \"value\": 1.1\n },\n {\n \"time\": \"2020-04-02T02:20:00+02:00\",\n \"value\": 2.3\n }\n]\n\n\n\n\nReferences", | ||
"crumbs": [ | ||
"AICore-Bridge" | ||
] | ||
}, | ||
{ | ||
"objectID": "core.html", | ||
"href": "core.html", | ||
"title": "AICore-Bridge", | ||
"section": "", | ||
"text": "Converts Pandas dataframes and series, Numpy array’s and recarrays or a dictionary of individual timeseries into a Pandas dataframe with one datetime index. With all arrays dataframes and series it is assumed that the first column contains the timestamps.\n\nsource\n\n\n\n timeseries_dataframe (data:Union[pandas.core.frame.DataFrame,pandas.core.\n series.Series,dict,numpy.ndarray,numpy.recarray],\n timezone='UTC', columnnames=None)\n\nConvert various data formats to timeseries DataFrame\n\nsource\n\n\n\n\n set_time_index_zone (df:pandas.core.frame.DataFrame, timezone)\n\n\nsource\n\n\n\n\n timeseries_dataframe_from_datadict (data:dict, timecolumns,\n recordformat='records')\n\nConvert data dict to dataframe\n\nsource\n\n\n\n\n timeseries_dataframe_to_datadict\n (data:Union[pandas.core.frame.DataFrame\n ,pandas.core.series.Series,dict],\n recordformat:str='split',\n timezone:str='UTC',\n reversed:bool=False)", | ||
"crumbs": [ | ||
"AICore-Bridge" | ||
] | ||
}, | ||
{ | ||
"objectID": "core.html#timeseries_dataframe---standardized-timeseries-dataframe", | ||
"href": "core.html#timeseries_dataframe---standardized-timeseries-dataframe", | ||
"title": "AICore-Bridge", | ||
"section": "", | ||
"text": "Converts Pandas dataframes and series, Numpy array’s and recarrays or a dictionary of individual timeseries into a Pandas dataframe with one datetime index. With all arrays dataframes and series it is assumed that the first column contains the timestamps.\n\nsource\n\n\n\n timeseries_dataframe (data:Union[pandas.core.frame.DataFrame,pandas.core.\n series.Series,dict,numpy.ndarray,numpy.recarray],\n timezone='UTC', columnnames=None)\n\nConvert various data formats to timeseries DataFrame\n\nsource\n\n\n\n\n set_time_index_zone (df:pandas.core.frame.DataFrame, timezone)\n\n\nsource\n\n\n\n\n timeseries_dataframe_from_datadict (data:dict, timecolumns,\n recordformat='records')\n\nConvert data dict to dataframe\n\nsource\n\n\n\n\n timeseries_dataframe_to_datadict\n (data:Union[pandas.core.frame.DataFrame\n ,pandas.core.series.Series,dict],\n recordformat:str='split',\n timezone:str='UTC',\n reversed:bool=False)", | ||
"crumbs": [ | ||
"AICore-Bridge" | ||
] | ||
}, | ||
{ | ||
"objectID": "index.html", | ||
"href": "index.html", | ||
"title": "corebridge", | ||
"section": "", | ||
"text": "This package provides functions and classes to run wodan style processing functions in the Stactics AICore environment.", | ||
"crumbs": [ | ||
"corebridge" | ||
] | ||
}, | ||
{ | ||
"objectID": "index.html#installation", | ||
"href": "index.html#installation", | ||
"title": "corebridge", | ||
"section": "Installation", | ||
"text": "Installation\nUse\npip install corebridge\nto install corebrdige.", | ||
"crumbs": [ | ||
"corebridge" | ||
] | ||
}, | ||
{ | ||
"objectID": "index.html#how-to-use", | ||
"href": "index.html#how-to-use", | ||
"title": "corebridge", | ||
"section": "How to use", | ||
"text": "How to use\n\nIntroduction\nWodan is a proprietary backend service that applies high performance, custom analytical processing to timeseries data in the Whysor data and dashboarding environment.\nEach wodan module defines one function that operates as the entry point. The parameter annotations in this function definition are used to format data and retrieve parameters from the originating call to the wodan api. This function is called with data retrieved according to a specification and with additional parameters as annotated.\nA simple function might look like:\nimport numpy as np\n\ndef multiply(data:np.ndarray, multiplier:float=1.0):\n return data * multiplier\n \nWodan binds this function to a service endpoint and takes care of fetching data and parameters and converting the result for the caller.\n\n\nAICore modules\nFor AICore users define a class, always named Module with a constructor __init__ and a method infer.\nThis package defines a baseclass to quickly construct a custom Module class that is able to use a wodan processor function inside the AICore system:\nimport numpy as np\nimport corebridge\n\ndef multiply(data:np.ndarray, multiplier:float=1.0):\n return data * multiplier\n\nclass Module(corebridge.aicorebridge.AICoreModule):\n def __init__(self, save_dir, assets_dir, *args, **kwargs):\n super().__init__(multiply, save_dir, assets_dir, *args, **kwargs)\n \nThat’s it. Well, you can add parameters to __init__ that can be used as hyperparameters in the web-interface and you could override infer for the same reason. The baseclass takes care of converting call parameters and data to the function specification and, calls the function and converts the result for the caller, similar to the original Wodan service.", | ||
"crumbs": [ | ||
"corebridge" | ||
] | ||
}, | ||
{ | ||
"objectID": "index.html#development", | ||
"href": "index.html#development", | ||
"title": "corebridge", | ||
"section": "Development", | ||
"text": "Development\nSetup a virtual environment, activate it and install the development package and dependencies with, on linux\n pip install -e ‘.\\[dev\\]’\n\nor on Windows\n pip install -e .\\[dev\\]\n\n\nnbdev cycle\n\nedit\nnbdev_export\nnbdev_test\nnbdev_clean\nnbdev_readme\nnbdev_prepare\ngit add .", | ||
"crumbs": [ | ||
"corebridge" | ||
] | ||
} | ||
] |
Oops, something went wrong.