diff --git a/docs/nodes/AI_ML/CLASSIFICATION/ACCURACY/examples/EX1/app.txt b/docs/nodes/AI_ML/CLASSIFICATION/ACCURACY/examples/EX1/app.txt index d619f7267f..925ff9b5d2 100644 --- a/docs/nodes/AI_ML/CLASSIFICATION/ACCURACY/examples/EX1/app.txt +++ b/docs/nodes/AI_ML/CLASSIFICATION/ACCURACY/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 150, "height": 150, "id": "READ_CSV-efb0cda7-2730-4aa9-ad47-153aabbab38f", - "type": "FILE", + "type": "EXTRACTORS", "data": { "id": "READ_CSV-efb0cda7-2730-4aa9-ad47-153aabbab38f", "label": "READ CSV", "func": "READ_CSV", - "type": "FILE", + "type": "EXTRACTORS", "ctrls": { "file_path": { "type": "str", @@ -45,12 +45,12 @@ "width": 150, "height": 150, "id": "READ_CSV-d92e3586-c0c0-4ebd-9713-02916b36e7b6", - "type": "FILE", + "type": "EXTRACTORS", "data": { "id": "READ_CSV-d92e3586-c0c0-4ebd-9713-02916b36e7b6", "label": "READ CSV 1", "func": "READ_CSV", - "type": "FILE", + "type": "EXTRACTORS", "ctrls": { "file_path": { "type": "str", @@ -85,12 +85,12 @@ "width": 150, "height": 150, "id": "EXTRACT_COLUMNS-957fd785-5d26-4a46-8f38-3060768f5e0c", - "type": "EXTRACT_COLUMNS", + "type": "EXTRACTORS", "data": { "id": "EXTRACT_COLUMNS-957fd785-5d26-4a46-8f38-3060768f5e0c", "label": "EXTRACT COLUMNS", "func": "EXTRACT_COLUMNS", - "type": "EXTRACT_COLUMNS", + "type": "EXTRACTORS", "ctrls": { "columns": { "type": "Array", @@ -133,12 +133,12 @@ "width": 150, "height": 150, "id": "EXTRACT_COLUMNS-a11a9de2-476a-40d1-99e2-5abd3d1f38fc", - "type": "EXTRACT_COLUMNS", + "type": "EXTRACTORS", "data": { "id": "EXTRACT_COLUMNS-a11a9de2-476a-40d1-99e2-5abd3d1f38fc", "label": "EXTRACT COLUMNS 1", "func": "EXTRACT_COLUMNS", - "type": "EXTRACT_COLUMNS", + "type": "EXTRACTORS", "ctrls": { "columns": { "type": "Array", @@ -181,12 +181,12 @@ "width": 150, "height": 150, "id": "EXTRACT_COLUMNS-65b1438d-f76e-4151-90cc-6b0a0c2698b0", - "type": "EXTRACT_COLUMNS", + "type": "EXTRACTORS", "data": { "id": "EXTRACT_COLUMNS-65b1438d-f76e-4151-90cc-6b0a0c2698b0", "label": "EXTRACT COLUMNS 2", "func": "EXTRACT_COLUMNS", - "type": "EXTRACT_COLUMNS", + "type": "EXTRACTORS", "ctrls": { "columns": { "type": "Array", @@ -229,12 +229,12 @@ "width": 150, "height": 150, "id": "EXTRACT_COLUMNS-8ff329af-40f4-4efc-bb12-5d10a7fde800", - "type": "EXTRACT_COLUMNS", + "type": "EXTRACTORS", "data": { "id": "EXTRACT_COLUMNS-8ff329af-40f4-4efc-bb12-5d10a7fde800", "label": "EXTRACT COLUMNS 3", "func": "EXTRACT_COLUMNS", - "type": "EXTRACT_COLUMNS", + "type": "EXTRACTORS", "ctrls": { "columns": { "type": "Array", @@ -277,12 +277,12 @@ "width": 150, "height": 150, "id": "SUPPORT_VECTOR_MACHINE-6d59b4fc-d2d2-4dbc-956e-6818cec198d4", - "type": "CLASSIFICATION", + "type": "AI_ML", "data": { "id": "SUPPORT_VECTOR_MACHINE-6d59b4fc-d2d2-4dbc-956e-6818cec198d4", "label": "SUPPORT VECTOR MACHINE", "func": "SUPPORT_VECTOR_MACHINE", - "type": "CLASSIFICATION", + "type": "AI_ML", "ctrls": { "kernel": { "type": "select", @@ -350,12 +350,12 @@ "width": 150, "height": 150, "id": "ACCURACY-b375ef9d-2c74-4f73-88d8-717c020422e4", - "type": "CLASSIFICATION", + "type": "AI_ML", "data": { "id": "ACCURACY-b375ef9d-2c74-4f73-88d8-717c020422e4", "label": "ACCURACY", "func": "ACCURACY", - "type": "CLASSIFICATION", + "type": "AI_ML", "ctrls": { "true_label": { "type": "str", @@ -411,12 +411,12 @@ "width": 380, "height": 293, "id": "TABLE-22193775-285f-4b58-93b5-9a8260454424", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "TABLE-22193775-285f-4b58-93b5-9a8260454424", "label": "TABLE", "func": "TABLE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -446,39 +446,6 @@ "y": 316.6433733865691 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-ae48654b-4e66-40ed-900e-4a3fe291acd9", - "type": "TERMINATORS", - "data": { - "id": "END-ae48654b-4e66-40ed-900e-4a3fe291acd9", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": true - }, - "position": { - "x": 3159.2381382657973, - "y": 398.56674826278174 - }, - "selected": true, - "positionAbsolute": { - "x": 3159.2381382657973, - "y": 398.56674826278174 - }, - "dragging": true } ], "edges": [ @@ -551,13 +518,6 @@ "target": "TABLE-22193775-285f-4b58-93b5-9a8260454424", "targetHandle": "default", "id": "reactflow__edge-ACCURACY-b375ef9d-2c74-4f73-88d8-717c020422e4default-TABLE-22193775-285f-4b58-93b5-9a8260454424default" - }, - { - "source": "TABLE-22193775-285f-4b58-93b5-9a8260454424", - "sourceHandle": "default", - "target": "END-ae48654b-4e66-40ed-900e-4a3fe291acd9", - "targetHandle": "default", - "id": "reactflow__edge-TABLE-22193775-285f-4b58-93b5-9a8260454424default-END-ae48654b-4e66-40ed-900e-4a3fe291acd9default" } ], "viewport": { diff --git a/docs/nodes/AI_ML/CLASSIFICATION/ONE_HOT_ENCODING/examples/EX1/app.txt b/docs/nodes/AI_ML/CLASSIFICATION/ONE_HOT_ENCODING/examples/EX1/app.txt index d58d964c44..6158c0b280 100644 --- a/docs/nodes/AI_ML/CLASSIFICATION/ONE_HOT_ENCODING/examples/EX1/app.txt +++ b/docs/nodes/AI_ML/CLASSIFICATION/ONE_HOT_ENCODING/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 150, "height": 150, "id": "PLOTLY_DATASET-905b1a9b-05ef-4ae4-b51a-8574359571cf", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "data": { "id": "PLOTLY_DATASET-905b1a9b-05ef-4ae4-b51a-8574359571cf", "label": "PLOTLY DATASET", "func": "PLOTLY_DATASET", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "ctrls": { "dataset_key": { "type": "select", @@ -56,12 +56,12 @@ "width": 150, "height": 150, "id": "EXTRACT_COLUMNS-c8e238a7-337c-479f-a2c6-bf607cb52779", - "type": "EXTRACT_COLUMNS", + "type": "EXTRACTORS", "data": { "id": "EXTRACT_COLUMNS-c8e238a7-337c-479f-a2c6-bf607cb52779", "label": "EXTRACT COLUMNS", "func": "EXTRACT_COLUMNS", - "type": "EXTRACT_COLUMNS", + "type": "EXTRACTORS", "ctrls": { "columns": { "type": "Array", @@ -104,12 +104,12 @@ "width": 150, "height": 150, "id": "ONE_HOT_ENCODING-eef29534-7bf7-4d54-aff9-8fc25081c822", - "type": "CLASSIFICATION", + "type": "AI_ML", "data": { "id": "ONE_HOT_ENCODING-eef29534-7bf7-4d54-aff9-8fc25081c822", "label": "ONE HOT ENCODING", "func": "ONE_HOT_ENCODING", - "type": "CLASSIFICATION", + "type": "AI_ML", "ctrls": {}, "inputs": [ { @@ -150,12 +150,12 @@ "width": 225, "height": 226, "id": "TABLE-e6aab77d-927f-4eeb-be3f-afdd469df2ae", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "TABLE-e6aab77d-927f-4eeb-be3f-afdd469df2ae", "label": "TABLE", "func": "TABLE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -185,39 +185,6 @@ "y": 13.83665125511368 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-231a4b73-fe64-458a-8c94-639ad6bf3185", - "type": "TERMINATORS", - "data": { - "id": "END-231a4b73-fe64-458a-8c94-639ad6bf3185", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": true - }, - "position": { - "x": 1435.9145236034444, - "y": 59.62742310508037 - }, - "selected": true, - "positionAbsolute": { - "x": 1435.9145236034444, - "y": 59.62742310508037 - }, - "dragging": true } ], "edges": [ @@ -248,13 +215,6 @@ "target": "TABLE-e6aab77d-927f-4eeb-be3f-afdd469df2ae", "targetHandle": "default", "id": "reactflow__edge-ONE_HOT_ENCODING-eef29534-7bf7-4d54-aff9-8fc25081c822default-TABLE-e6aab77d-927f-4eeb-be3f-afdd469df2aedefault" - }, - { - "source": "TABLE-e6aab77d-927f-4eeb-be3f-afdd469df2ae", - "sourceHandle": "default", - "target": "END-231a4b73-fe64-458a-8c94-639ad6bf3185", - "targetHandle": "default", - "id": "reactflow__edge-TABLE-e6aab77d-927f-4eeb-be3f-afdd469df2aedefault-END-231a4b73-fe64-458a-8c94-639ad6bf3185default" } ], "viewport": { diff --git a/docs/nodes/AI_ML/CLASSIFICATION/SUPPORT_VECTOR_MACHINE/examples/EX1/app.txt b/docs/nodes/AI_ML/CLASSIFICATION/SUPPORT_VECTOR_MACHINE/examples/EX1/app.txt index 085fe474ce..7f94512f28 100644 --- a/docs/nodes/AI_ML/CLASSIFICATION/SUPPORT_VECTOR_MACHINE/examples/EX1/app.txt +++ b/docs/nodes/AI_ML/CLASSIFICATION/SUPPORT_VECTOR_MACHINE/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 150, "height": 150, "id": "READ_CSV-59c660d6-c37c-48e6-9e32-11490ebba845", - "type": "FILE", + "type": "EXTRACTORS", "data": { "id": "READ_CSV-59c660d6-c37c-48e6-9e32-11490ebba845", "label": "READ CSV", "func": "READ_CSV", - "type": "FILE", + "type": "EXTRACTORS", "ctrls": { "file_path": { "type": "str", @@ -45,12 +45,12 @@ "width": 150, "height": 150, "id": "READ_CSV-90526963-cd8b-4b79-bf22-12138be6d2c7", - "type": "FILE", + "type": "EXTRACTORS", "data": { "id": "READ_CSV-90526963-cd8b-4b79-bf22-12138be6d2c7", "label": "READ CSV 1", "func": "READ_CSV", - "type": "FILE", + "type": "EXTRACTORS", "ctrls": { "file_path": { "type": "str", @@ -85,12 +85,12 @@ "width": 225, "height": 226, "id": "TABLE-500d4621-276f-4b84-a114-1e4498781381", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "TABLE-500d4621-276f-4b84-a114-1e4498781381", "label": "TABLE", "func": "TABLE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -108,62 +108,29 @@ } ], "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/TABLE/TABLE.py", - "selected": true + "selected": false }, "position": { "x": 1496.5324809006217, "y": 648.6028296725746 }, - "selected": true, + "selected": false, "positionAbsolute": { "x": 1496.5324809006217, "y": 648.6028296725746 }, "dragging": true }, - { - "width": 210, - "height": 130, - "id": "END-287eeb1e-c006-47bd-baab-6e4d5620511f", - "type": "TERMINATORS", - "data": { - "id": "END-287eeb1e-c006-47bd-baab-6e4d5620511f", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 1869.9754564291857, - "y": 695.9533252080201 - }, - "selected": false, - "positionAbsolute": { - "x": 1869.9754564291857, - "y": 695.9533252080201 - }, - "dragging": true - }, { "width": 150, "height": 150, "id": "SUPPORT_VECTOR_MACHINE-111df792-52d2-41ac-9662-1066da12d44b", - "type": "CLASSIFICATION", + "type": "AI_ML", "data": { "id": "SUPPORT_VECTOR_MACHINE-111df792-52d2-41ac-9662-1066da12d44b", "label": "SUPPORT VECTOR MACHINE", "func": "SUPPORT_VECTOR_MACHINE", - "type": "CLASSIFICATION", + "type": "AI_ML", "ctrls": { "kernel": { "type": "select", @@ -231,12 +198,12 @@ "width": 150, "height": 150, "id": "EXTRACT_COLUMNS-afb1e4ac-a149-400c-b795-0f3fd78ab5f7", - "type": "EXTRACT_COLUMNS", + "type": "EXTRACTORS", "data": { "id": "EXTRACT_COLUMNS-afb1e4ac-a149-400c-b795-0f3fd78ab5f7", "label": "EXTRACT COLUMNS", "func": "EXTRACT_COLUMNS", - "type": "EXTRACT_COLUMNS", + "type": "EXTRACTORS", "ctrls": { "columns": { "type": "Array", @@ -279,12 +246,12 @@ "width": 150, "height": 150, "id": "EXTRACT_COLUMNS-394a3bea-c4b0-4e54-821b-8392c1bcaac0", - "type": "EXTRACT_COLUMNS", + "type": "EXTRACTORS", "data": { "id": "EXTRACT_COLUMNS-394a3bea-c4b0-4e54-821b-8392c1bcaac0", "label": "EXTRACT COLUMNS 1", "func": "EXTRACT_COLUMNS", - "type": "EXTRACT_COLUMNS", + "type": "EXTRACTORS", "ctrls": { "columns": { "type": "Array", @@ -325,13 +292,6 @@ } ], "edges": [ - { - "source": "TABLE-500d4621-276f-4b84-a114-1e4498781381", - "sourceHandle": "default", - "target": "END-287eeb1e-c006-47bd-baab-6e4d5620511f", - "targetHandle": "default", - "id": "reactflow__edge-TABLE-500d4621-276f-4b84-a114-1e4498781381default-END-287eeb1e-c006-47bd-baab-6e4d5620511fdefault" - }, { "source": "READ_CSV-59c660d6-c37c-48e6-9e32-11490ebba845", "sourceHandle": "default", diff --git a/docs/nodes/AI_ML/CLASSIFICATION/TRAIN_TEST_SPLIT/examples/EX1/app.txt b/docs/nodes/AI_ML/CLASSIFICATION/TRAIN_TEST_SPLIT/examples/EX1/app.txt index 04a64317e1..5fe4c3e400 100644 --- a/docs/nodes/AI_ML/CLASSIFICATION/TRAIN_TEST_SPLIT/examples/EX1/app.txt +++ b/docs/nodes/AI_ML/CLASSIFICATION/TRAIN_TEST_SPLIT/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 150, "height": 150, "id": "READ_CSV-387daa06-4a0d-4a9c-b2f3-604318bdf972", - "type": "FILE", + "type": "EXTRACTORS", "data": { "id": "READ_CSV-387daa06-4a0d-4a9c-b2f3-604318bdf972", "label": "READ CSV", "func": "READ_CSV", - "type": "FILE", + "type": "EXTRACTORS", "ctrls": { "file_path": { "type": "str", @@ -45,12 +45,12 @@ "width": 150, "height": 150, "id": "TRAIN_TEST_SPLIT-dd597d43-f67f-4cd8-9444-3782f083231b", - "type": "CLASSIFICATION", + "type": "AI_ML", "data": { "id": "TRAIN_TEST_SPLIT-dd597d43-f67f-4cd8-9444-3782f083231b", "label": "TRAIN TEST SPLIT", "func": "TRAIN_TEST_SPLIT", - "type": "CLASSIFICATION", + "type": "AI_ML", "ctrls": { "test_size": { "type": "float", @@ -104,12 +104,12 @@ "width": 225, "height": 226, "id": "TABLE-7c7e2534-d55a-48d0-9e5c-9fececfaf78a", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "TABLE-7c7e2534-d55a-48d0-9e5c-9fececfaf78a", "label": "TABLE", "func": "TABLE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -144,12 +144,12 @@ "width": 225, "height": 226, "id": "TABLE-9a6fa967-be36-4f5d-93c8-dd6a5b5b349a", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "TABLE-9a6fa967-be36-4f5d-93c8-dd6a5b5b349a", "label": "TABLE 1", "func": "TABLE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -179,39 +179,6 @@ "y": 688.907639667992 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-0dcff955-1241-4b5a-85fe-da3d3be6f719", - "type": "TERMINATORS", - "data": { - "id": "END-0dcff955-1241-4b5a-85fe-da3d3be6f719", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 1601.5478750599991, - "y": 480.401079376485 - }, - "selected": false, - "positionAbsolute": { - "x": 1601.5478750599991, - "y": 480.401079376485 - }, - "dragging": true } ], "edges": [ @@ -235,20 +202,6 @@ "target": "TABLE-9a6fa967-be36-4f5d-93c8-dd6a5b5b349a", "targetHandle": "default", "id": "reactflow__edge-TRAIN_TEST_SPLIT-dd597d43-f67f-4cd8-9444-3782f083231btest-TABLE-9a6fa967-be36-4f5d-93c8-dd6a5b5b349adefault" - }, - { - "source": "TABLE-7c7e2534-d55a-48d0-9e5c-9fececfaf78a", - "sourceHandle": "default", - "target": "END-0dcff955-1241-4b5a-85fe-da3d3be6f719", - "targetHandle": "default", - "id": "reactflow__edge-TABLE-7c7e2534-d55a-48d0-9e5c-9fececfaf78adefault-END-0dcff955-1241-4b5a-85fe-da3d3be6f719default" - }, - { - "source": "TABLE-9a6fa967-be36-4f5d-93c8-dd6a5b5b349a", - "sourceHandle": "default", - "target": "END-0dcff955-1241-4b5a-85fe-da3d3be6f719", - "targetHandle": "default", - "id": "reactflow__edge-TABLE-9a6fa967-be36-4f5d-93c8-dd6a5b5b349adefault-END-0dcff955-1241-4b5a-85fe-da3d3be6f719default" } ], "viewport": { diff --git a/docs/nodes/AI_ML/IMAGE_CAPTIONING/NLP_CONNECT_VIT_GPT2/a1-[autogen]/python_code.txt b/docs/nodes/AI_ML/IMAGE_CAPTIONING/NLP_CONNECT_VIT_GPT2/a1-[autogen]/python_code.txt index b5f134f7c3..6a94acf642 100644 --- a/docs/nodes/AI_ML/IMAGE_CAPTIONING/NLP_CONNECT_VIT_GPT2/a1-[autogen]/python_code.txt +++ b/docs/nodes/AI_ML/IMAGE_CAPTIONING/NLP_CONNECT_VIT_GPT2/a1-[autogen]/python_code.txt @@ -16,8 +16,9 @@ def NLP_CONNECT_VIT_GPT2(default: Image) -> DataFrame: import pandas as pd import transformers + import torch import torchvision.transforms.functional as TF - from flojoy import snapshot_download + from flojoy import DataFrame, snapshot_download r, g, b, a = default.r, default.g, default.b, default.a nparray = ( @@ -36,10 +37,11 @@ def NLP_CONNECT_VIT_GPT2(default: Image) -> DataFrame: feature_extractor = transformers.ViTImageProcessor.from_pretrained(local_repo_path) tokenizer = transformers.AutoTokenizer.from_pretrained(local_repo_path) - pixel_values = feature_extractor(images=[image], return_tensors="pt").pixel_values # type: ignore - output_ids = model.generate(pixel_values, max_length=16, num_beams=4) # type: ignore - preds = tokenizer.batch_decode(output_ids, skip_special_tokens=True) # type: ignore - pred = preds[0].strip() + with torch.inference_mode(): + pixel_values = feature_extractor(images=[image], return_tensors="pt").pixel_values # type: ignore + output_ids = model.generate(pixel_values, max_length=16, num_beams=4) # type: ignore + preds = tokenizer.batch_decode(output_ids, skip_special_tokens=True) # type: ignore + pred = preds[0].strip() df_pred = pd.DataFrame.from_records([(pred,)], columns=["caption"]) diff --git a/docs/nodes/AI_ML/IMAGE_CAPTIONING/NLP_CONNECT_VIT_GPT2/examples/EX1/app.txt b/docs/nodes/AI_ML/IMAGE_CAPTIONING/NLP_CONNECT_VIT_GPT2/examples/EX1/app.txt index 7698a10d57..97f4dc2a97 100644 --- a/docs/nodes/AI_ML/IMAGE_CAPTIONING/NLP_CONNECT_VIT_GPT2/examples/EX1/app.txt +++ b/docs/nodes/AI_ML/IMAGE_CAPTIONING/NLP_CONNECT_VIT_GPT2/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 150, "height": 150, "id": "LOCAL_FILE-37e74f08-bfb2-49d1-bec2-d962fda0f0a6", - "type": "LOCAL_FILE_SYSTEM", + "type": "LOADERS", "data": { "id": "LOCAL_FILE-37e74f08-bfb2-49d1-bec2-d962fda0f0a6", "label": "LOCAL FILE", "func": "LOCAL_FILE", - "type": "LOCAL_FILE_SYSTEM", + "type": "LOADERS", "ctrls": { "file_path": { "type": "str", @@ -69,12 +69,12 @@ "width": 150, "height": 150, "id": "NLP_CONNECT_VIT_GPT2-f4c9d884-68df-45a4-a06a-9c56750ff1c1", - "type": "IMAGE_CAPTIONING", + "type": "AI_ML", "data": { "id": "NLP_CONNECT_VIT_GPT2-f4c9d884-68df-45a4-a06a-9c56750ff1c1", "label": "NLP CONNECT VIT GPT2", "func": "NLP_CONNECT_VIT_GPT2", - "type": "IMAGE_CAPTIONING", + "type": "AI_ML", "ctrls": {}, "inputs": [ { @@ -109,12 +109,12 @@ "width": 380, "height": 293, "id": "TABLE-15ab5a91-a962-4f8e-ba9c-8a159d576dbb", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "TABLE-15ab5a91-a962-4f8e-ba9c-8a159d576dbb", "label": "TABLE", "func": "TABLE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -145,49 +145,16 @@ }, "dragging": true }, - { - "width": 210, - "height": 130, - "id": "END-16e2a698-7f97-4237-8225-86cb042f4cae", - "type": "TERMINATORS", - "data": { - "id": "END-16e2a698-7f97-4237-8225-86cb042f4cae", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 2044.4309477737384, - "y": 257.69988533229866 - }, - "selected": false, - "positionAbsolute": { - "x": 2044.4309477737384, - "y": 257.69988533229866 - }, - "dragging": true - }, { "width": 380, "height": 293, "id": "IMAGE-ec76f3cf-6397-45cf-a1e0-ce43c89a9327", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "IMAGE-ec76f3cf-6397-45cf-a1e0-ce43c89a9327", "label": "IMAGE", "func": "IMAGE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -234,13 +201,6 @@ "targetHandle": "default", "id": "reactflow__edge-NLP_CONNECT_VIT_GPT2-f4c9d884-68df-45a4-a06a-9c56750ff1c1default-TABLE-15ab5a91-a962-4f8e-ba9c-8a159d576dbbdefault" }, - { - "source": "TABLE-15ab5a91-a962-4f8e-ba9c-8a159d576dbb", - "sourceHandle": "default", - "target": "END-16e2a698-7f97-4237-8225-86cb042f4cae", - "targetHandle": "default", - "id": "reactflow__edge-TABLE-15ab5a91-a962-4f8e-ba9c-8a159d576dbbdefault-END-16e2a698-7f97-4237-8225-86cb042f4caedefault" - }, { "source": "LOCAL_FILE-37e74f08-bfb2-49d1-bec2-d962fda0f0a6", "sourceHandle": "default", diff --git a/docs/nodes/AI_ML/NLP/COUNT_VECTORIZER/a1-[autogen]/docstring.txt b/docs/nodes/AI_ML/NLP/COUNT_VECTORIZER/a1-[autogen]/docstring.txt index fd3fba7c09..afc40955b2 100644 --- a/docs/nodes/AI_ML/NLP/COUNT_VECTORIZER/a1-[autogen]/docstring.txt +++ b/docs/nodes/AI_ML/NLP/COUNT_VECTORIZER/a1-[autogen]/docstring.txt @@ -1,4 +1,4 @@ -The COUNT_VECTORIZER node converts a collection (matrix, vector or dataframe) of text documents to a matrix of token counts. +The COUNT_VECTORIZER node receives a collection (matrix, vector or dataframe) of text documents to a matrix of token counts. Returns ------- diff --git a/docs/nodes/AI_ML/NLP/COUNT_VECTORIZER/a1-[autogen]/python_code.txt b/docs/nodes/AI_ML/NLP/COUNT_VECTORIZER/a1-[autogen]/python_code.txt index 1ed814884d..39b0fdad68 100644 --- a/docs/nodes/AI_ML/NLP/COUNT_VECTORIZER/a1-[autogen]/python_code.txt +++ b/docs/nodes/AI_ML/NLP/COUNT_VECTORIZER/a1-[autogen]/python_code.txt @@ -24,6 +24,6 @@ def COUNT_VECTORIZER(default: DataFrame | Matrix | Vector) -> CountVectorizerOut X = vectorizer.fit_transform(data.flatten()) x = pd.DataFrame({"tokens": vectorizer.get_feature_names_out()}) - y = X.toarray() + y = X.toarray() # type: ignore return CountVectorizerOutput(tokens=DataFrame(df=x), word_count_vector=Vector(v=y)) diff --git a/docs/nodes/AI_ML/NLP/COUNT_VECTORIZER/examples/EX1/app.jpeg b/docs/nodes/AI_ML/NLP/COUNT_VECTORIZER/examples/EX1/app.jpeg index cbf46bfc54..98a5b2f2a0 100644 Binary files a/docs/nodes/AI_ML/NLP/COUNT_VECTORIZER/examples/EX1/app.jpeg and b/docs/nodes/AI_ML/NLP/COUNT_VECTORIZER/examples/EX1/app.jpeg differ diff --git a/docs/nodes/AI_ML/NLP/COUNT_VECTORIZER/examples/EX1/app.txt b/docs/nodes/AI_ML/NLP/COUNT_VECTORIZER/examples/EX1/app.txt index 7f885bddb1..2c51e4e4e6 100644 --- a/docs/nodes/AI_ML/NLP/COUNT_VECTORIZER/examples/EX1/app.txt +++ b/docs/nodes/AI_ML/NLP/COUNT_VECTORIZER/examples/EX1/app.txt @@ -2,298 +2,262 @@ "rfInstance": { "nodes": [ { - "width": 150, - "height": 150, - "id": "READ_CSV-f1fcde08-f265-49e1-8fef-ca10fdd91cb5", - "type": "FILE", + "width": 160, + "height": 160, + "id": "READ_CSV-c1741573-62fc-4e56-9d67-96e2d057589f", + "type": "EXTRACTORS", "data": { - "id": "READ_CSV-f1fcde08-f265-49e1-8fef-ca10fdd91cb5", + "id": "READ_CSV-c1741573-62fc-4e56-9d67-96e2d057589f", "label": "READ CSV", "func": "READ_CSV", - "type": "FILE", + "type": "EXTRACTORS", "ctrls": { "file_path": { "type": "str", "default": "https://raw.githubusercontent.com/cs109/2014_data/master/countries.csv", + "desc": "File path to the CSV file or an URL of CSV file", "functionName": "READ_CSV", "param": "file_path", - "value": "./PYTHON/nodes/AI_ML/NLP/COUNT_VECTORIZER/assets/text.csv" + "value": "PYTHON/nodes/AI_ML/NLP/COUNT_VECTORIZER/assets/text.csv" } }, "outputs": [ { "name": "default", "id": "default", - "type": "DataFrame" + "type": "DataFrame", + "desc": null } ], "path": "PYTHON/nodes/EXTRACTORS/FILE/READ_CSV/READ_CSV.py", "selected": false }, "position": { - "x": 331.7913972781864, - "y": -45.20608554695849 + "x": -110.98427597492659, + "y": -10.73536422316019 }, "selected": false, "positionAbsolute": { - "x": 331.7913972781864, - "y": -45.20608554695849 + "x": -110.98427597492659, + "y": -10.73536422316019 }, "dragging": true }, { - "width": 380, - "height": 293, - "id": "TABLE-872d4963-d2da-4147-9b54-0487a4b6d5c2", - "type": "PLOTLY", + "width": 208, + "height": 132, + "id": "COUNT_VECTORIZER-cbdccd55-5dee-413e-9180-57e18005dd7e", + "type": "AI_ML", "data": { - "id": "TABLE-872d4963-d2da-4147-9b54-0487a4b6d5c2", - "label": "TABLE", - "func": "TABLE", - "type": "PLOTLY", + "id": "COUNT_VECTORIZER-cbdccd55-5dee-413e-9180-57e18005dd7e", + "label": "COUNT VECTORIZER", + "func": "COUNT_VECTORIZER", + "type": "AI_ML", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", - "type": "OrderedTriple|OrderedPair|DataFrame|Matrix", - "multiple": false + "type": "DataFrame|Matrix|Vector", + "multiple": false, + "desc": null } ], "outputs": [ { - "name": "default", - "id": "default", - "type": "Plotly" + "name": "tokens", + "id": "tokens", + "type": "DataFrame", + "desc": null + }, + { + "name": "word_count_vector", + "id": "word_count_vector", + "type": "Vector", + "desc": null } ], - "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/TABLE/TABLE.py", + "pip_dependencies": [ + { + "name": "scikit-learn", + "v": "1.2.2" + } + ], + "path": "PYTHON/nodes/AI_ML/NLP/COUNT_VECTORIZER/COUNT_VECTORIZER.py", "selected": false }, "position": { - "x": 977.4500939326523, - "y": 145.97012982652666 + "x": 131.34474766051025, + "y": -0.556428681455003 }, "selected": false, "positionAbsolute": { - "x": 977.4500939326523, - "y": 145.97012982652666 + "x": 131.34474766051025, + "y": -0.556428681455003 }, "dragging": true }, { "width": 380, "height": 293, - "id": "TABLE-5af7fb76-685e-4970-8de1-67192cdbe6b8", - "type": "PLOTLY", + "id": "TABLE-30ea1761-9951-4e88-a338-4d9dadfaa109", + "type": "VISUALIZERS", "data": { - "id": "TABLE-5af7fb76-685e-4970-8de1-67192cdbe6b8", - "label": "TABLE 1", + "id": "TABLE-30ea1761-9951-4e88-a338-4d9dadfaa109", + "label": "TABLE", "func": "TABLE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", - "type": "OrderedTriple|OrderedPair|DataFrame|Matrix", - "multiple": false + "type": "OrderedTriple|OrderedPair|DataFrame|Matrix|Vector", + "multiple": false, + "desc": null } ], "outputs": [ { "name": "default", "id": "default", - "type": "Plotly" + "type": "Plotly", + "desc": null } ], "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/TABLE/TABLE.py", "selected": false }, "position": { - "x": 967.4035764399761, - "y": -239.07237117806883 + "x": 113.44753341488456, + "y": -281.98557347667753 }, "selected": false, "positionAbsolute": { - "x": 967.4035764399761, - "y": -239.07237117806883 + "x": 113.44753341488456, + "y": -281.98557347667753 }, "dragging": true }, { - "width": 210, - "height": 130, - "id": "END-d704234b-c148-4243-a75e-0cf8e6f0d770", - "type": "TERMINATORS", + "width": 380, + "height": 293, + "id": "TABLE-0bae26a8-e528-4b2c-839c-5422dcf88a81", + "type": "VISUALIZERS", "data": { - "id": "END-d704234b-c148-4243-a75e-0cf8e6f0d770", - "label": "END", - "func": "END", - "type": "TERMINATORS", + "id": "TABLE-0bae26a8-e528-4b2c-839c-5422dcf88a81", + "label": "TABLE 1", + "func": "TABLE", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", - "type": "Any", - "multiple": false + "type": "OrderedTriple|OrderedPair|DataFrame|Matrix|Vector", + "multiple": false, + "desc": null } ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 1424.8846979849764, - "y": -36.2985347256772 - }, - "selected": false, - "positionAbsolute": { - "x": 1424.8846979849764, - "y": -36.2985347256772 - }, - "dragging": true - }, - { - "width": 150, - "height": 150, - "id": "COUNT_VECTORIZER-cc904776-6e4f-48a4-8f6a-33be7f48900e", - "type": "NLP", - "data": { - "id": "COUNT_VECTORIZER-cc904776-6e4f-48a4-8f6a-33be7f48900e", - "label": "COUNT VECTORIZER", - "func": "COUNT_VECTORIZER", - "type": "NLP", - "ctrls": {}, - "inputs": [ + "outputs": [ { "name": "default", "id": "default", - "type": "DataFrame|Matrix|Vector", - "multiple": false + "type": "Plotly", + "desc": null } ], - "outputs": [ - { - "name": "tokens", - "id": "tokens", - "type": "DataFrame" - }, - { - "name": "word_count_vector", - "id": "word_count_vector", - "type": "Matrix" - } - ], - "pip_dependencies": [ - { - "name": "scikit-learn", - "v": "1.2.2" - } - ], - "path": "PYTHON/nodes/AI_ML/NLP/COUNT_VECTORIZER/COUNT_VECTORIZER.py", + "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/TABLE/TABLE.py", "selected": false }, "position": { - "x": 711.5187499870754, - "y": -46.008380300353565 + "x": 450.19382383028744, + "y": 60.65139178762516 }, "selected": false, "positionAbsolute": { - "x": 711.5187499870754, - "y": -46.008380300353565 + "x": 450.19382383028744, + "y": 60.65139178762516 }, "dragging": true }, { "width": 380, "height": 293, - "id": "TABLE-cae87046-5eff-4db4-9cb5-b64e5c02c50b", - "type": "PLOTLY", + "id": "TABLE-080bcffe-4b33-4849-b4e8-7a26a826f4ee", + "type": "VISUALIZERS", "data": { - "id": "TABLE-cae87046-5eff-4db4-9cb5-b64e5c02c50b", + "id": "TABLE-080bcffe-4b33-4849-b4e8-7a26a826f4ee", "label": "TABLE 2", "func": "TABLE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", "type": "OrderedTriple|OrderedPair|DataFrame|Matrix|Vector", - "multiple": false + "multiple": false, + "desc": null } ], "outputs": [ { "name": "default", "id": "default", - "type": "Plotly" + "type": "Plotly", + "desc": null } ], "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/TABLE/TABLE.py", "selected": false }, "position": { - "x": 517.0533116509799, - "y": 151.4498699326736 + "x": 444.978957837495, + "y": -256.5186696950019 }, "selected": false, "positionAbsolute": { - "x": 517.0533116509799, - "y": 151.4498699326736 + "x": 444.978957837495, + "y": -256.5186696950019 }, "dragging": true } ], "edges": [ { - "source": "TABLE-5af7fb76-685e-4970-8de1-67192cdbe6b8", - "sourceHandle": "default", - "target": "END-d704234b-c148-4243-a75e-0cf8e6f0d770", - "targetHandle": "default", - "id": "reactflow__edge-TABLE-5af7fb76-685e-4970-8de1-67192cdbe6b8default-END-d704234b-c148-4243-a75e-0cf8e6f0d770default" - }, - { - "source": "TABLE-872d4963-d2da-4147-9b54-0487a4b6d5c2", - "sourceHandle": "default", - "target": "END-d704234b-c148-4243-a75e-0cf8e6f0d770", - "targetHandle": "default", - "id": "reactflow__edge-TABLE-872d4963-d2da-4147-9b54-0487a4b6d5c2default-END-d704234b-c148-4243-a75e-0cf8e6f0d770default" - }, - { - "source": "READ_CSV-f1fcde08-f265-49e1-8fef-ca10fdd91cb5", + "source": "READ_CSV-c1741573-62fc-4e56-9d67-96e2d057589f", "sourceHandle": "default", - "target": "COUNT_VECTORIZER-cc904776-6e4f-48a4-8f6a-33be7f48900e", + "target": "COUNT_VECTORIZER-cbdccd55-5dee-413e-9180-57e18005dd7e", "targetHandle": "default", - "id": "reactflow__edge-READ_CSV-f1fcde08-f265-49e1-8fef-ca10fdd91cb5default-COUNT_VECTORIZER-cc904776-6e4f-48a4-8f6a-33be7f48900edefault" + "id": "reactflow__edge-READ_CSV-c1741573-62fc-4e56-9d67-96e2d057589fdefault-COUNT_VECTORIZER-cbdccd55-5dee-413e-9180-57e18005dd7edefault" }, { - "source": "COUNT_VECTORIZER-cc904776-6e4f-48a4-8f6a-33be7f48900e", + "source": "COUNT_VECTORIZER-cbdccd55-5dee-413e-9180-57e18005dd7e", "sourceHandle": "tokens", - "target": "TABLE-5af7fb76-685e-4970-8de1-67192cdbe6b8", + "target": "TABLE-080bcffe-4b33-4849-b4e8-7a26a826f4ee", "targetHandle": "default", - "id": "reactflow__edge-COUNT_VECTORIZER-cc904776-6e4f-48a4-8f6a-33be7f48900etokens-TABLE-5af7fb76-685e-4970-8de1-67192cdbe6b8default" + "id": "reactflow__edge-COUNT_VECTORIZER-cbdccd55-5dee-413e-9180-57e18005dd7etokens-TABLE-080bcffe-4b33-4849-b4e8-7a26a826f4eedefault" }, { - "source": "COUNT_VECTORIZER-cc904776-6e4f-48a4-8f6a-33be7f48900e", + "source": "COUNT_VECTORIZER-cbdccd55-5dee-413e-9180-57e18005dd7e", "sourceHandle": "word_count_vector", - "target": "TABLE-872d4963-d2da-4147-9b54-0487a4b6d5c2", + "target": "TABLE-0bae26a8-e528-4b2c-839c-5422dcf88a81", "targetHandle": "default", - "id": "reactflow__edge-COUNT_VECTORIZER-cc904776-6e4f-48a4-8f6a-33be7f48900eword_count_vector-TABLE-872d4963-d2da-4147-9b54-0487a4b6d5c2default" + "id": "reactflow__edge-COUNT_VECTORIZER-cbdccd55-5dee-413e-9180-57e18005dd7eword_count_vector-TABLE-0bae26a8-e528-4b2c-839c-5422dcf88a81default" }, { - "source": "READ_CSV-f1fcde08-f265-49e1-8fef-ca10fdd91cb5", + "source": "READ_CSV-c1741573-62fc-4e56-9d67-96e2d057589f", "sourceHandle": "default", - "target": "TABLE-cae87046-5eff-4db4-9cb5-b64e5c02c50b", + "target": "TABLE-30ea1761-9951-4e88-a338-4d9dadfaa109", "targetHandle": "default", - "id": "reactflow__edge-READ_CSV-f1fcde08-f265-49e1-8fef-ca10fdd91cb5default-TABLE-cae87046-5eff-4db4-9cb5-b64e5c02c50bdefault" + "id": "reactflow__edge-READ_CSV-c1741573-62fc-4e56-9d67-96e2d057589fdefault-TABLE-30ea1761-9951-4e88-a338-4d9dadfaa109default" } ], "viewport": { - "x": -277.07893884404893, - "y": 103.38141914149585, - "zoom": 0.8175961276759318 + "x": 502.7009774274077, + "y": 219.59679745587334, + "zoom": 0.8486425101826552 } }, "ctrlsManifest": [ diff --git a/docs/nodes/AI_ML/NLP/COUNT_VECTORIZER/examples/EX1/example.md b/docs/nodes/AI_ML/NLP/COUNT_VECTORIZER/examples/EX1/example.md index 581302fd73..e47787b1ea 100644 --- a/docs/nodes/AI_ML/NLP/COUNT_VECTORIZER/examples/EX1/example.md +++ b/docs/nodes/AI_ML/NLP/COUNT_VECTORIZER/examples/EX1/example.md @@ -1 +1 @@ -In this example, the `READ_CSV` node loads a local file. Then `COUNT_VECTORIZER` node transforms the matrix of text into a matrix of token/word counts, and it returns a `DataFrame` that contains unique words and a `Matrix` that contains token counts for each sentence. \ No newline at end of file +In this example, the `READ_CSV` node loads a local file. Then `COUNT_VECTORIZER` node transforms the received dataframe of text into a matrix of token/word counts, and it returns a `DataFrame` that contains unique words and a `Matrix` that contains token counts for each sentence. \ No newline at end of file diff --git a/docs/nodes/AI_ML/NLP/COUNT_VECTORIZER/examples/EX1/output.jpeg b/docs/nodes/AI_ML/NLP/COUNT_VECTORIZER/examples/EX1/output.jpeg index bd75803b85..97cae9e6a0 100644 Binary files a/docs/nodes/AI_ML/NLP/COUNT_VECTORIZER/examples/EX1/output.jpeg and b/docs/nodes/AI_ML/NLP/COUNT_VECTORIZER/examples/EX1/output.jpeg differ diff --git a/docs/nodes/AI_ML/OBJECT_DETECTION/OBJECT_DETECTION/examples/EX1/app.txt b/docs/nodes/AI_ML/OBJECT_DETECTION/OBJECT_DETECTION/examples/EX1/app.txt index bd4979dc14..3c7c4aa074 100644 --- a/docs/nodes/AI_ML/OBJECT_DETECTION/OBJECT_DETECTION/examples/EX1/app.txt +++ b/docs/nodes/AI_ML/OBJECT_DETECTION/OBJECT_DETECTION/examples/EX1/app.txt @@ -2,22 +2,23 @@ "rfInstance": { "nodes": [ { - "width": 150, - "height": 150, - "id": "LOCAL_FILE-d8f7ea02-349d-4cfc-8834-78cf2ecb41d5", - "type": "LOCAL_FILE_SYSTEM", + "width": 160, + "height": 160, + "id": "LOCAL_FILE-6c5165f8-abe1-4d41-854b-c662b5d2a987", + "type": "LOADERS", "data": { - "id": "LOCAL_FILE-d8f7ea02-349d-4cfc-8834-78cf2ecb41d5", + "id": "LOCAL_FILE-6c5165f8-abe1-4d41-854b-c662b5d2a987", "label": "LOCAL FILE", "func": "LOCAL_FILE", - "type": "LOCAL_FILE_SYSTEM", + "type": "LOADERS", "ctrls": { "file_path": { "type": "str", "default": null, + "desc": "path to the file to be loaded.", "functionName": "LOCAL_FILE", "param": "file_path", - "value": "./PYTHON/nodes/AI_ML/IMAGE_CAPTIONING/NLP_CONNECT_VIT_GPT2/assets/President_Barack_Obama.jpg" + "value": "PYTHON/nodes/AI_ML/SEGMENTATION/DEEPLAB_V3/assets/obama_image.jpg" }, "file_type": { "type": "select", @@ -29,6 +30,7 @@ "Excel", "XML" ], + "desc": "type of file to load, default: image.", "functionName": "LOCAL_FILE", "param": "file_type", "value": "Image" @@ -38,7 +40,8 @@ { "name": "default", "id": "default", - "type": "Image|DataFrame" + "type": "Image|DataFrame", + "desc": null } ], "pip_dependencies": [ @@ -55,204 +58,170 @@ "selected": false }, "position": { - "x": 213.46240247694215, - "y": 100.45399688959793 + "x": 24.809619940370197, + "y": -128.2164625572575 }, "selected": false, "positionAbsolute": { - "x": 213.46240247694215, - "y": 100.45399688959793 + "x": 24.809619940370197, + "y": -128.2164625572575 }, "dragging": true }, { - "width": 210, - "height": 130, - "id": "END-15f81c58-9f96-462f-88d6-7a70a1ee70a2", - "type": "TERMINATORS", - "data": { - "id": "END-15f81c58-9f96-462f-88d6-7a70a1ee70a2", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": true - }, - "position": { - "x": 1657.8400105766152, - "y": 156.98523041948528 - }, - "selected": true, - "positionAbsolute": { - "x": 1657.8400105766152, - "y": 156.98523041948528 - }, - "dragging": true - }, - { - "width": 150, - "height": 150, - "id": "OBJECT_DETECTION-209e41db-c53b-4fad-905f-e30f4b27afea", - "type": "OBJECT_DETECTION", + "width": 225, + "height": 226, + "id": "IMAGE-769c4e27-7d34-45ac-a2b3-b74dbf96dd4f", + "type": "VISUALIZERS", "data": { - "id": "OBJECT_DETECTION-209e41db-c53b-4fad-905f-e30f4b27afea", - "label": "OBJECT DETECTION", - "func": "OBJECT_DETECTION", - "type": "OBJECT_DETECTION", + "id": "IMAGE-769c4e27-7d34-45ac-a2b3-b74dbf96dd4f", + "label": "IMAGE", + "func": "IMAGE", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", "type": "Image", - "multiple": false + "multiple": false, + "desc": null } ], "outputs": [ { "name": "default", "id": "default", - "type": "Image" + "type": "Plotly", + "desc": null } ], - "path": "PYTHON/nodes/AI_ML/OBJECT_DETECTION/OBJECT_DETECTION/OBJECT_DETECTION.py", + "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/IMAGE/IMAGE.py", "selected": false }, "position": { - "x": 726.5837721151518, - "y": 91.89316538153173 + "x": 572.2067448111293, + "y": -166.80421635329245 }, "selected": false, "positionAbsolute": { - "x": 726.5837721151518, - "y": 91.89316538153173 + "x": 572.2067448111293, + "y": -166.80421635329245 }, "dragging": true }, { "width": 225, "height": 226, - "id": "IMAGE-82daa27b-1179-46d8-b02d-c7b0ed5047e9", - "type": "PLOTLY", + "id": "IMAGE-f28f6f34-e3dd-4840-a48e-28efc7b1ae45", + "type": "VISUALIZERS", "data": { - "id": "IMAGE-82daa27b-1179-46d8-b02d-c7b0ed5047e9", - "label": "IMAGE", + "id": "IMAGE-f28f6f34-e3dd-4840-a48e-28efc7b1ae45", + "label": "IMAGE 1", "func": "IMAGE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", "type": "Image", - "multiple": false + "multiple": false, + "desc": null } ], "outputs": [ { "name": "default", "id": "default", - "type": "Plotly" + "type": "Plotly", + "desc": null } ], "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/IMAGE/IMAGE.py", "selected": false }, "position": { - "x": 1142.7402117767501, - "y": 37.78739719802621 + "x": 272.1848200697342, + "y": -363.6544609307003 }, "selected": false, "positionAbsolute": { - "x": 1142.7402117767501, - "y": 37.78739719802621 + "x": 272.1848200697342, + "y": -363.6544609307003 }, "dragging": true }, { - "width": 380, - "height": 293, - "id": "IMAGE-212d43b0-9dfd-4b16-9ed2-573d4ae7c660", - "type": "PLOTLY", + "width": 208, + "height": 96, + "id": "OBJECT_DETECTION-3ce0a6ee-8056-40f6-b99d-19e8358e54f5", + "type": "AI_ML", "data": { - "id": "IMAGE-212d43b0-9dfd-4b16-9ed2-573d4ae7c660", - "label": "IMAGE 1", - "func": "IMAGE", - "type": "PLOTLY", + "id": "OBJECT_DETECTION-3ce0a6ee-8056-40f6-b99d-19e8358e54f5", + "label": "OBJECT DETECTION", + "func": "OBJECT_DETECTION", + "type": "AI_ML", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", "type": "Image", - "multiple": false + "multiple": false, + "desc": null } ], "outputs": [ { "name": "default", "id": "default", - "type": "Plotly" + "type": "Image", + "desc": null } ], - "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/IMAGE/IMAGE.py", + "path": "PYTHON/nodes/AI_ML/OBJECT_DETECTION/OBJECT_DETECTION/OBJECT_DETECTION.py", "selected": false }, "position": { - "x": 741.1457631495206, - "y": -301.3921127763143 + "x": 260.3471692016421, + "y": -89.58575634203677 }, "selected": false, "positionAbsolute": { - "x": 741.1457631495206, - "y": -301.3921127763143 + "x": 260.3471692016421, + "y": -89.58575634203677 }, "dragging": true } ], "edges": [ { - "source": "LOCAL_FILE-d8f7ea02-349d-4cfc-8834-78cf2ecb41d5", - "sourceHandle": "default", - "target": "OBJECT_DETECTION-209e41db-c53b-4fad-905f-e30f4b27afea", - "targetHandle": "default", - "id": "reactflow__edge-LOCAL_FILE-d8f7ea02-349d-4cfc-8834-78cf2ecb41d5default-OBJECT_DETECTION-209e41db-c53b-4fad-905f-e30f4b27afeadefault" - }, - { - "source": "LOCAL_FILE-d8f7ea02-349d-4cfc-8834-78cf2ecb41d5", + "source": "LOCAL_FILE-6c5165f8-abe1-4d41-854b-c662b5d2a987", "sourceHandle": "default", - "target": "IMAGE-212d43b0-9dfd-4b16-9ed2-573d4ae7c660", + "target": "OBJECT_DETECTION-3ce0a6ee-8056-40f6-b99d-19e8358e54f5", "targetHandle": "default", - "id": "reactflow__edge-LOCAL_FILE-d8f7ea02-349d-4cfc-8834-78cf2ecb41d5default-IMAGE-212d43b0-9dfd-4b16-9ed2-573d4ae7c660default" + "id": "reactflow__edge-LOCAL_FILE-6c5165f8-abe1-4d41-854b-c662b5d2a987default-OBJECT_DETECTION-3ce0a6ee-8056-40f6-b99d-19e8358e54f5default" }, { - "source": "OBJECT_DETECTION-209e41db-c53b-4fad-905f-e30f4b27afea", + "source": "OBJECT_DETECTION-3ce0a6ee-8056-40f6-b99d-19e8358e54f5", "sourceHandle": "default", - "target": "IMAGE-82daa27b-1179-46d8-b02d-c7b0ed5047e9", + "target": "IMAGE-769c4e27-7d34-45ac-a2b3-b74dbf96dd4f", "targetHandle": "default", - "id": "reactflow__edge-OBJECT_DETECTION-209e41db-c53b-4fad-905f-e30f4b27afeadefault-IMAGE-82daa27b-1179-46d8-b02d-c7b0ed5047e9default" + "id": "reactflow__edge-OBJECT_DETECTION-3ce0a6ee-8056-40f6-b99d-19e8358e54f5default-IMAGE-769c4e27-7d34-45ac-a2b3-b74dbf96dd4fdefault" }, { - "source": "IMAGE-82daa27b-1179-46d8-b02d-c7b0ed5047e9", + "source": "LOCAL_FILE-6c5165f8-abe1-4d41-854b-c662b5d2a987", "sourceHandle": "default", - "target": "END-15f81c58-9f96-462f-88d6-7a70a1ee70a2", + "target": "IMAGE-f28f6f34-e3dd-4840-a48e-28efc7b1ae45", "targetHandle": "default", - "id": "reactflow__edge-IMAGE-82daa27b-1179-46d8-b02d-c7b0ed5047e9default-END-15f81c58-9f96-462f-88d6-7a70a1ee70a2default" + "id": "reactflow__edge-LOCAL_FILE-6c5165f8-abe1-4d41-854b-c662b5d2a987default-IMAGE-f28f6f34-e3dd-4840-a48e-28efc7b1ae45default" } ], "viewport": { - "x": -501.95459935516146, - "y": 148.3622262035364, - "zoom": 1.4811524052100216 + "x": 606.4472645567363, + "y": 234.63130388602087, + "zoom": 0.9186369849831518 } }, "ctrlsManifest": [ diff --git a/docs/nodes/AI_ML/OBJECT_DETECTION/OBJECT_DETECTION/examples/EX1/output.jpeg b/docs/nodes/AI_ML/OBJECT_DETECTION/OBJECT_DETECTION/examples/EX1/output.jpeg index 75bd4ace80..5f19287eec 100644 Binary files a/docs/nodes/AI_ML/OBJECT_DETECTION/OBJECT_DETECTION/examples/EX1/output.jpeg and b/docs/nodes/AI_ML/OBJECT_DETECTION/OBJECT_DETECTION/examples/EX1/output.jpeg differ diff --git a/docs/nodes/AI_ML/OPENAI/DALLE_IMAGE_GENERATOR/DALLE_IMAGE_GENERATOR.md b/docs/nodes/AI_ML/OPENAI/DALLE_IMAGE_GENERATOR/DALLE_IMAGE_GENERATOR.md new file mode 100644 index 0000000000..bc2d94ec6f --- /dev/null +++ b/docs/nodes/AI_ML/OPENAI/DALLE_IMAGE_GENERATOR/DALLE_IMAGE_GENERATOR.md @@ -0,0 +1,57 @@ + +[//]: # (Custom component imports) + +import DocString from '@site/src/components/DocString'; +import PythonCode from '@site/src/components/PythonCode'; +import AppDisplay from '@site/src/components/AppDisplay'; +import SectionBreak from '@site/src/components/SectionBreak'; +import AppendixSection from '@site/src/components/AppendixSection'; + +[//]: # (Docstring) + +import DocstringSource from '!!raw-loader!./a1-[autogen]/docstring.txt'; +import PythonSource from '!!raw-loader!./a1-[autogen]/python_code.txt'; + +{DocstringSource} +{PythonSource} + + + + + +[//]: # (Examples) + +## Examples + +import Example1 from './examples/EX1/example.md'; +import App1 from '!!raw-loader!./examples/EX1/app.txt'; + + + + + {App1} + + + + + + + + +[//]: # (Appendix) + +import Notes from '!!raw-loader!./appendix/notes.md'; +import Hardware from '!!raw-loader!./appendix/hardware.md'; +import Media from '!!raw-loader!./appendix/media.md'; + +## Appendix + +{Notes} +{Hardware} +{Media} + + diff --git a/docs/nodes/AI_ML/OPENAI/DALLE_IMAGE_GENERATOR/a1-[autogen]/docstring.txt b/docs/nodes/AI_ML/OPENAI/DALLE_IMAGE_GENERATOR/a1-[autogen]/docstring.txt new file mode 100644 index 0000000000..c00f058fdb --- /dev/null +++ b/docs/nodes/AI_ML/OPENAI/DALLE_IMAGE_GENERATOR/a1-[autogen]/docstring.txt @@ -0,0 +1,14 @@ + +The DALLE_IMAGE_GENERATOR node takes a prompt and generates an image +using OpenAI's DALL-E model. +The prompt should be a sentence describing the image you want to generate. +The image will be returned as a DataContainer with the type 'image'. + +Parameters +---------- +prompt: string + A sentence describing the image you want to generate. +width: int + The width of the generated image. +height: int + The height of the generated image. diff --git a/docs/nodes/AI_ML/OPENAI/DALLE_IMAGE_GENERATOR/a1-[autogen]/python_code.txt b/docs/nodes/AI_ML/OPENAI/DALLE_IMAGE_GENERATOR/a1-[autogen]/python_code.txt new file mode 100644 index 0000000000..ef581246d4 --- /dev/null +++ b/docs/nodes/AI_ML/OPENAI/DALLE_IMAGE_GENERATOR/a1-[autogen]/python_code.txt @@ -0,0 +1,66 @@ +import numpy as np +from flojoy import flojoy, Image, run_in_venv +import base64 +from io import BytesIO +import os +import time + +API_RETRY_ATTEMPTS = 5 +API_RETRY_INTERVAL_IN_SECONDS = 1 + + +@flojoy +@run_in_venv(pip_dependencies=["openai==0.27.8", "Pillow==10.0.0", "requests==2.28.1"]) +def DALLE_IMAGE_GENERATOR( + prompt: str, + width: int = 1024, + height: int = 1024, +) -> Image: + + import openai + from PIL import Image as PilImage + + api_key = os.environ.get("OPENAI_API_KEY") + if not api_key: + raise Exception("OPENAI_API_KEY environment variable not set") + + openai.api_key = api_key + + for i in range(API_RETRY_ATTEMPTS): + try: + result = openai.Image.create( + prompt=prompt, n=1, size=f"{width}x{height}", response_format="b64_json" + ) + print(f"No error in attempt {i} of generating image") + break + except openai.error.RateLimitError: + if i > API_RETRY_ATTEMPTS: + raise Exception("Rate limit error. Max retries exceeded.") + + print( + f"Rate limit error, retrying in {API_RETRY_INTERVAL_IN_SECONDS} seconds" + ) + time.sleep(API_RETRY_INTERVAL_IN_SECONDS) + + if not result.data: + raise Exception("No image data in result") + + base64_content = result.get("data")[0].get("b64_json") + image_data = base64.b64decode(base64_content) + img = PilImage.open(BytesIO(image_data)) + + img_array = np.asarray(img) + red_channel = img_array[:, :, 0] + green_channel = img_array[:, :, 1] + blue_channel = img_array[:, :, 2] + + alpha_channel = None + if img_array.shape[2] == 4: + alpha_channel = img_array[:, :, 3] + + return Image( + r=red_channel, + g=green_channel, + b=blue_channel, + a=alpha_channel, + ) diff --git a/docs/nodes/AI_ML/OPENAI/DALLE_IMAGE_GENERATOR/appendix/hardware.md b/docs/nodes/AI_ML/OPENAI/DALLE_IMAGE_GENERATOR/appendix/hardware.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/nodes/AI_ML/OPENAI/DALLE_IMAGE_GENERATOR/appendix/media.md b/docs/nodes/AI_ML/OPENAI/DALLE_IMAGE_GENERATOR/appendix/media.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/nodes/AI_ML/OPENAI/DALLE_IMAGE_GENERATOR/appendix/notes.md b/docs/nodes/AI_ML/OPENAI/DALLE_IMAGE_GENERATOR/appendix/notes.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/nodes/AI_ML/OPENAI/DALLE_IMAGE_GENERATOR/examples/EX1/app.txt b/docs/nodes/AI_ML/OPENAI/DALLE_IMAGE_GENERATOR/examples/EX1/app.txt new file mode 100644 index 0000000000..d629abb7fa --- /dev/null +++ b/docs/nodes/AI_ML/OPENAI/DALLE_IMAGE_GENERATOR/examples/EX1/app.txt @@ -0,0 +1,139 @@ +{ + "rfInstance": { + "nodes": [ + { + "width": 208, + "height": 96, + "id": "DALLE_IMAGE_GENERATOR-73998810-4081-4630-adf6-8097b610118b", + "type": "AI_ML", + "data": { + "id": "DALLE_IMAGE_GENERATOR-73998810-4081-4630-adf6-8097b610118b", + "label": "DALLE IMAGE GENERATOR", + "func": "DALLE_IMAGE_GENERATOR", + "type": "AI_ML", + "ctrls": { + "prompt": { + "type": "str", + "default": null, + "desc": "A sentence describing the image you want to generate.", + "functionName": "DALLE_IMAGE_GENERATOR", + "param": "prompt", + "value": "A painting of a cat" + }, + "width": { + "type": "int", + "default": 1024, + "desc": "The width of the generated image.", + "functionName": "DALLE_IMAGE_GENERATOR", + "param": "width", + "value": 1024 + }, + "height": { + "type": "int", + "default": 1024, + "desc": "The height of the generated image.", + "functionName": "DALLE_IMAGE_GENERATOR", + "param": "height", + "value": 1024 + } + }, + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Image", + "desc": null + } + ], + "path": "PYTHON/nodes/AI_ML/OPENAI/DALLE_IMAGE_GENERATOR/DALLE_IMAGE_GENERATOR.py", + "selected": false + }, + "position": { + "x": -155.761959015441, + "y": 338.9736881910637 + }, + "selected": false, + "positionAbsolute": { + "x": -155.761959015441, + "y": 338.9736881910637 + }, + "dragging": true + }, + { + "width": 225, + "height": 226, + "id": "IMAGE-6886e358-8587-4e15-9486-910e911e79b5", + "type": "VISUALIZERS", + "data": { + "id": "IMAGE-6886e358-8587-4e15-9486-910e911e79b5", + "label": "IMAGE", + "func": "IMAGE", + "type": "VISUALIZERS", + "ctrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Image", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": null + } + ], + "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/IMAGE/IMAGE.py", + "selected": false + }, + "position": { + "x": 455.6504364167843, + "y": 307.93171338391926 + }, + "selected": false, + "positionAbsolute": { + "x": 455.6504364167843, + "y": 307.93171338391926 + }, + "dragging": true + } + ], + "edges": [ + { + "source": "DALLE_IMAGE_GENERATOR-73998810-4081-4630-adf6-8097b610118b", + "sourceHandle": "default", + "target": "IMAGE-6886e358-8587-4e15-9486-910e911e79b5", + "targetHandle": "default", + "id": "reactflow__edge-DALLE_IMAGE_GENERATOR-73998810-4081-4630-adf6-8097b610118bdefault-IMAGE-6886e358-8587-4e15-9486-910e911e79b5default" + } + ], + "viewport": { + "x": 716.6989575195756, + "y": 316.2258438592044, + "zoom": 1.2380988852096646 + } + }, + "ctrlsManifest": [ + { + "type": "input", + "name": "Slider", + "id": "INPUT_PLACEHOLDER", + "hidden": false, + "minHeight": 1, + "minWidth": 2, + "layout": { + "x": 0, + "y": 0, + "h": 2, + "w": 2, + "minH": 1, + "minW": 2, + "i": "INPUT_PLACEHOLDER" + } + } + ] +} \ No newline at end of file diff --git a/docs/nodes/AI_ML/OPENAI/DALLE_IMAGE_GENERATOR/examples/EX1/example.md b/docs/nodes/AI_ML/OPENAI/DALLE_IMAGE_GENERATOR/examples/EX1/example.md new file mode 100644 index 0000000000..a4d00f0f98 --- /dev/null +++ b/docs/nodes/AI_ML/OPENAI/DALLE_IMAGE_GENERATOR/examples/EX1/example.md @@ -0,0 +1,6 @@ +This app uses the DALL-E node to generate images from text. +Based on the users input, the node will generate an image and pass it to the next node. +The input text is defined in the node's form, for this app we are using the following text: +``` +A cute baby sea otter +``` \ No newline at end of file diff --git a/docs/nodes/AI_ML/OPENAI/JSON_EXTRACTOR/JSON_EXTRACTOR.md b/docs/nodes/AI_ML/OPENAI/JSON_EXTRACTOR/JSON_EXTRACTOR.md new file mode 100644 index 0000000000..1c84a45bea --- /dev/null +++ b/docs/nodes/AI_ML/OPENAI/JSON_EXTRACTOR/JSON_EXTRACTOR.md @@ -0,0 +1,57 @@ + +[//]: # (Custom component imports) + +import DocString from '@site/src/components/DocString'; +import PythonCode from '@site/src/components/PythonCode'; +import AppDisplay from '@site/src/components/AppDisplay'; +import SectionBreak from '@site/src/components/SectionBreak'; +import AppendixSection from '@site/src/components/AppendixSection'; + +[//]: # (Docstring) + +import DocstringSource from '!!raw-loader!./a1-[autogen]/docstring.txt'; +import PythonSource from '!!raw-loader!./a1-[autogen]/python_code.txt'; + +{DocstringSource} +{PythonSource} + + + + + +[//]: # (Examples) + +## Examples + +import Example1 from './examples/EX1/example.md'; +import App1 from '!!raw-loader!./examples/EX1/app.txt'; + + + + + {App1} + + + + + + + + +[//]: # (Appendix) + +import Notes from '!!raw-loader!./appendix/notes.md'; +import Hardware from '!!raw-loader!./appendix/hardware.md'; +import Media from '!!raw-loader!./appendix/media.md'; + +## Appendix + +{Notes} +{Hardware} +{Media} + + diff --git a/docs/nodes/AI_ML/OPENAI/JSON_EXTRACTOR/a1-[autogen]/docstring.txt b/docs/nodes/AI_ML/OPENAI/JSON_EXTRACTOR/a1-[autogen]/docstring.txt new file mode 100644 index 0000000000..4e60c232de --- /dev/null +++ b/docs/nodes/AI_ML/OPENAI/JSON_EXTRACTOR/a1-[autogen]/docstring.txt @@ -0,0 +1,9 @@ + +The JSON_EXTRACTOR node extract specific properties information from a text using JSON schema. + +Parameters +---------- +properties: string + Comma separated list of properties to extract. Example: "name,age,location" +prompt: string + Text to extract information from. Example: "I'm John, I am 30 years old and I live in New York." diff --git a/docs/nodes/AI_ML/OPENAI/JSON_EXTRACTOR/a1-[autogen]/python_code.txt b/docs/nodes/AI_ML/OPENAI/JSON_EXTRACTOR/a1-[autogen]/python_code.txt new file mode 100644 index 0000000000..b259a7056c --- /dev/null +++ b/docs/nodes/AI_ML/OPENAI/JSON_EXTRACTOR/a1-[autogen]/python_code.txt @@ -0,0 +1,73 @@ +from flojoy import flojoy, DataFrame as FlojoyDataFrame, run_in_venv +import os +import json +from copy import deepcopy +import time + + +ACCEPTED_SCHEMA_FORMATS = [".json"] + +BASE_SCHEMA = { + "name": "information_extraction", + "description": "Extracts the information as JSON.", + "parameters": {"type": "object", "properties": {}, "required": []}, +} + +API_RETRY_ATTEMPTS = 5 +API_RETRY_INTERVAL_IN_SECONDS = 1 + + +@flojoy +@run_in_venv(pip_dependencies=["openai==0.27.8", "pandas==2.0.2"]) +def JSON_EXTRACTOR( + properties: list[str], + prompt: str, +) -> FlojoyDataFrame: + + import openai + import pandas as pd + + api_key = os.environ.get("OPENAI_API_KEY") + if not api_key: + raise Exception("OPENAI_API_KEY environment variable not set") + openai.api_key = api_key + + if not properties: + raise Exception("No properties found to extract.") + + schema = deepcopy(BASE_SCHEMA) + for property in properties: + schema["parameters"]["properties"][property] = { + "title": property, + "type": "string", + } + schema["parameters"]["required"].append(property) + + for i in range(API_RETRY_ATTEMPTS): + try: + response = openai.ChatCompletion.create( + model="gpt-3.5-turbo-0613", + messages=[ + {"role": "user", "content": prompt}, + ], + temperature=0, + functions=[schema], + function_call={"name": schema["name"]}, + ) + print(f"No error in attempt {i} of extraction.") + break + except openai.error.RateLimitError: + if i > API_RETRY_ATTEMPTS: + raise Exception("Rate limit error. Max retries exceeded.") + + print( + f"Rate limit error, retrying in {API_RETRY_INTERVAL_IN_SECONDS} seconds" + ) + time.sleep(API_RETRY_INTERVAL_IN_SECONDS) + + if not response.choices: + raise Exception("No extraction choices found in response.") + + data = json.loads(response.choices[0].message.function_call.arguments) + df = pd.DataFrame(data=[data]) + return FlojoyDataFrame(df=df) diff --git a/docs/nodes/AI_ML/OPENAI/JSON_EXTRACTOR/appendix/hardware.md b/docs/nodes/AI_ML/OPENAI/JSON_EXTRACTOR/appendix/hardware.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/nodes/AI_ML/OPENAI/JSON_EXTRACTOR/appendix/media.md b/docs/nodes/AI_ML/OPENAI/JSON_EXTRACTOR/appendix/media.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/nodes/AI_ML/OPENAI/JSON_EXTRACTOR/appendix/notes.md b/docs/nodes/AI_ML/OPENAI/JSON_EXTRACTOR/appendix/notes.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/nodes/AI_ML/OPENAI/JSON_EXTRACTOR/examples/EX1/app.txt b/docs/nodes/AI_ML/OPENAI/JSON_EXTRACTOR/examples/EX1/app.txt new file mode 100644 index 0000000000..74fab8e362 --- /dev/null +++ b/docs/nodes/AI_ML/OPENAI/JSON_EXTRACTOR/examples/EX1/app.txt @@ -0,0 +1,131 @@ +{ + "rfInstance": { + "nodes": [ + { + "width": 208, + "height": 96, + "id": "JSON_EXTRACTOR-00c4327c-3b49-42fe-a168-e90af66ca306", + "type": "AI_ML", + "data": { + "id": "JSON_EXTRACTOR-00c4327c-3b49-42fe-a168-e90af66ca306", + "label": "JSON EXTRACTOR", + "func": "JSON_EXTRACTOR", + "type": "AI_ML", + "ctrls": { + "properties": { + "type": "list[str]", + "default": null, + "desc": "Comma separated list of properties to extract. Example: \"name,age,location\"", + "functionName": "JSON_EXTRACTOR", + "param": "properties", + "value": "price,name" + }, + "prompt": { + "type": "str", + "default": null, + "desc": "Text to extract information from. Example: \"I'm John, I am 30 years old and I live in New York.\"", + "functionName": "JSON_EXTRACTOR", + "param": "prompt", + "value": "Headset Gamer Bluetooth MJ23 - $100 Extract the price, name and model from the above text." + } + }, + "outputs": [ + { + "name": "default", + "id": "default", + "type": "DataFrame", + "desc": null + } + ], + "path": "PYTHON/nodes/AI_ML/OPENAI/JSON_EXTRACTOR/JSON_EXTRACTOR.py", + "selected": false + }, + "position": { + "x": -316.44081536568854, + "y": 186.94318548140365 + }, + "selected": false, + "positionAbsolute": { + "x": -316.44081536568854, + "y": 186.94318548140365 + }, + "dragging": true + }, + { + "width": 380, + "height": 293, + "id": "TABLE-b8b4054c-03ee-4e54-8cea-484de0f28f0d", + "type": "VISUALIZERS", + "data": { + "id": "TABLE-b8b4054c-03ee-4e54-8cea-484de0f28f0d", + "label": "TABLE", + "func": "TABLE", + "type": "VISUALIZERS", + "ctrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedTriple|OrderedPair|DataFrame|Matrix|Vector", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": null + } + ], + "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/TABLE/TABLE.py", + "selected": false + }, + "position": { + "x": 296.61168239817283, + "y": 154.25519617853098 + }, + "selected": false, + "positionAbsolute": { + "x": 296.61168239817283, + "y": 154.25519617853098 + }, + "dragging": false + } + ], + "edges": [ + { + "source": "JSON_EXTRACTOR-00c4327c-3b49-42fe-a168-e90af66ca306", + "sourceHandle": "default", + "target": "TABLE-b8b4054c-03ee-4e54-8cea-484de0f28f0d", + "targetHandle": "default", + "id": "reactflow__edge-JSON_EXTRACTOR-00c4327c-3b49-42fe-a168-e90af66ca306default-TABLE-b8b4054c-03ee-4e54-8cea-484de0f28f0ddefault" + } + ], + "viewport": { + "x": 716.6989575195756, + "y": 316.2258438592044, + "zoom": 1.2380988852096646 + } + }, + "ctrlsManifest": [ + { + "type": "input", + "name": "Slider", + "id": "INPUT_PLACEHOLDER", + "hidden": false, + "minHeight": 1, + "minWidth": 2, + "layout": { + "x": 0, + "y": 0, + "h": 2, + "w": 2, + "minH": 1, + "minW": 2, + "i": "INPUT_PLACEHOLDER" + } + } + ] +} \ No newline at end of file diff --git a/docs/nodes/AI_ML/OPENAI/JSON_EXTRACTOR/examples/EX1/example.md b/docs/nodes/AI_ML/OPENAI/JSON_EXTRACTOR/examples/EX1/example.md new file mode 100644 index 0000000000..504d672ed1 --- /dev/null +++ b/docs/nodes/AI_ML/OPENAI/JSON_EXTRACTOR/examples/EX1/example.md @@ -0,0 +1,4 @@ +This example app uses the JSON_EXTRACTOR node for extracting estructured data (as JSON) from unstructured text. +In this example we are trying to extract 2 properties (price and name) from the following text: +**Headset Gamer Bluetooth MJ23 - $100** +The properties and text are defined in the node's form. \ No newline at end of file diff --git a/docs/nodes/AI_ML/OPENAI/WHISPER_SPEECH_TO_TEXT/WHISPER_SPEECH_TO_TEXT.md b/docs/nodes/AI_ML/OPENAI/WHISPER_SPEECH_TO_TEXT/WHISPER_SPEECH_TO_TEXT.md new file mode 100644 index 0000000000..e692e7fe4f --- /dev/null +++ b/docs/nodes/AI_ML/OPENAI/WHISPER_SPEECH_TO_TEXT/WHISPER_SPEECH_TO_TEXT.md @@ -0,0 +1,57 @@ + +[//]: # (Custom component imports) + +import DocString from '@site/src/components/DocString'; +import PythonCode from '@site/src/components/PythonCode'; +import AppDisplay from '@site/src/components/AppDisplay'; +import SectionBreak from '@site/src/components/SectionBreak'; +import AppendixSection from '@site/src/components/AppendixSection'; + +[//]: # (Docstring) + +import DocstringSource from '!!raw-loader!./a1-[autogen]/docstring.txt'; +import PythonSource from '!!raw-loader!./a1-[autogen]/python_code.txt'; + +{DocstringSource} +{PythonSource} + + + + + +[//]: # (Examples) + +## Examples + +import Example1 from './examples/EX1/example.md'; +import App1 from '!!raw-loader!./examples/EX1/app.txt'; + + + + + {App1} + + + + + + + + +[//]: # (Appendix) + +import Notes from '!!raw-loader!./appendix/notes.md'; +import Hardware from '!!raw-loader!./appendix/hardware.md'; +import Media from '!!raw-loader!./appendix/media.md'; + +## Appendix + +{Notes} +{Hardware} +{Media} + + diff --git a/docs/nodes/AI_ML/OPENAI/WHISPER_SPEECH_TO_TEXT/a1-[autogen]/docstring.txt b/docs/nodes/AI_ML/OPENAI/WHISPER_SPEECH_TO_TEXT/a1-[autogen]/docstring.txt new file mode 100644 index 0000000000..e7c4baae33 --- /dev/null +++ b/docs/nodes/AI_ML/OPENAI/WHISPER_SPEECH_TO_TEXT/a1-[autogen]/docstring.txt @@ -0,0 +1,7 @@ + +the node WHISPER_SPEECH_TO_TEXT uses OpenAI whisper transcription model to convert audio to text. The audio can be provided as a file path or as bytes from a previous node. The previous node value has priority over the file path. + +Parameters: +----------- +file_path: string + Path to the audio file to be transcribed. Only mp3 format is supported. diff --git a/docs/nodes/AI_ML/OPENAI/WHISPER_SPEECH_TO_TEXT/a1-[autogen]/python_code.txt b/docs/nodes/AI_ML/OPENAI/WHISPER_SPEECH_TO_TEXT/a1-[autogen]/python_code.txt new file mode 100644 index 0000000000..c874af5d02 --- /dev/null +++ b/docs/nodes/AI_ML/OPENAI/WHISPER_SPEECH_TO_TEXT/a1-[autogen]/python_code.txt @@ -0,0 +1,68 @@ +from flojoy import flojoy, Bytes, run_in_venv, TextBlob +from typing import Optional +import os +from pathlib import Path +import time +from tempfile import NamedTemporaryFile + + +ACCEPTED_AUDIO_FORMATS = ["mp3", "wav"] +API_RETRY_ATTEMPTS = 5 +API_RETRY_INTERVAL_IN_SECONDS = 1 + + +@flojoy +@run_in_venv(pip_dependencies=["openai==0.27.8", "pandas==2.0.2"]) +def WHISPER_SPEECH_TO_TEXT( + default: Optional[Bytes] = None, file_path: Optional[str] = None +) -> TextBlob: + + import openai + import pandas as pd + + api_key = os.environ.get("OPENAI_API_KEY") + if not api_key: + raise Exception("OPENAI_API_KEY environment variable not set") + + openai.api_key = api_key + model = "whisper-1" + f = None + if default and isinstance(getattr(default, "b"), bytes): + f = NamedTemporaryFile(suffix=".mp3") + f.write(default.bytes) + f.seek(0) + file_path = f.name + + elif file_path is None: + raise ValueError("file_path parameter is missing!") + + file_format = file_path.split(".")[-1] + if file_format not in ACCEPTED_AUDIO_FORMATS: + raise ValueError( + f"file format {file_format} is not supported. Supported formats are {ACCEPTED_AUDIO_FORMATS}" + ) + + file_path = Path(file_path) + if not file_path.exists(): + raise ValueError(f"file {file_path} does not exist!") + + with open(file_path, "rb") as f: + for i in range(API_RETRY_ATTEMPTS): + try: + transcript = openai.Audio.translate(model, f) + print(f"No error in attempt {i} of transcription") + break + except openai.error.RateLimitError: + if i > API_RETRY_ATTEMPTS: + raise Exception("Rate limit error. Max retries exceeded.") + + print( + f"Rate limit error, retrying in {API_RETRY_INTERVAL_IN_SECONDS} seconds" + ) + time.sleep(API_RETRY_INTERVAL_IN_SECONDS) + + if f is not None: + f.close() + + transcript_text = transcript.get("text") + return TextBlob(text_blob=transcript_text) diff --git a/docs/nodes/AI_ML/OPENAI/WHISPER_SPEECH_TO_TEXT/appendix/hardware.md b/docs/nodes/AI_ML/OPENAI/WHISPER_SPEECH_TO_TEXT/appendix/hardware.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/nodes/AI_ML/OPENAI/WHISPER_SPEECH_TO_TEXT/appendix/media.md b/docs/nodes/AI_ML/OPENAI/WHISPER_SPEECH_TO_TEXT/appendix/media.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/nodes/AI_ML/OPENAI/WHISPER_SPEECH_TO_TEXT/appendix/notes.md b/docs/nodes/AI_ML/OPENAI/WHISPER_SPEECH_TO_TEXT/appendix/notes.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/nodes/AI_ML/OPENAI/WHISPER_SPEECH_TO_TEXT/examples/EX1/app.txt b/docs/nodes/AI_ML/OPENAI/WHISPER_SPEECH_TO_TEXT/examples/EX1/app.txt new file mode 100644 index 0000000000..0b7b2df0f3 --- /dev/null +++ b/docs/nodes/AI_ML/OPENAI/WHISPER_SPEECH_TO_TEXT/examples/EX1/app.txt @@ -0,0 +1,124 @@ +{ + "rfInstance": { + "nodes": [ + { + "width": 208, + "height": 96, + "id": "WHISPER_SPEECH_TO_TEXT-e2b2fe60-8406-4531-8f50-8e1168a3fa8e", + "type": "AI_ML", + "data": { + "id": "WHISPER_SPEECH_TO_TEXT-e2b2fe60-8406-4531-8f50-8e1168a3fa8e", + "label": "WHISPER SPEECH TO TEXT", + "func": "WHISPER_SPEECH_TO_TEXT", + "type": "AI_ML", + "ctrls": { + "file_path": { + "type": "str", + "default": null, + "desc": null, + "functionName": "WHISPER_SPEECH_TO_TEXT", + "param": "file_path", + "value": "" + } + }, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Bytes", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "TextBlob", + "desc": null + } + ], + "path": "PYTHON/nodes/AI_ML/OPENAI/WHISPER_SPEECH_TO_TEXT/WHISPER_SPEECH_TO_TEXT.py", + "selected": false + }, + "position": { + "x": -63.88174782719637, + "y": -11.724629890439985 + }, + "selected": false, + "positionAbsolute": { + "x": -63.88174782719637, + "y": -11.724629890439985 + }, + "dragging": true + }, + { + "width": 384, + "height": 288, + "id": "TEXT_VIEW-2ac256b5-133f-4748-bb78-20ccbf68d8e7", + "type": "VISUALIZERS", + "data": { + "id": "TEXT_VIEW-2ac256b5-133f-4748-bb78-20ccbf68d8e7", + "label": "TEXT VIEW", + "func": "TEXT_VIEW", + "type": "VISUALIZERS", + "ctrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "TextBlob", + "multiple": false, + "desc": null + } + ], + "path": "PYTHON/nodes/VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/TEXT_VIEW.py", + "selected": false + }, + "position": { + "x": 367.7165338335171, + "y": -110.92191345173526 + }, + "selected": false, + "positionAbsolute": { + "x": 367.7165338335171, + "y": -110.92191345173526 + }, + "dragging": true + } + ], + "edges": [ + { + "source": "WHISPER_SPEECH_TO_TEXT-e2b2fe60-8406-4531-8f50-8e1168a3fa8e", + "sourceHandle": "default", + "target": "TEXT_VIEW-2ac256b5-133f-4748-bb78-20ccbf68d8e7", + "targetHandle": "default", + "id": "reactflow__edge-WHISPER_SPEECH_TO_TEXT-e2b2fe60-8406-4531-8f50-8e1168a3fa8edefault-TEXT_VIEW-2ac256b5-133f-4748-bb78-20ccbf68d8e7default" + } + ], + "viewport": { + "x": 716.6989575195756, + "y": 316.2258438592044, + "zoom": 1.2380988852096646 + } + }, + "ctrlsManifest": [ + { + "type": "input", + "name": "Slider", + "id": "INPUT_PLACEHOLDER", + "hidden": false, + "minHeight": 1, + "minWidth": 2, + "layout": { + "x": 0, + "y": 0, + "h": 2, + "w": 2, + "minH": 1, + "minW": 2, + "i": "INPUT_PLACEHOLDER" + } + } + ] +} \ No newline at end of file diff --git a/docs/nodes/AI_ML/OPENAI/WHISPER_SPEECH_TO_TEXT/examples/EX1/example.md b/docs/nodes/AI_ML/OPENAI/WHISPER_SPEECH_TO_TEXT/examples/EX1/example.md new file mode 100644 index 0000000000..08e784da89 --- /dev/null +++ b/docs/nodes/AI_ML/OPENAI/WHISPER_SPEECH_TO_TEXT/examples/EX1/example.md @@ -0,0 +1,2 @@ +This app runs a speech to text task using OpenAI API and local mp3 file. +The local file is loaded and the content is sent to OpenAI API for processing using the Whisper model. \ No newline at end of file diff --git a/docs/nodes/AI_ML/PREDICT_TIME_SERIES/PROPHET_PREDICT/a1-[autogen]/python_code.txt b/docs/nodes/AI_ML/PREDICT_TIME_SERIES/PROPHET_PREDICT/a1-[autogen]/python_code.txt index 8676291b56..460406c3c3 100644 --- a/docs/nodes/AI_ML/PREDICT_TIME_SERIES/PROPHET_PREDICT/a1-[autogen]/python_code.txt +++ b/docs/nodes/AI_ML/PREDICT_TIME_SERIES/PROPHET_PREDICT/a1-[autogen]/python_code.txt @@ -1,8 +1,5 @@ -import pandas as pd -from flojoy import flojoy, DataFrame, DataContainer -from prophet import Prophet +from flojoy import flojoy, run_in_venv, DataFrame, DataContainer from typing import TypedDict -from prophet.serialize import model_to_json class ProphetPredictOutput(TypedDict): @@ -11,11 +8,70 @@ class ProphetPredictOutput(TypedDict): @flojoy(deps={"prophet": "1.1.4", "holidays": "0.26", "pystan": "2.19.1.1"}) +@run_in_venv( + pip_dependencies=[ + "prophet==1.1.4", + ] +) def PROPHET_PREDICT( default: DataFrame, run_forecast: bool = True, periods: int = 365 ) -> ProphetPredictOutput: + import os + import sys + import pandas as pd + import numpy as np + + import prophet + from prophet.serialize import model_to_json + + def _make_dummy_dataframe_for_prophet(): + Generate random time series data to test if prophet works + start_date = pd.Timestamp("2023-01-01") + end_date = pd.Timestamp("2023-07-20") + num_days = (end_date - start_date).days + 1 + timestamps = pd.date_range(start=start_date, end=end_date, freq="D") + data = np.random.randn(num_days) # Random data points + df = pd.DataFrame({"ds": timestamps, "ys": data}) + df.rename( + columns={df.columns[0]: "ds", df.columns[1]: "y"}, inplace=True + ) # PROPHET model expects first column to be `ds` and second to be `y` + return df + + def _apply_macos_prophet_hotfix(): + This is a hotfix for MacOS. See https://github.com/facebook/prophet/issues/2250#issuecomment-1559516328 for more detail + + if not sys.platform == "darwin": + return + + # Test if prophet works (i.e. if the hotfix had already been applied) + try: + _dummy_df = _make_dummy_dataframe_for_prophet() + prophet.Prophet().fit(_dummy_df) + except RuntimeError as e: + print(f"Could not run prophet, applying hotfix...") + else: + return + + prophet_dir = prophet.__path__[0] # type: ignore + # Get stan dir + stan_dir = os.path.join(prophet_dir, "stan_model") + # Find cmdstan-xxxxx dir + cmdstan_basename = [x for x in os.listdir(stan_dir) if x.startswith("cmdstan")] + assert len(cmdstan_basename) == 1, "Could not find cmdstan dir" + cmdstan_basename = cmdstan_basename[0] + # Run (from stan_dir) : install_name_tool -add_rpath @executable_path//stan/lib/stan_math/lib/tbb prophet_model.bin + cmd = f"install_name_tool -add_rpath @executable_path/{cmdstan_basename}/stan/lib/stan_math/lib/tbb prophet_model.bin" + cwd = os.getcwd() + os.chdir(stan_dir) + return_code = os.system(cmd) + os.chdir(cwd) + if return_code != 0: + raise RuntimeError("Could not apply hotfix") + + _apply_macos_prophet_hotfix() + df = default.m first_col = df.iloc[:, 0] if not pd.api.types.is_datetime64_any_dtype(first_col): @@ -25,7 +81,7 @@ def PROPHET_PREDICT( df.rename( columns={df.columns[0]: "ds", df.columns[1]: "y"}, inplace=True ) # PROPHET model expects first column to be `ds` and second to be `y` - model = Prophet() + model = prophet.Prophet() model.fit(df) extra = {"prophet": model_to_json(model), "run_forecast": run_forecast} # If run_forecast, the return df is the forecast, otherwise the original diff --git a/docs/nodes/AI_ML/PREDICT_TIME_SERIES/PROPHET_PREDICT/examples/EX1/app.txt b/docs/nodes/AI_ML/PREDICT_TIME_SERIES/PROPHET_PREDICT/examples/EX1/app.txt index 6b9c98e88e..3445a61a43 100644 --- a/docs/nodes/AI_ML/PREDICT_TIME_SERIES/PROPHET_PREDICT/examples/EX1/app.txt +++ b/docs/nodes/AI_ML/PREDICT_TIME_SERIES/PROPHET_PREDICT/examples/EX1/app.txt @@ -3,12 +3,12 @@ "nodes": [ { "id": "PROPHET_PREDICT-f91b407d-a959-4080-8f4f-9ccb8aaf62af", - "type": "PREDICT_TIME_SERIES", + "type": "AI_ML", "data": { "id": "PROPHET_PREDICT-f91b407d-a959-4080-8f4f-9ccb8aaf62af", "label": "PROPHET PREDICT", "func": "PROPHET_PREDICT", - "type": "PREDICT_TIME_SERIES", + "type": "AI_ML", "ctrls": { "run_forecast": { "type": "bool", @@ -40,25 +40,27 @@ "type": "DataFrame" } ], - "path": "PYTHON/nodes/AI_ML/PREDICT_TIME_SERIES/PROPHET_PREDICT/PROPHET_PREDICT.py" + "path": "PYTHON/nodes/AI_ML/PREDICT_TIME_SERIES/PROPHET_PREDICT/PROPHET_PREDICT.py", + "selected": false }, "position": { "x": 44.19991981803559, "y": 49.45240668102545 }, "width": 150, - "height": 150 + "height": 150, + "selected": false }, { "width": 130, "height": 130, "id": "TIMESERIES-9938e1c3-e758-46d4-af6e-0a764e77dfd2", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "TIMESERIES-9938e1c3-e758-46d4-af6e-0a764e77dfd2", "label": "TIMESERIES", "func": "TIMESERIES", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "start_date": { "type": "str", @@ -100,12 +102,12 @@ "width": 225, "height": 226, "id": "PROPHET_COMPONENTS-38474a31-dfa1-4d2b-8834-558ecadb82e3", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "PROPHET_COMPONENTS-38474a31-dfa1-4d2b-8834-558ecadb82e3", "label": "PROPHET COMPONENTS", "func": "PROPHET_COMPONENTS", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": { "periods": { "type": "int", @@ -148,12 +150,12 @@ "width": 225, "height": 226, "id": "PROPHET_PLOT-94b3e918-2bd3-4b08-9620-0017623eef60", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "PROPHET_PLOT-94b3e918-2bd3-4b08-9620-0017623eef60", "label": "PROPHET PLOT", "func": "PROPHET_PLOT", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": { "periods": { "type": "int", @@ -191,39 +193,6 @@ "y": 269.6217029641205 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-19d116f5-06e8-4a8c-b5ae-59b6db539708", - "type": "TERMINATORS", - "data": { - "id": "END-19d116f5-06e8-4a8c-b5ae-59b6db539708", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 724.5157287422192, - "y": 77.71454473069355 - }, - "selected": false, - "positionAbsolute": { - "x": 724.5157287422192, - "y": 77.71454473069355 - }, - "dragging": true } ], "edges": [ @@ -247,20 +216,6 @@ "target": "PROPHET_PLOT-94b3e918-2bd3-4b08-9620-0017623eef60", "targetHandle": "default", "id": "reactflow__edge-PROPHET_PREDICT-f91b407d-a959-4080-8f4f-9ccb8aaf62afdefault-PROPHET_PLOT-94b3e918-2bd3-4b08-9620-0017623eef60default" - }, - { - "source": "PROPHET_COMPONENTS-38474a31-dfa1-4d2b-8834-558ecadb82e3", - "sourceHandle": "default", - "target": "END-19d116f5-06e8-4a8c-b5ae-59b6db539708", - "targetHandle": "default", - "id": "reactflow__edge-PROPHET_COMPONENTS-38474a31-dfa1-4d2b-8834-558ecadb82e3default-END-19d116f5-06e8-4a8c-b5ae-59b6db539708default" - }, - { - "source": "PROPHET_PLOT-94b3e918-2bd3-4b08-9620-0017623eef60", - "sourceHandle": "default", - "target": "END-19d116f5-06e8-4a8c-b5ae-59b6db539708", - "targetHandle": "default", - "id": "reactflow__edge-PROPHET_PLOT-94b3e918-2bd3-4b08-9620-0017623eef60default-END-19d116f5-06e8-4a8c-b5ae-59b6db539708default" } ], "viewport": { diff --git a/docs/nodes/AI_ML/REGRESSION/LEAST_SQUARES/a1-[autogen]/python_code.txt b/docs/nodes/AI_ML/REGRESSION/LEAST_SQUARES/a1-[autogen]/python_code.txt index cf536326f1..facb4c1f1e 100644 --- a/docs/nodes/AI_ML/REGRESSION/LEAST_SQUARES/a1-[autogen]/python_code.txt +++ b/docs/nodes/AI_ML/REGRESSION/LEAST_SQUARES/a1-[autogen]/python_code.txt @@ -34,6 +34,8 @@ def LEAST_SQUARES( raise ValueError("Least Square Computation failed.") slope, intercept = p[0:-1], p[-1] + print("=============== This is slope: ", slope) + print("=============== This is intercept: ", intercept) res = slope * x + intercept return OrderedPair(x=x, y=res) diff --git a/docs/nodes/AI_ML/REGRESSION/LEAST_SQUARES/examples/EX1/app.jpeg b/docs/nodes/AI_ML/REGRESSION/LEAST_SQUARES/examples/EX1/app.jpeg index fa705a18e6..0372dd23c8 100644 Binary files a/docs/nodes/AI_ML/REGRESSION/LEAST_SQUARES/examples/EX1/app.jpeg and b/docs/nodes/AI_ML/REGRESSION/LEAST_SQUARES/examples/EX1/app.jpeg differ diff --git a/docs/nodes/AI_ML/REGRESSION/LEAST_SQUARES/examples/EX1/app.txt b/docs/nodes/AI_ML/REGRESSION/LEAST_SQUARES/examples/EX1/app.txt index 81bdf66909..e9573a354c 100644 --- a/docs/nodes/AI_ML/REGRESSION/LEAST_SQUARES/examples/EX1/app.txt +++ b/docs/nodes/AI_ML/REGRESSION/LEAST_SQUARES/examples/EX1/app.txt @@ -3,11 +3,11 @@ "nodes": [ { "width": 150, - "height": 150, - "id": "LINSPACE-df680be3-e028-4917-861b-d2d83d5d1302", + "height": 180, + "id": "LINSPACE-83e1b3b0-29ca-4f42-9776-6c73652e2b71", "type": "default", "data": { - "id": "LINSPACE-df680be3-e028-4917-861b-d2d83d5d1302", + "id": "LINSPACE-83e1b3b0-29ca-4f42-9776-6c73652e2b71", "label": "LINSPACE", "func": "LINSPACE", "type": "default", @@ -15,6 +15,7 @@ "start": { "type": "float", "default": 10, + "desc": null, "functionName": "LINSPACE", "param": "start", "value": "0" @@ -22,6 +23,7 @@ "end": { "type": "float", "default": 0, + "desc": null, "functionName": "LINSPACE", "param": "end", "value": "7" @@ -29,6 +31,7 @@ "step": { "type": "int", "default": 1000, + "desc": null, "functionName": "LINSPACE", "param": "step", "value": "300" @@ -38,30 +41,139 @@ { "name": "default", "id": "default", - "type": "OrderedPair" + "type": "Vector", + "desc": null } ], "path": "PYTHON/nodes/GENERATORS/SIMULATIONS/LINSPACE/LINSPACE.py", "selected": false }, "position": { - "x": 227.18559597016718, - "y": -50.939497486949165 + "x": 148.49805390493464, + "y": 216.82264265774717 }, "selected": false, "positionAbsolute": { - "x": 227.18559597016718, - "y": -50.939497486949165 + "x": 148.49805390493464, + "y": 216.82264265774717 + }, + "dragging": true + }, + { + "width": 208, + "height": 100, + "id": "CONSTANT-57b24533-1823-42bd-b02a-c055c4e8e406", + "type": "GENERATORS", + "data": { + "id": "CONSTANT-57b24533-1823-42bd-b02a-c055c4e8e406", + "label": "2", + "func": "CONSTANT", + "type": "GENERATORS", + "ctrls": { + "constant": { + "type": "float", + "default": 3, + "desc": null, + "functionName": "CONSTANT", + "param": "constant", + "value": "2" + }, + "step": { + "type": "int", + "default": 1000, + "desc": null, + "functionName": "CONSTANT", + "param": "step", + "value": "300" + } + }, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair", + "desc": null + } + ], + "path": "PYTHON/nodes/GENERATORS/SIMULATIONS/CONSTANT/CONSTANT.py", + "selected": false + }, + "position": { + "x": 105.04913536132531, + "y": 63.181137897664996 + }, + "selected": false, + "positionAbsolute": { + "x": 105.04913536132531, + "y": 63.181137897664996 + }, + "dragging": true + }, + { + "width": 72, + "height": 72, + "id": "ADD-8f70cff2-2317-4178-9927-0b1d1c5ce326", + "type": "ARITHMETIC", + "data": { + "id": "ADD-8f70cff2-2317-4178-9927-0b1d1c5ce326", + "label": "ADD", + "func": "ADD", + "type": "ARITHMETIC", + "ctrls": {}, + "inputs": [ + { + "name": "a", + "id": "a", + "type": "OrderedPair|Scalar|Vector", + "multiple": false, + "desc": null + }, + { + "name": "b", + "id": "b", + "type": "OrderedPair|Scalar|Vector", + "multiple": true, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair|Scalar|Vector", + "desc": null + } + ], + "path": "PYTHON/nodes/TRANSFORMERS/ARITHMETIC/ADD/ADD.py", + "selected": false + }, + "position": { + "x": 374.3382850463804, + "y": 214.12796593726893 + }, + "selected": false, + "positionAbsolute": { + "x": 374.3382850463804, + "y": 214.12796593726893 }, "dragging": true }, { "width": 150, - "height": 150, - "id": "LINSPACE-d91a514c-6973-4a70-8c5b-0cc22c8e94f4", + "height": 180, + "id": "LINSPACE-4d57606b-5efd-4fab-8742-a6ac2e7f3b67", "type": "default", "data": { - "id": "LINSPACE-d91a514c-6973-4a70-8c5b-0cc22c8e94f4", + "id": "LINSPACE-4d57606b-5efd-4fab-8742-a6ac2e7f3b67", "label": "LINSPACE 1", "func": "LINSPACE", "type": "default", @@ -69,6 +181,7 @@ "start": { "type": "float", "default": 10, + "desc": null, "functionName": "LINSPACE", "param": "start", "value": "0" @@ -76,6 +189,7 @@ "end": { "type": "float", "default": 0, + "desc": null, "functionName": "LINSPACE", "param": "end", "value": "7" @@ -83,6 +197,7 @@ "step": { "type": "int", "default": 1000, + "desc": null, "functionName": "LINSPACE", "param": "step", "value": "300" @@ -92,33 +207,34 @@ { "name": "default", "id": "default", - "type": "OrderedPair" + "type": "Vector", + "desc": null } ], "path": "PYTHON/nodes/GENERATORS/SIMULATIONS/LINSPACE/LINSPACE.py", "selected": false }, "position": { - "x": 221.6136436053551, - "y": 191.35387198204631 + "x": 138.61587327634447, + "y": 434.28381343983517 }, "selected": false, "positionAbsolute": { - "x": 221.6136436053551, - "y": 191.35387198204631 + "x": 138.61587327634447, + "y": 434.28381343983517 }, "dragging": true }, { - "width": 130, - "height": 130, - "id": "RAND-bbf07bd9-e158-42dd-8881-656015457e37", - "type": "SIMULATIONS", + "width": 208, + "height": 100, + "id": "RAND-c737081e-0937-47ef-9a87-44915e6806d3", + "type": "GENERATORS", "data": { - "id": "RAND-bbf07bd9-e158-42dd-8881-656015457e37", + "id": "RAND-c737081e-0937-47ef-9a87-44915e6806d3", "label": "RAND", "func": "RAND", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "distribution": { "type": "select", @@ -128,6 +244,7 @@ "uniform", "poisson" ], + "desc": "the distribution over the random samples", "functionName": "RAND", "param": "distribution", "value": "normal" @@ -135,34 +252,39 @@ "lower_bound": { "type": "float", "default": 0, + "desc": "the lower bound of the output interval", "functionName": "RAND", "param": "lower_bound", - "value": "0" + "value": 0 }, "upper_bound": { "type": "float", "default": 1, + "desc": "the upper bound of the output interval", "functionName": "RAND", "param": "upper_bound", - "value": "4" + "value": 1 }, "normal_mean": { "type": "float", "default": 0, + "desc": "the mean or \"center\" of the normal distribution", "functionName": "RAND", "param": "normal_mean", - "value": "3" + "value": 0 }, "normal_standard_deviation": { "type": "float", "default": 1, + "desc": "the spread or \"width\" of the normal distribution", "functionName": "RAND", "param": "normal_standard_deviation", - "value": "1.5" + "value": 1 }, "poisson_events": { "type": "float", "default": 1, + "desc": "the expected number of events occurring in a fixed time-interval when distribution is poisson", "functionName": "RAND", "param": "poisson_events", "value": 1 @@ -172,41 +294,92 @@ { "name": "default", "id": "default", - "type": "OrderedPair", - "multiple": false + "type": "OrderedPair|Vector", + "multiple": false, + "desc": "Optional input to use as the x-axis for the random samples" } ], "outputs": [ { "name": "default", "id": "default", - "type": "OrderedPair|Scalar" + "type": "OrderedPair|Scalar", + "desc": "OrderedPair if there's an input\nx: the x-axis of the input\ny: the random samples\n\nScalar if there is no input\nc: the random number" } ], "path": "PYTHON/nodes/GENERATORS/SIMULATIONS/RAND/RAND.py", "selected": false }, "position": { - "x": 455.0449564031011, - "y": 193.63885694876228 + "x": 353.9160159658098, + "y": 495.1155185740378 }, "selected": false, "positionAbsolute": { - "x": 455.0449564031011, - "y": 193.63885694876228 + "x": 353.9160159658098, + "y": 495.1155185740378 }, "dragging": true }, { - "width": 380, - "height": 293, - "id": "COMPOSITE-2c4a812b-8c4b-48a0-b4e7-729850fb1de9", - "type": "PLOTLY", + "width": 208, + "height": 132, + "id": "LEAST_SQUARES-0e288cda-db90-4fa7-b842-4ed4a43819de", + "type": "AI_ML", "data": { - "id": "COMPOSITE-2c4a812b-8c4b-48a0-b4e7-729850fb1de9", + "id": "LEAST_SQUARES-0e288cda-db90-4fa7-b842-4ed4a43819de", + "label": "LEAST SQUARES", + "func": "LEAST_SQUARES", + "type": "AI_ML", + "ctrls": {}, + "inputs": [ + { + "name": "a", + "id": "a", + "type": "OrderedPair|Matrix", + "multiple": false, + "desc": null + }, + { + "name": "b", + "id": "b", + "type": "OrderedPair|Matrix", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Matrix|OrderedPair", + "desc": "x: input matrix (data points)\ny: fitted line computed with returned regression weights" + } + ], + "path": "PYTHON/nodes/AI_ML/REGRESSION/LEAST_SQUARES/LEAST_SQUARES.py", + "selected": false + }, + "position": { + "x": 482.7806320200681, + "y": 276.35382064920515 + }, + "selected": false, + "positionAbsolute": { + "x": 482.7806320200681, + "y": 276.35382064920515 + }, + "dragging": true + }, + { + "width": 225, + "height": 226, + "id": "COMPOSITE-5d51fd86-f875-4c1e-b8c5-0d67d6c6726f", + "type": "VISUALIZERS", + "data": { + "id": "COMPOSITE-5d51fd86-f875-4c1e-b8c5-0d67d6c6726f", "label": "COMPOSITE", "func": "COMPOSITE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": { "first_figure": { "type": "select", @@ -217,6 +390,7 @@ "histogram", "scatter" ], + "desc": null, "functionName": "COMPOSITE", "param": "first_figure", "value": "line" @@ -230,6 +404,7 @@ "histogram", "scatter" ], + "desc": null, "functionName": "COMPOSITE", "param": "second_figure", "value": "scatter" @@ -240,164 +415,96 @@ "name": "primary_trace", "id": "primary_trace", "type": "OrderedPair|DataFrame|Matrix", - "multiple": false + "multiple": false, + "desc": null }, { "name": "secondary_trace", "id": "secondary_trace", "type": "OrderedPair|DataFrame|Matrix", - "multiple": false + "multiple": false, + "desc": null } ], "outputs": [ { "name": "default", "id": "default", - "type": "Plotly" + "type": "Plotly", + "desc": null } ], "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/COMPOSITE/COMPOSITE.py", "selected": false }, "position": { - "x": 916.6359858441485, - "y": 87.96986032774612 + "x": 778.2995679422427, + "y": 266.2522931189161 }, "selected": false, "positionAbsolute": { - "x": 916.6359858441485, - "y": 87.96986032774612 - }, - "dragging": true - }, - { - "width": 150, - "height": 150, - "id": "LEAST_SQUARES-0e8a1a8f-79a9-4ea6-880a-4f205d4f7fb9", - "type": "REGRESSION", - "data": { - "id": "LEAST_SQUARES-0e8a1a8f-79a9-4ea6-880a-4f205d4f7fb9", - "label": "LEAST SQUARES", - "func": "LEAST_SQUARES", - "type": "REGRESSION", - "ctrls": {}, - "inputs": [ - { - "name": "a", - "id": "a", - "type": "OrderedPair|Matrix|Vector", - "multiple": false - }, - { - "name": "b", - "id": "b", - "type": "OrderedPair|Matrix|Vector", - "multiple": false - } - ], - "outputs": [ - { - "name": "default", - "id": "default", - "type": "Matrix|Vector" - } - ], - "path": "PYTHON/nodes/AI_ML/REGRESSION/LEAST_SQUARES/LEAST_SQUARES.py", - "selected": false - }, - "position": { - "x": 671.7569336662056, - "y": -41.31332509663349 - }, - "selected": false, - "positionAbsolute": { - "x": 671.7569336662056, - "y": -41.31332509663349 - }, - "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-7536f8bf-8061-447e-bd96-6d4795ac7be8", - "type": "TERMINATORS", - "data": { - "id": "END-7536f8bf-8061-447e-bd96-6d4795ac7be8", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 1388.458203977925, - "y": 172.066874262064 - }, - "selected": false, - "positionAbsolute": { - "x": 1388.458203977925, - "y": 172.066874262064 + "x": 778.2995679422427, + "y": 266.2522931189161 }, "dragging": true } ], "edges": [ { - "source": "LINSPACE-d91a514c-6973-4a70-8c5b-0cc22c8e94f4", + "source": "LINSPACE-4d57606b-5efd-4fab-8742-a6ac2e7f3b67", "sourceHandle": "default", - "target": "RAND-bbf07bd9-e158-42dd-8881-656015457e37", + "target": "RAND-c737081e-0937-47ef-9a87-44915e6806d3", "targetHandle": "default", - "id": "reactflow__edge-LINSPACE-d91a514c-6973-4a70-8c5b-0cc22c8e94f4default-RAND-bbf07bd9-e158-42dd-8881-656015457e37default" + "id": "reactflow__edge-LINSPACE-4d57606b-5efd-4fab-8742-a6ac2e7f3b67default-RAND-c737081e-0937-47ef-9a87-44915e6806d3default" }, { - "source": "RAND-bbf07bd9-e158-42dd-8881-656015457e37", + "source": "ADD-8f70cff2-2317-4178-9927-0b1d1c5ce326", "sourceHandle": "default", - "target": "COMPOSITE-2c4a812b-8c4b-48a0-b4e7-729850fb1de9", - "targetHandle": "secondary_trace", - "id": "reactflow__edge-RAND-bbf07bd9-e158-42dd-8881-656015457e37default-COMPOSITE-2c4a812b-8c4b-48a0-b4e7-729850fb1de9secondary_trace" + "target": "LEAST_SQUARES-0e288cda-db90-4fa7-b842-4ed4a43819de", + "targetHandle": "a", + "id": "reactflow__edge-ADD-8f70cff2-2317-4178-9927-0b1d1c5ce326default-LEAST_SQUARES-0e288cda-db90-4fa7-b842-4ed4a43819dea", + "selected": false }, { - "source": "LINSPACE-df680be3-e028-4917-861b-d2d83d5d1302", + "source": "RAND-c737081e-0937-47ef-9a87-44915e6806d3", "sourceHandle": "default", - "target": "LEAST_SQUARES-0e8a1a8f-79a9-4ea6-880a-4f205d4f7fb9", - "targetHandle": "a", - "id": "reactflow__edge-LINSPACE-df680be3-e028-4917-861b-d2d83d5d1302default-LEAST_SQUARES-0e8a1a8f-79a9-4ea6-880a-4f205d4f7fb9a" + "target": "LEAST_SQUARES-0e288cda-db90-4fa7-b842-4ed4a43819de", + "targetHandle": "b", + "id": "reactflow__edge-RAND-c737081e-0937-47ef-9a87-44915e6806d3default-LEAST_SQUARES-0e288cda-db90-4fa7-b842-4ed4a43819deb" }, { - "source": "LEAST_SQUARES-0e8a1a8f-79a9-4ea6-880a-4f205d4f7fb9", + "source": "CONSTANT-57b24533-1823-42bd-b02a-c055c4e8e406", "sourceHandle": "default", - "target": "COMPOSITE-2c4a812b-8c4b-48a0-b4e7-729850fb1de9", - "targetHandle": "primary_trace", - "id": "reactflow__edge-LEAST_SQUARES-0e8a1a8f-79a9-4ea6-880a-4f205d4f7fb9default-COMPOSITE-2c4a812b-8c4b-48a0-b4e7-729850fb1de9primary_trace" + "target": "ADD-8f70cff2-2317-4178-9927-0b1d1c5ce326", + "targetHandle": "a", + "id": "reactflow__edge-CONSTANT-57b24533-1823-42bd-b02a-c055c4e8e406default-ADD-8f70cff2-2317-4178-9927-0b1d1c5ce326a" }, { - "source": "RAND-bbf07bd9-e158-42dd-8881-656015457e37", + "source": "LINSPACE-83e1b3b0-29ca-4f42-9776-6c73652e2b71", "sourceHandle": "default", - "target": "LEAST_SQUARES-0e8a1a8f-79a9-4ea6-880a-4f205d4f7fb9", + "target": "ADD-8f70cff2-2317-4178-9927-0b1d1c5ce326", "targetHandle": "b", - "id": "reactflow__edge-RAND-bbf07bd9-e158-42dd-8881-656015457e37default-LEAST_SQUARES-0e8a1a8f-79a9-4ea6-880a-4f205d4f7fb9b" + "id": "reactflow__edge-LINSPACE-83e1b3b0-29ca-4f42-9776-6c73652e2b71default-ADD-8f70cff2-2317-4178-9927-0b1d1c5ce326b" }, { - "source": "COMPOSITE-2c4a812b-8c4b-48a0-b4e7-729850fb1de9", + "source": "LEAST_SQUARES-0e288cda-db90-4fa7-b842-4ed4a43819de", "sourceHandle": "default", - "target": "END-7536f8bf-8061-447e-bd96-6d4795ac7be8", - "targetHandle": "default", - "id": "reactflow__edge-COMPOSITE-2c4a812b-8c4b-48a0-b4e7-729850fb1de9default-END-7536f8bf-8061-447e-bd96-6d4795ac7be8default" + "target": "COMPOSITE-5d51fd86-f875-4c1e-b8c5-0d67d6c6726f", + "targetHandle": "primary_trace", + "id": "reactflow__edge-LEAST_SQUARES-0e288cda-db90-4fa7-b842-4ed4a43819dedefault-COMPOSITE-5d51fd86-f875-4c1e-b8c5-0d67d6c6726fprimary_trace" + }, + { + "source": "RAND-c737081e-0937-47ef-9a87-44915e6806d3", + "sourceHandle": "default", + "target": "COMPOSITE-5d51fd86-f875-4c1e-b8c5-0d67d6c6726f", + "targetHandle": "secondary_trace", + "id": "reactflow__edge-RAND-c737081e-0937-47ef-9a87-44915e6806d3default-COMPOSITE-5d51fd86-f875-4c1e-b8c5-0d67d6c6726fsecondary_trace" } ], "viewport": { - "x": -456.37712173371256, - "y": 259.03077225262325, - "zoom": 1.3466637668169514 + "x": 555.284939185504, + "y": 240.2714794602041, + "zoom": 0.9407196048144776 } }, "ctrlsManifest": [ diff --git a/docs/nodes/AI_ML/REGRESSION/LEAST_SQUARES/examples/EX1/output.jpeg b/docs/nodes/AI_ML/REGRESSION/LEAST_SQUARES/examples/EX1/output.jpeg index b72733a981..8a06d51164 100644 Binary files a/docs/nodes/AI_ML/REGRESSION/LEAST_SQUARES/examples/EX1/output.jpeg and b/docs/nodes/AI_ML/REGRESSION/LEAST_SQUARES/examples/EX1/output.jpeg differ diff --git a/docs/nodes/AI_ML/SEGMENTATION/DEEPLAB_V3/a1-[autogen]/python_code.txt b/docs/nodes/AI_ML/SEGMENTATION/DEEPLAB_V3/a1-[autogen]/python_code.txt index b34a6db8f2..fec9e7156e 100644 --- a/docs/nodes/AI_ML/SEGMENTATION/DEEPLAB_V3/a1-[autogen]/python_code.txt +++ b/docs/nodes/AI_ML/SEGMENTATION/DEEPLAB_V3/a1-[autogen]/python_code.txt @@ -1,55 +1,68 @@ -from flojoy import flojoy, Image - -import torch -from torchvision import transforms -import torchvision.transforms.functional as TF - -from PIL import Image as PIL_Image -import numpy as np +from flojoy import flojoy, run_in_venv, Image @flojoy +@run_in_venv( + pip_dependencies=[ + "torch==2.0.1", + "torchvision==0.15.2", + "Pillow==9.5.0", + "numpy==1.24.3", + ] +) def DEEPLAB_V3(default: Image) -> Image: - input_image = default + import os + import numpy as np + import PIL.Image + import torch + from torchvision import transforms + import torchvision.transforms.functional as TF + from flojoy import Image + from flojoy.utils import FLOJOY_CACHE_DIR + + # Parse input image + input_image = default r, g, b, a = input_image.r, input_image.g, input_image.b, input_image.a nparray = ( np.stack((r, g, b, a), axis=2) if a is not None else np.stack((r, g, b), axis=2) ) - + # Convert input image input_image = TF.to_pil_image(nparray).convert("RGB") - + # Set torch hub cache directory + torch.hub.set_dir(os.path.join(FLOJOY_CACHE_DIR, "cache", "torch_hub")) model = torch.hub.load( - "pytorch/vision:v0.10.0", "deeplabv3_resnet50", pretrained=True + "pytorch/vision:v0.15.2", + "deeplabv3_resnet50", + pretrained=True, + skip_validation=True, ) model.eval() - + # Preprocessing preprocess_transform = transforms.Compose( [ transforms.ToTensor(), transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]), ] ) - + # Feed the input image to the model input_tensor = preprocess_transform(input_image) input_batch = input_tensor.unsqueeze(0) - - with torch.no_grad(): + with torch.inference_mode(): output = model(input_batch)["out"][0] - + # Fetch the output output_predictions = output.argmax(0) palette = torch.tensor([2**25 - 1, 2**15 - 1, 2**21 - 1]) colors = torch.as_tensor([i for i in range(21)])[:, None] * palette colors = (colors % 255).numpy().astype("uint8") - # plot the semantic segmentation predictions of 21 classes in each color - r = PIL_Image.fromarray(output_predictions.byte().cpu().numpy()).resize( + r = PIL.Image.fromarray(output_predictions.byte().cpu().numpy()).resize( input_image.size ) r.putpalette(colors) out_img = np.array(r.convert("RGB")) - + # Build the output image return Image( r=out_img[:, :, 0], g=out_img[:, :, 1], diff --git a/docs/nodes/AI_ML/SEGMENTATION/DEEPLAB_V3/examples/EX1/app.txt b/docs/nodes/AI_ML/SEGMENTATION/DEEPLAB_V3/examples/EX1/app.txt index b4f5b4bfb5..3e91a3e481 100644 --- a/docs/nodes/AI_ML/SEGMENTATION/DEEPLAB_V3/examples/EX1/app.txt +++ b/docs/nodes/AI_ML/SEGMENTATION/DEEPLAB_V3/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 150, "height": 150, "id": "LOCAL_FILE-ea2690c7-1b37-40c0-9d02-b000a553c3ec", - "type": "LOCAL_FILE_SYSTEM", + "type": "LOADERS", "data": { "id": "LOCAL_FILE-ea2690c7-1b37-40c0-9d02-b000a553c3ec", "label": "LOCAL FILE", "func": "LOCAL_FILE", - "type": "LOCAL_FILE_SYSTEM", + "type": "LOADERS", "ctrls": { "file_path": { "type": "str", @@ -69,12 +69,12 @@ "width": 150, "height": 150, "id": "DEEPLAB_V3-d48ad00f-5f1d-4abc-b6e9-5dbca49c6504", - "type": "SEGMENTATION", + "type": "AI_ML", "data": { "id": "DEEPLAB_V3-d48ad00f-5f1d-4abc-b6e9-5dbca49c6504", "label": "DEEPLAB V3", "func": "DEEPLAB_V3", - "type": "SEGMENTATION", + "type": "AI_ML", "ctrls": {}, "inputs": [ { @@ -109,12 +109,12 @@ "width": 380, "height": 293, "id": "IMAGE-4f7be017-7bb2-4650-b357-536574caaef9", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "IMAGE-4f7be017-7bb2-4650-b357-536574caaef9", "label": "IMAGE", "func": "IMAGE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -132,13 +132,13 @@ } ], "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/IMAGE/IMAGE.py", - "selected": true + "selected": false }, "position": { "x": 1358.296287493712, "y": 620.4805276906546 }, - "selected": true, + "selected": false, "positionAbsolute": { "x": 1358.296287493712, "y": 620.4805276906546 @@ -149,12 +149,12 @@ "width": 380, "height": 293, "id": "IMAGE-587cc53c-8da9-4bd5-a525-44386424da4b", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "IMAGE-587cc53c-8da9-4bd5-a525-44386424da4b", "label": "IMAGE 1", "func": "IMAGE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -184,39 +184,6 @@ "y": 223.0733492297885 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-057d326a-3ade-4474-882d-f0cd0d880bfe", - "type": "TERMINATORS", - "data": { - "id": "END-057d326a-3ade-4474-882d-f0cd0d880bfe", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 1863.718540377425, - "y": 708.0830404721299 - }, - "selected": false, - "positionAbsolute": { - "x": 1863.718540377425, - "y": 708.0830404721299 - }, - "dragging": true } ], "edges": [ @@ -240,13 +207,6 @@ "target": "IMAGE-587cc53c-8da9-4bd5-a525-44386424da4b", "targetHandle": "default", "id": "reactflow__edge-LOCAL_FILE-ea2690c7-1b37-40c0-9d02-b000a553c3ecdefault-IMAGE-587cc53c-8da9-4bd5-a525-44386424da4bdefault" - }, - { - "source": "IMAGE-4f7be017-7bb2-4650-b357-536574caaef9", - "sourceHandle": "default", - "target": "END-057d326a-3ade-4474-882d-f0cd0d880bfe", - "targetHandle": "default", - "id": "reactflow__edge-IMAGE-4f7be017-7bb2-4650-b357-536574caaef9default-END-057d326a-3ade-4474-882d-f0cd0d880bfedefault" } ], "viewport": { diff --git a/docs/nodes/AI_ML/TEXT_SUMMARIZATION/BART_LARGE_CNN/a1-[autogen]/docstring.txt b/docs/nodes/AI_ML/TEXT_SUMMARIZATION/BART_LARGE_CNN/a1-[autogen]/docstring.txt index ba4fcf4a22..c4a1ff6432 100644 --- a/docs/nodes/AI_ML/TEXT_SUMMARIZATION/BART_LARGE_CNN/a1-[autogen]/docstring.txt +++ b/docs/nodes/AI_ML/TEXT_SUMMARIZATION/BART_LARGE_CNN/a1-[autogen]/docstring.txt @@ -1,5 +1,5 @@ -The BART_LARGE_CNN node takes an input dataframe with multiple rows and a single "text" column, - and produces a dataframe with a single "summary_text" column. The "summary_text" column contains a summary +The BART_LARGE_CNN node takes an input dataframe with multiple rows and a single column, + and produces a dataframe with a single "summary_text" column. The "summary_text" column contains a summary of the text in the corresponding row of the input dataframe. Parameters diff --git a/docs/nodes/AI_ML/TEXT_SUMMARIZATION/BART_LARGE_CNN/a1-[autogen]/python_code.txt b/docs/nodes/AI_ML/TEXT_SUMMARIZATION/BART_LARGE_CNN/a1-[autogen]/python_code.txt index 9e23f3a588..cec0319c75 100644 --- a/docs/nodes/AI_ML/TEXT_SUMMARIZATION/BART_LARGE_CNN/a1-[autogen]/python_code.txt +++ b/docs/nodes/AI_ML/TEXT_SUMMARIZATION/BART_LARGE_CNN/a1-[autogen]/python_code.txt @@ -1,35 +1,47 @@ -from flojoy import flojoy, DataFrame -import torch -from transformers import BartTokenizer, BartForConditionalGeneration -import pandas as pd +from flojoy import flojoy, run_in_venv, DataFrame @flojoy +@run_in_venv( + pip_dependencies=[ + "transformers==4.30.2", + "torch==2.0.1", + "torchvision==0.15.2", + "pandas==1.5.3", + ] +) def BART_LARGE_CNN(default: DataFrame) -> DataFrame: + + import torch + from flojoy import snapshot_download + from transformers import BartTokenizer, BartForConditionalGeneration + import pandas as pd + input_df = default.m assert ( len(input_df.columns.tolist()) == 1 ), "Can only take a single-column dataframe as input" - # Load the pre-trained BART model - model = BartForConditionalGeneration.from_pretrained( - "facebook/bart-large-cnn", revision="3d22493" - ) - tokenizer = BartTokenizer.from_pretrained( - "facebook/bart-large-cnn", revision="3d22493" + # Load the repo from either the local cache or from the web, and get the local path + local_path = snapshot_download( + repo_id="facebook/bart-large-cnn", revision="3d22493" ) + # Load the pre-trained BART model + model = BartForConditionalGeneration.from_pretrained(local_path) + tokenizer = BartTokenizer.from_pretrained(local_path) + def _chunk_text(text): inputs_no_trunc = tokenizer( text, max_length=None, return_tensors="pt", truncation=False ) chunks = [] - for i in range( - 0, len(inputs_no_trunc["input_ids"][0]), tokenizer.model_max_length - ): - chunk = inputs_no_trunc["input_ids"][0][i : i + tokenizer.model_max_length] + step = 1024 + # step = tokenizer.model_max_length - 1 + for i in range(0, len(inputs_no_trunc["input_ids"][0]), step): + chunk = inputs_no_trunc["input_ids"][0][i : i + step] chunks.append(torch.unsqueeze(chunk, 0)) return chunks @@ -39,7 +51,7 @@ def BART_LARGE_CNN(default: DataFrame) -> DataFrame: model.generate( chunk, num_beams=4, - max_length=tokenizer.model_max_length // 2, + max_length=1024 // 2, early_stopping=True, ) for chunk in chunks @@ -59,7 +71,8 @@ def BART_LARGE_CNN(default: DataFrame) -> DataFrame: column = input_df.columns[0] - output_df = pd.DataFrame( - input_df[column].apply(_summarize_text).rename("summary_text") - ) + with torch.inference_mode(): + output_df = pd.DataFrame( + input_df[column].apply(_summarize_text).rename("summary_text") + ) return DataFrame(df=output_df) diff --git a/docs/nodes/AI_ML/TEXT_SUMMARIZATION/BART_LARGE_CNN/examples/EX1/app.jpeg b/docs/nodes/AI_ML/TEXT_SUMMARIZATION/BART_LARGE_CNN/examples/EX1/app.jpeg index 8642910fba..973278fe80 100644 Binary files a/docs/nodes/AI_ML/TEXT_SUMMARIZATION/BART_LARGE_CNN/examples/EX1/app.jpeg and b/docs/nodes/AI_ML/TEXT_SUMMARIZATION/BART_LARGE_CNN/examples/EX1/app.jpeg differ diff --git a/docs/nodes/AI_ML/TEXT_SUMMARIZATION/BART_LARGE_CNN/examples/EX1/app.txt b/docs/nodes/AI_ML/TEXT_SUMMARIZATION/BART_LARGE_CNN/examples/EX1/app.txt index 3bd30ea55d..97cf9e2fba 100644 --- a/docs/nodes/AI_ML/TEXT_SUMMARIZATION/BART_LARGE_CNN/examples/EX1/app.txt +++ b/docs/nodes/AI_ML/TEXT_SUMMARIZATION/BART_LARGE_CNN/examples/EX1/app.txt @@ -3,232 +3,200 @@ "nodes": [ { "width": 150, - "height": 150, - "id": "READ_CSV-b4473a00-4fc9-4f40-9731-de5f5af47bc7", - "type": "FILE", + "height": 180, + "id": "READ_CSV-c6754ffa-7213-485b-a8b5-0a0f7b5bebe0", + "type": "EXTRACTORS", "data": { - "id": "READ_CSV-b4473a00-4fc9-4f40-9731-de5f5af47bc7", + "id": "READ_CSV-c6754ffa-7213-485b-a8b5-0a0f7b5bebe0", "label": "READ CSV", "func": "READ_CSV", - "type": "FILE", + "type": "EXTRACTORS", "ctrls": { "file_path": { "type": "str", "default": "https://raw.githubusercontent.com/cs109/2014_data/master/countries.csv", + "desc": "File path to the CSV file or an URL of CSV file", "functionName": "READ_CSV", "param": "file_path", - "value": "./PYTHON/nodes/AI_ML/TEXT_SUMMARIZATION/BART_LARGE_CNN/assets/story.csv" + "value": "PYTHON/nodes/AI_ML/TEXT_SUMMARIZATION/BART_LARGE_CNN/assets/story.csv" } }, "outputs": [ { "name": "default", "id": "default", - "type": "DataFrame" + "type": "DataFrame", + "desc": null } ], "path": "PYTHON/nodes/EXTRACTORS/FILE/READ_CSV/READ_CSV.py", "selected": false }, "position": { - "x": -6.103068647837716, - "y": 162.91739516664495 + "x": -193.61455765591296, + "y": 22.506262839810688 }, "selected": false, "positionAbsolute": { - "x": -6.103068647837716, - "y": 162.91739516664495 + "x": -193.61455765591296, + "y": 22.506262839810688 }, "dragging": true }, { "width": 150, - "height": 150, - "id": "BART_LARGE_CNN-addf7f4a-edb8-47ad-bccf-1964d0bde0cd", - "type": "TEXT_SUMMARIZATION", + "height": 180, + "id": "BART_LARGE_CNN-cfe29f1d-4632-4270-af07-2eb6b5848cd6", + "type": "AI_ML", "data": { - "id": "BART_LARGE_CNN-addf7f4a-edb8-47ad-bccf-1964d0bde0cd", + "id": "BART_LARGE_CNN-cfe29f1d-4632-4270-af07-2eb6b5848cd6", "label": "BART LARGE CNN", "func": "BART_LARGE_CNN", - "type": "TEXT_SUMMARIZATION", + "type": "AI_ML", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", "type": "DataFrame", - "multiple": false + "multiple": false, + "desc": null } ], "outputs": [ { "name": "default", "id": "default", - "type": "DataFrame" + "type": "DataFrame", + "desc": null } ], "path": "PYTHON/nodes/AI_ML/TEXT_SUMMARIZATION/BART_LARGE_CNN/BART_LARGE_CNN.py", "selected": false }, "position": { - "x": 497.24130789253866, - "y": 167.16183425794515 + "x": 28.275977938396807, + "y": 23.26432657684532 }, "selected": false, "positionAbsolute": { - "x": 497.24130789253866, - "y": 167.16183425794515 + "x": 28.275977938396807, + "y": 23.26432657684532 }, "dragging": true }, { - "width": 380, - "height": 293, - "id": "TABLE-23d682f8-beb3-4883-abb6-28dfe3094192", - "type": "PLOTLY", + "width": 225, + "height": 226, + "id": "TABLE-d835eca9-2954-43ea-9970-2345933e2629", + "type": "VISUALIZERS", "data": { - "id": "TABLE-23d682f8-beb3-4883-abb6-28dfe3094192", + "id": "TABLE-d835eca9-2954-43ea-9970-2345933e2629", "label": "TABLE", "func": "TABLE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", - "type": "OrderedTriple|OrderedPair|DataFrame|Matrix", - "multiple": false + "type": "OrderedTriple|OrderedPair|DataFrame|Matrix|Vector", + "multiple": false, + "desc": null } ], "outputs": [ { "name": "default", "id": "default", - "type": "Plotly" + "type": "Plotly", + "desc": null } ], "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/TABLE/TABLE.py", "selected": false }, "position": { - "x": 74.58913442574638, - "y": 383.92678992481825 + "x": 265.7401587466265, + "y": -1.1595788699638092 }, "selected": false, "positionAbsolute": { - "x": 74.58913442574638, - "y": 383.92678992481825 + "x": 265.7401587466265, + "y": -1.1595788699638092 }, "dragging": true }, { - "width": 380, - "height": 293, - "id": "TABLE-5eea8810-1753-4bdd-ab72-79ab6c443de4", - "type": "PLOTLY", + "width": 225, + "height": 226, + "id": "TABLE-aa682847-ab68-4ef8-a3fa-bc0ad1c4f002", + "type": "VISUALIZERS", "data": { - "id": "TABLE-5eea8810-1753-4bdd-ab72-79ab6c443de4", + "id": "TABLE-aa682847-ab68-4ef8-a3fa-bc0ad1c4f002", "label": "TABLE 1", "func": "TABLE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", - "type": "OrderedTriple|OrderedPair|DataFrame|Matrix", - "multiple": false + "type": "OrderedTriple|OrderedPair|DataFrame|Matrix|Vector", + "multiple": false, + "desc": null } ], "outputs": [ { "name": "default", "id": "default", - "type": "Plotly" + "type": "Plotly", + "desc": null } ], "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/TABLE/TABLE.py", - "selected": true - }, - "position": { - "x": 804.8879844699666, - "y": 127.74090636089193 - }, - "selected": true, - "positionAbsolute": { - "x": 804.8879844699666, - "y": 127.74090636089193 - }, - "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-c83d1011-132b-4824-acb3-00dc62a1ac8a", - "type": "TERMINATORS", - "data": { - "id": "END-c83d1011-132b-4824-acb3-00dc62a1ac8a", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", "selected": false }, "position": { - "x": 1269.2354848774098, - "y": 180.75811472985612 + "x": -8.474838373483692, + "y": -232.87989856523 }, "selected": false, "positionAbsolute": { - "x": 1269.2354848774098, - "y": 180.75811472985612 + "x": -8.474838373483692, + "y": -232.87989856523 }, "dragging": true } ], "edges": [ { - "source": "READ_CSV-b4473a00-4fc9-4f40-9731-de5f5af47bc7", - "sourceHandle": "default", - "target": "BART_LARGE_CNN-addf7f4a-edb8-47ad-bccf-1964d0bde0cd", - "targetHandle": "default", - "id": "reactflow__edge-READ_CSV-b4473a00-4fc9-4f40-9731-de5f5af47bc7default-BART_LARGE_CNN-addf7f4a-edb8-47ad-bccf-1964d0bde0cddefault" - }, - { - "source": "READ_CSV-b4473a00-4fc9-4f40-9731-de5f5af47bc7", + "source": "READ_CSV-c6754ffa-7213-485b-a8b5-0a0f7b5bebe0", "sourceHandle": "default", - "target": "TABLE-23d682f8-beb3-4883-abb6-28dfe3094192", + "target": "BART_LARGE_CNN-cfe29f1d-4632-4270-af07-2eb6b5848cd6", "targetHandle": "default", - "id": "reactflow__edge-READ_CSV-b4473a00-4fc9-4f40-9731-de5f5af47bc7default-TABLE-23d682f8-beb3-4883-abb6-28dfe3094192default" + "id": "reactflow__edge-READ_CSV-c6754ffa-7213-485b-a8b5-0a0f7b5bebe0default-BART_LARGE_CNN-cfe29f1d-4632-4270-af07-2eb6b5848cd6default" }, { - "source": "BART_LARGE_CNN-addf7f4a-edb8-47ad-bccf-1964d0bde0cd", + "source": "READ_CSV-c6754ffa-7213-485b-a8b5-0a0f7b5bebe0", "sourceHandle": "default", - "target": "TABLE-5eea8810-1753-4bdd-ab72-79ab6c443de4", + "target": "TABLE-aa682847-ab68-4ef8-a3fa-bc0ad1c4f002", "targetHandle": "default", - "id": "reactflow__edge-BART_LARGE_CNN-addf7f4a-edb8-47ad-bccf-1964d0bde0cddefault-TABLE-5eea8810-1753-4bdd-ab72-79ab6c443de4default" + "id": "reactflow__edge-READ_CSV-c6754ffa-7213-485b-a8b5-0a0f7b5bebe0default-TABLE-aa682847-ab68-4ef8-a3fa-bc0ad1c4f002default" }, { - "source": "TABLE-5eea8810-1753-4bdd-ab72-79ab6c443de4", + "source": "BART_LARGE_CNN-cfe29f1d-4632-4270-af07-2eb6b5848cd6", "sourceHandle": "default", - "target": "END-c83d1011-132b-4824-acb3-00dc62a1ac8a", + "target": "TABLE-d835eca9-2954-43ea-9970-2345933e2629", "targetHandle": "default", - "id": "reactflow__edge-TABLE-5eea8810-1753-4bdd-ab72-79ab6c443de4default-END-c83d1011-132b-4824-acb3-00dc62a1ac8adefault" + "id": "reactflow__edge-BART_LARGE_CNN-cfe29f1d-4632-4270-af07-2eb6b5848cd6default-TABLE-d835eca9-2954-43ea-9970-2345933e2629default" } ], "viewport": { - "x": -277.07893884404893, - "y": 75.99194886435214, - "zoom": 0.8175961276759318 + "x": 671.2662705290845, + "y": 234.65628139815956, + "zoom": 0.9964993552221201 } }, "ctrlsManifest": [ diff --git a/docs/nodes/AI_ML/TEXT_SUMMARIZATION/BART_LARGE_CNN/examples/EX1/output.jpeg b/docs/nodes/AI_ML/TEXT_SUMMARIZATION/BART_LARGE_CNN/examples/EX1/output.jpeg index 31cef770c8..c01c8eeca2 100644 Binary files a/docs/nodes/AI_ML/TEXT_SUMMARIZATION/BART_LARGE_CNN/examples/EX1/output.jpeg and b/docs/nodes/AI_ML/TEXT_SUMMARIZATION/BART_LARGE_CNN/examples/EX1/output.jpeg differ diff --git a/docs/nodes/EXTRACTORS/DATAFRAME/EXTRACT_COLUMNS/a1-[autogen]/python_code.txt b/docs/nodes/EXTRACTORS/DATAFRAME/EXTRACT_COLUMNS/a1-[autogen]/python_code.txt index 5a75a15ea8..cdc20a5492 100644 --- a/docs/nodes/EXTRACTORS/DATAFRAME/EXTRACT_COLUMNS/a1-[autogen]/python_code.txt +++ b/docs/nodes/EXTRACTORS/DATAFRAME/EXTRACT_COLUMNS/a1-[autogen]/python_code.txt @@ -1,5 +1,4 @@ from flojoy import flojoy, DataFrame, Matrix, Array -import pandas as pd import numpy as np diff --git a/docs/nodes/EXTRACTORS/DATAFRAME/EXTRACT_COLUMNS/examples/EX1/app.txt b/docs/nodes/EXTRACTORS/DATAFRAME/EXTRACT_COLUMNS/examples/EX1/app.txt index 29ab786e3e..5a7db60d80 100644 --- a/docs/nodes/EXTRACTORS/DATAFRAME/EXTRACT_COLUMNS/examples/EX1/app.txt +++ b/docs/nodes/EXTRACTORS/DATAFRAME/EXTRACT_COLUMNS/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 150, "height": 150, "id": "PLOTLY_DATASET-d91971aa-7143-46d8-82a7-5ec15eba9816", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "data": { "id": "PLOTLY_DATASET-d91971aa-7143-46d8-82a7-5ec15eba9816", "label": "PLOTLY DATASET", "func": "PLOTLY_DATASET", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "ctrls": { "dataset_key": { "type": "select", @@ -57,12 +57,12 @@ "width": 150, "height": 150, "id": "EXTRACT_COLUMNS-e8f40b9e-1d83-478f-b43a-e0a53829e018", - "type": "EXTRACT_COLUMNS", + "type": "EXTRACTORS", "data": { "id": "EXTRACT_COLUMNS-e8f40b9e-1d83-478f-b43a-e0a53829e018", "label": "EXTRACT COLUMNS", "func": "EXTRACT_COLUMNS", - "type": "EXTRACT_COLUMNS", + "type": "EXTRACTORS", "ctrls": { "columns": { "type": "Array", @@ -105,12 +105,12 @@ "width": 150, "height": 150, "id": "EXTRACT_COLUMNS-19b5a943-df28-49dd-b030-f48cd6fc0444", - "type": "EXTRACT_COLUMNS", + "type": "EXTRACTORS", "data": { "id": "EXTRACT_COLUMNS-19b5a943-df28-49dd-b030-f48cd6fc0444", "label": "EXTRACT COLUMNS 1", "func": "EXTRACT_COLUMNS", - "type": "EXTRACT_COLUMNS", + "type": "EXTRACTORS", "ctrls": { "columns": { "type": "Array", @@ -153,12 +153,12 @@ "width": 380, "height": 293, "id": "TABLE-54f2efe9-ff96-4337-a557-5b04987361a1", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "TABLE-54f2efe9-ff96-4337-a557-5b04987361a1", "label": "TABLE", "func": "TABLE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -193,12 +193,12 @@ "width": 380, "height": 293, "id": "TABLE-78464c37-c0ed-4eeb-ac3a-0d13b241e24a", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "TABLE-78464c37-c0ed-4eeb-ac3a-0d13b241e24a", "label": "TABLE 1", "func": "TABLE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -228,39 +228,6 @@ "y": 655.3282103193458 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-190e5b18-4ab2-49a6-87fc-3d611186a619", - "type": "TERMINATORS", - "data": { - "id": "END-190e5b18-4ab2-49a6-87fc-3d611186a619", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 1351.5532232619507, - "y": 543.4542186811299 - }, - "selected": false, - "positionAbsolute": { - "x": 1351.5532232619507, - "y": 543.4542186811299 - }, - "dragging": true } ], "edges": [ @@ -291,20 +258,6 @@ "target": "TABLE-78464c37-c0ed-4eeb-ac3a-0d13b241e24a", "targetHandle": "default", "id": "reactflow__edge-EXTRACT_COLUMNS-19b5a943-df28-49dd-b030-f48cd6fc0444default-TABLE-78464c37-c0ed-4eeb-ac3a-0d13b241e24adefault" - }, - { - "source": "TABLE-54f2efe9-ff96-4337-a557-5b04987361a1", - "sourceHandle": "default", - "target": "END-190e5b18-4ab2-49a6-87fc-3d611186a619", - "targetHandle": "default", - "id": "reactflow__edge-TABLE-54f2efe9-ff96-4337-a557-5b04987361a1default-END-190e5b18-4ab2-49a6-87fc-3d611186a619default" - }, - { - "source": "TABLE-78464c37-c0ed-4eeb-ac3a-0d13b241e24a", - "sourceHandle": "default", - "target": "END-190e5b18-4ab2-49a6-87fc-3d611186a619", - "targetHandle": "default", - "id": "reactflow__edge-TABLE-78464c37-c0ed-4eeb-ac3a-0d13b241e24adefault-END-190e5b18-4ab2-49a6-87fc-3d611186a619default" } ], "viewport": { diff --git a/docs/nodes/EXTRACTORS/FILE/OPEN_IMAGE/examples/EX1/app.txt b/docs/nodes/EXTRACTORS/FILE/OPEN_IMAGE/examples/EX1/app.txt index 0fe4a11dca..c87778339a 100644 --- a/docs/nodes/EXTRACTORS/FILE/OPEN_IMAGE/examples/EX1/app.txt +++ b/docs/nodes/EXTRACTORS/FILE/OPEN_IMAGE/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 150, "height": 150, "id": "OPEN_IMAGE-2bfde548-fc1a-46ae-bab1-1352eea39ae9", - "type": "FILE", + "type": "EXTRACTORS", "data": { "id": "OPEN_IMAGE-2bfde548-fc1a-46ae-bab1-1352eea39ae9", "label": "OPEN IMAGE", "func": "OPEN_IMAGE", - "type": "FILE", + "type": "EXTRACTORS", "ctrls": { "file_path": { "type": "str", @@ -45,12 +45,12 @@ "width": 380, "height": 293, "id": "IMAGE-1f5192a8-cc27-4d99-beeb-a6632586b6d3", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "IMAGE-1f5192a8-cc27-4d99-beeb-a6632586b6d3", "label": "IMAGE", "func": "IMAGE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -80,39 +80,6 @@ "y": 349.2352236827468 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-307d0bac-9555-478d-b6df-ec3b4a9b23e2", - "type": "TERMINATORS", - "data": { - "id": "END-307d0bac-9555-478d-b6df-ec3b4a9b23e2", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 1906.3521517811973, - "y": 409.61252948653294 - }, - "selected": false, - "positionAbsolute": { - "x": 1906.3521517811973, - "y": 409.61252948653294 - }, - "dragging": true } ], "edges": [ @@ -122,13 +89,6 @@ "target": "IMAGE-1f5192a8-cc27-4d99-beeb-a6632586b6d3", "targetHandle": "default", "id": "reactflow__edge-OPEN_IMAGE-2bfde548-fc1a-46ae-bab1-1352eea39ae9default-IMAGE-1f5192a8-cc27-4d99-beeb-a6632586b6d3default" - }, - { - "source": "IMAGE-1f5192a8-cc27-4d99-beeb-a6632586b6d3", - "sourceHandle": "default", - "target": "END-307d0bac-9555-478d-b6df-ec3b4a9b23e2", - "targetHandle": "default", - "id": "reactflow__edge-IMAGE-1f5192a8-cc27-4d99-beeb-a6632586b6d3default-END-307d0bac-9555-478d-b6df-ec3b4a9b23e2default" } ], "viewport": { diff --git a/docs/nodes/EXTRACTORS/FILE/OPEN_PARQUET/examples/EX1/app.txt b/docs/nodes/EXTRACTORS/FILE/OPEN_PARQUET/examples/EX1/app.txt index 02626eb674..68b082c1c0 100644 --- a/docs/nodes/EXTRACTORS/FILE/OPEN_PARQUET/examples/EX1/app.txt +++ b/docs/nodes/EXTRACTORS/FILE/OPEN_PARQUET/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 150, "height": 150, "id": "OPEN_PARQUET-196993ec-f559-44c6-8d7d-14360ed20ce7", - "type": "FILE", + "type": "EXTRACTORS", "data": { "id": "OPEN_PARQUET-196993ec-f559-44c6-8d7d-14360ed20ce7", "label": "OPEN PARQUET", "func": "OPEN_PARQUET", - "type": "FILE", + "type": "EXTRACTORS", "ctrls": { "file_path": { "type": "str", @@ -55,12 +55,12 @@ "width": 225, "height": 226, "id": "TABLE-af6328dd-0379-4824-898f-d0d3b677b664", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "TABLE-af6328dd-0379-4824-898f-d0d3b677b664", "label": "TABLE", "func": "TABLE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -90,39 +90,6 @@ "y": 149.0810155005708 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-c8fc5ed5-3128-428c-ad8c-4742d7418289", - "type": "TERMINATORS", - "data": { - "id": "END-c8fc5ed5-3128-428c-ad8c-4742d7418289", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 925.661424950219, - "y": 193.04826676898648 - }, - "selected": false, - "positionAbsolute": { - "x": 925.661424950219, - "y": 193.04826676898648 - }, - "dragging": true } ], "edges": [ @@ -132,13 +99,6 @@ "target": "TABLE-af6328dd-0379-4824-898f-d0d3b677b664", "targetHandle": "default", "id": "reactflow__edge-OPEN_PARQUET-196993ec-f559-44c6-8d7d-14360ed20ce7default-TABLE-af6328dd-0379-4824-898f-d0d3b677b664default" - }, - { - "source": "TABLE-af6328dd-0379-4824-898f-d0d3b677b664", - "sourceHandle": "default", - "target": "END-c8fc5ed5-3128-428c-ad8c-4742d7418289", - "targetHandle": "default", - "id": "reactflow__edge-TABLE-af6328dd-0379-4824-898f-d0d3b677b664default-END-c8fc5ed5-3128-428c-ad8c-4742d7418289default" } ], "viewport": { diff --git a/docs/nodes/EXTRACTORS/FILE/READ_CSV/examples/EX1/app.txt b/docs/nodes/EXTRACTORS/FILE/READ_CSV/examples/EX1/app.txt index 18dadfcee1..81db078534 100644 --- a/docs/nodes/EXTRACTORS/FILE/READ_CSV/examples/EX1/app.txt +++ b/docs/nodes/EXTRACTORS/FILE/READ_CSV/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 150, "height": 150, "id": "READ_CSV-8b04aea4-84df-4d71-ae8c-356334a25be2", - "type": "FILE", + "type": "EXTRACTORS", "data": { "id": "READ_CSV-8b04aea4-84df-4d71-ae8c-356334a25be2", "label": "READ CSV", "func": "READ_CSV", - "type": "FILE", + "type": "EXTRACTORS", "ctrls": { "file_path": { "type": "str", @@ -45,12 +45,12 @@ "width": 225, "height": 226, "id": "TABLE-de9611d6-a05a-4679-afe3-a7fa7f49f8a4", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "TABLE-de9611d6-a05a-4679-afe3-a7fa7f49f8a4", "label": "TABLE", "func": "TABLE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -80,39 +80,6 @@ "y": 186.96473062581748 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-40be4561-0366-4752-95aa-e08c433ebd9c", - "type": "TERMINATORS", - "data": { - "id": "END-40be4561-0366-4752-95aa-e08c433ebd9c", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 1394.596043670549, - "y": 239.45590432071873 - }, - "selected": false, - "positionAbsolute": { - "x": 1394.596043670549, - "y": 239.45590432071873 - }, - "dragging": true } ], "edges": [ @@ -122,13 +89,6 @@ "target": "TABLE-de9611d6-a05a-4679-afe3-a7fa7f49f8a4", "targetHandle": "default", "id": "reactflow__edge-READ_CSV-8b04aea4-84df-4d71-ae8c-356334a25be2default-TABLE-de9611d6-a05a-4679-afe3-a7fa7f49f8a4default" - }, - { - "source": "TABLE-de9611d6-a05a-4679-afe3-a7fa7f49f8a4", - "sourceHandle": "default", - "target": "END-40be4561-0366-4752-95aa-e08c433ebd9c", - "targetHandle": "default", - "id": "reactflow__edge-TABLE-de9611d6-a05a-4679-afe3-a7fa7f49f8a4default-END-40be4561-0366-4752-95aa-e08c433ebd9cdefault" } ], "viewport": { diff --git a/docs/nodes/EXTRACTORS/FILE/READ_S3/READ_S3.md b/docs/nodes/EXTRACTORS/FILE/READ_S3/READ_S3.md index e085c5775e..4250d5dd1a 100644 --- a/docs/nodes/EXTRACTORS/FILE/READ_S3/READ_S3.md +++ b/docs/nodes/EXTRACTORS/FILE/READ_S3/READ_S3.md @@ -25,13 +25,13 @@ import PythonSource from '!!raw-loader!./a1-[autogen]/python_code.txt'; import Example1 from './examples/EX1/example.md'; import App1 from '!!raw-loader!./examples/EX1/app.txt'; - - +import appImg from './examples/EX1/app.jpeg' +import outputImg from './examples/EX1/output.jpeg' {App1} diff --git a/docs/nodes/EXTRACTORS/FILE/READ_S3/a1-[autogen]/docstring.txt b/docs/nodes/EXTRACTORS/FILE/READ_S3/a1-[autogen]/docstring.txt index fcf637de4a..03f37178a5 100644 --- a/docs/nodes/EXTRACTORS/FILE/READ_S3/a1-[autogen]/docstring.txt +++ b/docs/nodes/EXTRACTORS/FILE/READ_S3/a1-[autogen]/docstring.txt @@ -14,4 +14,4 @@ file_name: Returns ------ DataContainer: - type 'dataframe', m + type 'dataframe', df diff --git a/docs/nodes/EXTRACTORS/FILE/READ_S3/a1-[autogen]/python_code.txt b/docs/nodes/EXTRACTORS/FILE/READ_S3/a1-[autogen]/python_code.txt index c894847d0f..fbf67bd054 100644 --- a/docs/nodes/EXTRACTORS/FILE/READ_S3/a1-[autogen]/python_code.txt +++ b/docs/nodes/EXTRACTORS/FILE/READ_S3/a1-[autogen]/python_code.txt @@ -1,7 +1,4 @@ -from pathlib import Path -import os import pandas as pd -import yaml import io import boto3 import keyring @@ -20,9 +17,8 @@ def READ_S3( raise ValueError("Provide a name that was used to set AWS S3 key") try: - accessKey = keyring.get_password(f"{s3_name}accessKey") - secretKey = keyring.get_password(f"{s3_name}secretKey") - + accessKey = keyring.get_password("system", f"{s3_name}_ACCESSKEY") + secretKey = keyring.get_password("system", f"{s3_name}_SECRETKEY") s3 = boto3.resource( "s3", aws_access_key_id=accessKey, aws_secret_access_key=secretKey ) @@ -31,7 +27,7 @@ def READ_S3( object.download_fileobj(buffer) df = pd.read_parquet(buffer) - return DataFrame(m=df) + return DataFrame(df=df) except Exception as e: print(e) diff --git a/docs/nodes/EXTRACTORS/FILE/READ_S3/examples/EX1/app.txt b/docs/nodes/EXTRACTORS/FILE/READ_S3/examples/EX1/app.txt index 2c100bca75..228e0dc4e3 100644 --- a/docs/nodes/EXTRACTORS/FILE/READ_S3/examples/EX1/app.txt +++ b/docs/nodes/EXTRACTORS/FILE/READ_S3/examples/EX1/app.txt @@ -3,113 +3,118 @@ "nodes": [ { "width": 150, - "height": 150, - "id": "READ_S3-4e5e8dec-036d-4bc2-b4cf-2165c66a8923", - "type": "FILE", + "height": 180, + "id": "READ_S3-a7ae5adf-3873-46e1-b0f1-89abfb885ae6", + "type": "EXTRACTORS", "data": { - "id": "READ_S3-4e5e8dec-036d-4bc2-b4cf-2165c66a8923", + "id": "READ_S3-a7ae5adf-3873-46e1-b0f1-89abfb885ae6", "label": "READ S3", "func": "READ_S3", - "type": "FILE", + "type": "EXTRACTORS", "ctrls": { "s3_name": { + "type": "str", + "default": "", + "desc": "name of the key that the user used to save access and secret access key", "functionName": "READ_S3", "param": "s3_name", - "value": "flojoy-testing" + "value": "FLOJOY" }, "bucket_name": { + "type": "str", + "default": "", + "desc": "AWS S3 bucket name that they are trying to access", "functionName": "READ_S3", "param": "bucket_name", - "value": "read-s3-node-testing" + "value": "flojoy-test" }, "file_name": { + "type": "str", + "default": "", + "desc": "name of the file that they want to extract", "functionName": "READ_S3", "param": "file_name", "value": "userdata1.parquet" } }, + "outputs": [ + { + "name": "default", + "id": "default", + "type": "DataFrame", + "desc": null + } + ], + "path": "PYTHON/nodes/EXTRACTORS/FILE/READ_S3/READ_S3.py", "selected": false }, "position": { - "x": 238.01114122664217, - "y": 667.3907700195157 - }, - "selected": false, - "positionAbsolute": { - "x": 238.01114122664217, - "y": 667.3907700195157 - }, - "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-ec894b0d-cc13-4dcc-9ee6-f66dfdb38ed0", - "type": "TERMINATOR", - "data": { - "id": "END-ec894b0d-cc13-4dcc-9ee6-f66dfdb38ed0", - "label": "END", - "func": "END", - "type": "TERMINATOR", - "ctrls": {}, - "selected": false - }, - "position": { - "x": 1379.4397126552135, - "y": 665.9621985909441 + "x": -30.844856544489318, + "y": -70.41830920648297 }, "selected": false, "positionAbsolute": { - "x": 1379.4397126552135, - "y": 665.9621985909441 + "x": -30.844856544489318, + "y": -70.41830920648297 }, "dragging": true }, { - "width": 380, - "height": 293, - "id": "TABLE-d71cf926-0c67-443d-9f6e-a3f6649c9c22", - "type": "PLOTLY_VISOR", + "width": 225, + "height": 226, + "id": "TABLE-0f7daf14-fbf4-46c1-8d75-124ce212b38e", + "type": "VISUALIZERS", "data": { - "id": "TABLE-d71cf926-0c67-443d-9f6e-a3f6649c9c22", + "id": "TABLE-0f7daf14-fbf4-46c1-8d75-124ce212b38e", "label": "TABLE", "func": "TABLE", - "type": "PLOTLY_VISOR", + "type": "VISUALIZERS", "ctrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedTriple|OrderedPair|DataFrame|Matrix|Vector", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": null + } + ], + "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/TABLE/TABLE.py", "selected": false }, "position": { - "x": 705.1539983694992, - "y": 574.5336271623727 + "x": 325.5749490958755, + "y": -89.02125782914803 }, "selected": false, "positionAbsolute": { - "x": 705.1539983694992, - "y": 574.5336271623727 + "x": 325.5749490958755, + "y": -89.02125782914803 }, "dragging": true } ], "edges": [ { - "source": "READ_S3-4e5e8dec-036d-4bc2-b4cf-2165c66a8923", - "sourceHandle": "main", - "target": "TABLE-d71cf926-0c67-443d-9f6e-a3f6649c9c22", - "targetHandle": "TABLE", - "id": "reactflow__edge-READ_S3-4e5e8dec-036d-4bc2-b4cf-2165c66a8923main-TABLE-d71cf926-0c67-443d-9f6e-a3f6649c9c22TABLE" - }, - { - "source": "TABLE-d71cf926-0c67-443d-9f6e-a3f6649c9c22", - "sourceHandle": "main", - "target": "END-ec894b0d-cc13-4dcc-9ee6-f66dfdb38ed0", - "targetHandle": "END", - "id": "reactflow__edge-TABLE-d71cf926-0c67-443d-9f6e-a3f6649c9c22main-END-ec894b0d-cc13-4dcc-9ee6-f66dfdb38ed0END" + "source": "READ_S3-a7ae5adf-3873-46e1-b0f1-89abfb885ae6", + "sourceHandle": "default", + "target": "TABLE-0f7daf14-fbf4-46c1-8d75-124ce212b38e", + "targetHandle": "default", + "id": "reactflow__edge-READ_S3-a7ae5adf-3873-46e1-b0f1-89abfb885ae6default-TABLE-0f7daf14-fbf4-46c1-8d75-124ce212b38edefault" } ], "viewport": { - "x": 383.94248946966945, - "y": 98.35910915060867, - "zoom": 1.1608238532718647 + "x": 510.21439896404956, + "y": 541.3693344933569, + "zoom": 0.8648007408335578 } }, "ctrlsManifest": [ diff --git a/docs/nodes/GENERATORS/SAMPLE_DATASETS/PLOTLY_DATASET/examples/EX1/app.txt b/docs/nodes/GENERATORS/SAMPLE_DATASETS/PLOTLY_DATASET/examples/EX1/app.txt index 6e33a1d5f8..d37975774e 100644 --- a/docs/nodes/GENERATORS/SAMPLE_DATASETS/PLOTLY_DATASET/examples/EX1/app.txt +++ b/docs/nodes/GENERATORS/SAMPLE_DATASETS/PLOTLY_DATASET/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 150, "height": 150, "id": "PLOTLY_DATASET-18ff6bc0-bc2c-4a83-8d32-e0017d63b86a", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "data": { "id": "PLOTLY_DATASET-18ff6bc0-bc2c-4a83-8d32-e0017d63b86a", "label": "PLOTLY DATASET", "func": "PLOTLY_DATASET", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "ctrls": { "dataset_key": { "type": "select", @@ -57,12 +57,12 @@ "width": 225, "height": 226, "id": "TABLE-074b186e-cc6b-43d4-910e-63c2a8e3650a", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "TABLE-074b186e-cc6b-43d4-910e-63c2a8e3650a", "label": "TABLE", "func": "TABLE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -92,39 +92,6 @@ "y": 111.92430876780708 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-f45b6df2-b5a5-408b-b945-9363620e8c3b", - "type": "TERMINATORS", - "data": { - "id": "END-f45b6df2-b5a5-408b-b945-9363620e8c3b", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", - "selected": false - }, - "position": { - "x": 1534.631733258007, - "y": 150.26303165505033 - }, - "selected": false, - "positionAbsolute": { - "x": 1534.631733258007, - "y": 150.26303165505033 - }, - "dragging": true } ], "edges": [ @@ -134,13 +101,6 @@ "target": "TABLE-074b186e-cc6b-43d4-910e-63c2a8e3650a", "targetHandle": "default", "id": "reactflow__edge-PLOTLY_DATASET-18ff6bc0-bc2c-4a83-8d32-e0017d63b86adefault-TABLE-074b186e-cc6b-43d4-910e-63c2a8e3650adefault" - }, - { - "source": "TABLE-074b186e-cc6b-43d4-910e-63c2a8e3650a", - "sourceHandle": "default", - "target": "END-f45b6df2-b5a5-408b-b945-9363620e8c3b", - "targetHandle": "default", - "id": "reactflow__edge-TABLE-074b186e-cc6b-43d4-910e-63c2a8e3650adefault-END-f45b6df2-b5a5-408b-b945-9363620e8c3bdefault" } ], "viewport": { diff --git a/docs/nodes/GENERATORS/SAMPLE_DATASETS/R_DATASET/examples/EX1/app.txt b/docs/nodes/GENERATORS/SAMPLE_DATASETS/R_DATASET/examples/EX1/app.txt index abb44f54d5..18a471c2ec 100644 --- a/docs/nodes/GENERATORS/SAMPLE_DATASETS/R_DATASET/examples/EX1/app.txt +++ b/docs/nodes/GENERATORS/SAMPLE_DATASETS/R_DATASET/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 150, "height": 150, "id": "R_DATASET-52b424e0-d868-40e9-90c2-992ff9c78e0e", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "data": { "id": "R_DATASET-52b424e0-d868-40e9-90c2-992ff9c78e0e", "label": "R DATASET", "func": "R_DATASET", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "ctrls": { "dataset_key": { "type": "select", @@ -134,12 +134,12 @@ "width": 380, "height": 293, "id": "TABLE-09b6e8ee-fa4a-43d0-b7d8-4ea7f6678fcd", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "TABLE-09b6e8ee-fa4a-43d0-b7d8-4ea7f6678fcd", "label": "TABLE", "func": "TABLE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -157,51 +157,18 @@ } ], "path": "PYTHON/nodes\\VISUALIZERS\\PLOTLY\\TABLE\\TABLE.py", - "selected": true + "selected": false }, "position": { "x": 539.9445089046594, "y": 128.4445302014754 }, - "selected": true, + "selected": false, "positionAbsolute": { "x": 539.9445089046594, "y": 128.4445302014754 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-a5316cd2-8a7b-48ec-a10f-d116974b4ab5", - "type": "TERMINATORS", - "data": { - "id": "END-a5316cd2-8a7b-48ec-a10f-d116974b4ab5", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", - "selected": false - }, - "position": { - "x": 1187.0873660475165, - "y": 187.01595877290396 - }, - "selected": false, - "positionAbsolute": { - "x": 1187.0873660475165, - "y": 187.01595877290396 - }, - "dragging": true } ], "edges": [ @@ -211,13 +178,6 @@ "target": "TABLE-09b6e8ee-fa4a-43d0-b7d8-4ea7f6678fcd", "targetHandle": "default", "id": "reactflow__edge-R_DATASET-52b424e0-d868-40e9-90c2-992ff9c78e0edefault-TABLE-09b6e8ee-fa4a-43d0-b7d8-4ea7f6678fcddefault" - }, - { - "source": "TABLE-09b6e8ee-fa4a-43d0-b7d8-4ea7f6678fcd", - "sourceHandle": "default", - "target": "END-a5316cd2-8a7b-48ec-a10f-d116974b4ab5", - "targetHandle": "default", - "id": "reactflow__edge-TABLE-09b6e8ee-fa4a-43d0-b7d8-4ea7f6678fcddefault-END-a5316cd2-8a7b-48ec-a10f-d116974b4ab5default" } ], "viewport": { diff --git a/docs/nodes/GENERATORS/SAMPLE_DATASETS/TEXT_DATASET/examples/EX1/app.txt b/docs/nodes/GENERATORS/SAMPLE_DATASETS/TEXT_DATASET/examples/EX1/app.txt index f44889c6be..a1c2d4f76b 100644 --- a/docs/nodes/GENERATORS/SAMPLE_DATASETS/TEXT_DATASET/examples/EX1/app.txt +++ b/docs/nodes/GENERATORS/SAMPLE_DATASETS/TEXT_DATASET/examples/EX1/app.txt @@ -2,15 +2,55 @@ "rfInstance": { "nodes": [ { - "width": 150, - "height": 150, - "id": "TEXT_DATASET-85e09f8c-f053-4ab3-88df-464421665ef3", - "type": "SAMPLE_DATASETS", + "width": 225, + "height": 226, + "id": "TABLE-6a242d62-814f-406e-94de-d5c6908dce5e", + "type": "VISUALIZERS", + "data": { + "id": "TABLE-6a242d62-814f-406e-94de-d5c6908dce5e", + "label": "TABLE", + "func": "TABLE", + "type": "VISUALIZERS", + "ctrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedTriple|OrderedPair|DataFrame|Matrix", + "multiple": false + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly" + } + ], + "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/TABLE/TABLE.py", + "selected": false + }, + "position": { + "x": 1170.5289863217536, + "y": 441.8699692511366 + }, + "selected": false, + "positionAbsolute": { + "x": 1170.5289863217536, + "y": 441.8699692511366 + }, + "dragging": true + }, + { + "width": 208, + "height": 96, + "id": "TEXT_DATASET-4a227c84-7852-41a2-acdf-248e97fbae85", + "type": "GENERATORS", "data": { - "id": "TEXT_DATASET-85e09f8c-f053-4ab3-88df-464421665ef3", + "id": "TEXT_DATASET-4a227c84-7852-41a2-acdf-248e97fbae85", "label": "TEXT DATASET", "func": "TEXT_DATASET", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "ctrls": { "subset": { "type": "select", @@ -20,13 +60,15 @@ "test", "all" ], + "desc": "Select the dataset to load: \"train\" for the training set, \"test\" for the test set, \"all\" for both.", "functionName": "TEXT_DATASET", "param": "subset", "value": "train" }, "categories": { - "type": "list[str]", + "type": "Array", "default": null, + "desc": "Select the categories to load. By default, all categories are loaded.\nThe list of all categories is:\n'alt.atheism',\n'comp.graphics',\n'comp.os.ms-windows.misc',\n'comp.sys.ibm.pc.hardware',\n'comp.sys.mac.hardware',\n'comp.windows.x',\n'misc.forsale',\n'rec.autos',\n'rec.motorcycles',\n'rec.sport.baseball',\n'rec.sport.hockey',\n'sci.crypt',\n'sci.electronics',\n'sci.med',\n'sci.space',\n'soc.religion.christian',\n'talk.politics.guns',\n'talk.politics.mideast',\n'talk.politics.misc',\n'talk.religion.misc'", "functionName": "TEXT_DATASET", "param": "categories", "value": "comp.graphics,alt.atheism" @@ -34,6 +76,7 @@ "remove_headers": { "type": "bool", "default": false, + "desc": "Remove the headers from the data.", "functionName": "TEXT_DATASET", "param": "remove_headers", "value": true @@ -41,6 +84,7 @@ "remove_footers": { "type": "bool", "default": false, + "desc": "Remove the footers from the data.", "functionName": "TEXT_DATASET", "param": "remove_footers", "value": true @@ -48,6 +92,7 @@ "remove_quotes": { "type": "bool", "default": false, + "desc": "Remove the quotes from the data.", "functionName": "TEXT_DATASET", "param": "remove_quotes", "value": true @@ -57,116 +102,38 @@ { "name": "default", "id": "default", - "type": "DataFrame" + "type": "DataFrame", + "desc": null } ], - "path": "PYTHON/nodes/GENERATORS/SAMPLE_DATASETS/TEXT_DATASET/TEXT_DATASET.py", + "path": "PYTHON/nodes\\GENERATORS\\SAMPLE_DATASETS\\TEXT_DATASET\\TEXT_DATASET.py", "selected": false }, "position": { - "x": 795.41760366579, - "y": 492.80936134378084 + "x": 829.2140671536599, + "y": 506.1845630079231 }, "selected": false, "positionAbsolute": { - "x": 795.41760366579, - "y": 492.80936134378084 - } - }, - { - "width": 380, - "height": 293, - "id": "TABLE-6a242d62-814f-406e-94de-d5c6908dce5e", - "type": "PLOTLY", - "data": { - "id": "TABLE-6a242d62-814f-406e-94de-d5c6908dce5e", - "label": "TABLE", - "func": "TABLE", - "type": "PLOTLY", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "OrderedTriple|OrderedPair|DataFrame|Matrix", - "multiple": false - } - ], - "outputs": [ - { - "name": "default", - "id": "default", - "type": "Plotly" - } - ], - "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/TABLE/TABLE.py", - "selected": true - }, - "position": { - "x": 1170.5289863217536, - "y": 441.8699692511366 - }, - "selected": true, - "positionAbsolute": { - "x": 1170.5289863217536, - "y": 441.8699692511366 - }, - "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-86813c86-a82c-4cd4-9584-b51e7e5e3746", - "type": "TERMINATORS", - "data": { - "id": "END-86813c86-a82c-4cd4-9584-b51e7e5e3746", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 1636.2318807816505, - "y": 497.431265309786 - }, - "selected": false, - "positionAbsolute": { - "x": 1636.2318807816505, - "y": 497.431265309786 + "x": 829.2140671536599, + "y": 506.1845630079231 }, "dragging": true } ], "edges": [ { - "source": "TEXT_DATASET-85e09f8c-f053-4ab3-88df-464421665ef3", + "source": "TEXT_DATASET-4a227c84-7852-41a2-acdf-248e97fbae85", "sourceHandle": "default", "target": "TABLE-6a242d62-814f-406e-94de-d5c6908dce5e", "targetHandle": "default", - "id": "reactflow__edge-TEXT_DATASET-85e09f8c-f053-4ab3-88df-464421665ef3default-TABLE-6a242d62-814f-406e-94de-d5c6908dce5edefault" - }, - { - "source": "TABLE-6a242d62-814f-406e-94de-d5c6908dce5e", - "sourceHandle": "default", - "target": "END-86813c86-a82c-4cd4-9584-b51e7e5e3746", - "targetHandle": "default", - "id": "reactflow__edge-TABLE-6a242d62-814f-406e-94de-d5c6908dce5edefault-END-86813c86-a82c-4cd4-9584-b51e7e5e3746default" + "id": "reactflow__edge-TEXT_DATASET-4a227c84-7852-41a2-acdf-248e97fbae85default-TABLE-6a242d62-814f-406e-94de-d5c6908dce5edefault" } ], "viewport": { - "x": -277.07893884404893, - "y": 103.38141914149585, - "zoom": 0.8175961276759318 + "x": 606.4472645567363, + "y": 234.63130388602087, + "zoom": 0.9186369849831518 } }, "ctrlsManifest": [ diff --git a/docs/nodes/GENERATORS/SAMPLE_IMAGES/SKLEARNIMAGE/a1-[autogen]/python_code.txt b/docs/nodes/GENERATORS/SAMPLE_IMAGES/SKLEARNIMAGE/a1-[autogen]/python_code.txt index 4acdbe2c36..eae6c4dfa7 100644 --- a/docs/nodes/GENERATORS/SAMPLE_IMAGES/SKLEARNIMAGE/a1-[autogen]/python_code.txt +++ b/docs/nodes/GENERATORS/SAMPLE_IMAGES/SKLEARNIMAGE/a1-[autogen]/python_code.txt @@ -3,7 +3,7 @@ from skimage import data from typing import Literal -@flojoy(node_type="default") +@flojoy(node_type="default", deps={"scikit-image": "0.21.0"}) def SKLEARNIMAGE( img_key: Literal[ "astronaut", diff --git a/docs/nodes/GENERATORS/SAMPLE_IMAGES/SKLEARNIMAGE/examples/EX1/app.txt b/docs/nodes/GENERATORS/SAMPLE_IMAGES/SKLEARNIMAGE/examples/EX1/app.txt index 130f0e9634..3a332f46f3 100644 --- a/docs/nodes/GENERATORS/SAMPLE_IMAGES/SKLEARNIMAGE/examples/EX1/app.txt +++ b/docs/nodes/GENERATORS/SAMPLE_IMAGES/SKLEARNIMAGE/examples/EX1/app.txt @@ -89,12 +89,12 @@ "width": 150, "height": 150, "id": "OBJECT_DETECTION-4ba045ca-f490-4f8b-853c-9c38e1297062", - "type": "OBJECT_DETECTION", + "type": "AI_ML", "data": { "id": "OBJECT_DETECTION-4ba045ca-f490-4f8b-853c-9c38e1297062", "label": "OBJECT DETECTION", "func": "OBJECT_DETECTION", - "type": "OBJECT_DETECTION", + "type": "AI_ML", "ctrls": {}, "inputs": [ { @@ -125,49 +125,16 @@ }, "dragging": true }, - { - "width": 210, - "height": 130, - "id": "END-8d20d677-c761-43cf-8b24-cde84bd667b9", - "type": "TERMINATORS", - "data": { - "id": "END-8d20d677-c761-43cf-8b24-cde84bd667b9", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": true - }, - "position": { - "x": 1323.2910013935943, - "y": 20.726275145967804 - }, - "selected": true, - "positionAbsolute": { - "x": 1323.2910013935943, - "y": 20.726275145967804 - }, - "dragging": true - }, { "width": 225, "height": 226, "id": "IMAGE-455a09f6-8f20-4087-ab60-9f01c1b2427c", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "IMAGE-455a09f6-8f20-4087-ab60-9f01c1b2427c", "label": "IMAGE", "func": "IMAGE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -202,12 +169,12 @@ "width": 225, "height": 226, "id": "IMAGE-135a920b-87fa-4759-bfca-0b6ad739b406", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "IMAGE-135a920b-87fa-4759-bfca-0b6ad739b406", "label": "IMAGE 1", "func": "IMAGE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -247,13 +214,6 @@ "targetHandle": "default", "id": "reactflow__edge-SKLEARNIMAGE-874fdd2b-fea5-4dc6-8898-2905d070aca8default-OBJECT_DETECTION-4ba045ca-f490-4f8b-853c-9c38e1297062default" }, - { - "source": "OBJECT_DETECTION-4ba045ca-f490-4f8b-853c-9c38e1297062", - "sourceHandle": "default", - "target": "END-8d20d677-c761-43cf-8b24-cde84bd667b9", - "targetHandle": "default", - "id": "reactflow__edge-OBJECT_DETECTION-4ba045ca-f490-4f8b-853c-9c38e1297062default-END-8d20d677-c761-43cf-8b24-cde84bd667b9default" - }, { "source": "SKLEARNIMAGE-874fdd2b-fea5-4dc6-8898-2905d070aca8", "sourceHandle": "default", @@ -267,13 +227,6 @@ "target": "IMAGE-455a09f6-8f20-4087-ab60-9f01c1b2427c", "targetHandle": "default", "id": "reactflow__edge-OBJECT_DETECTION-4ba045ca-f490-4f8b-853c-9c38e1297062default-IMAGE-455a09f6-8f20-4087-ab60-9f01c1b2427cdefault" - }, - { - "source": "IMAGE-455a09f6-8f20-4087-ab60-9f01c1b2427c", - "sourceHandle": "default", - "target": "END-8d20d677-c761-43cf-8b24-cde84bd667b9", - "targetHandle": "default", - "id": "reactflow__edge-IMAGE-455a09f6-8f20-4087-ab60-9f01c1b2427cdefault-END-8d20d677-c761-43cf-8b24-cde84bd667b9default" } ], "viewport": { diff --git a/docs/nodes/GENERATORS/SIMULATIONS/BASIC_OSCILLATOR/examples/EX1/app.txt b/docs/nodes/GENERATORS/SIMULATIONS/BASIC_OSCILLATOR/examples/EX1/app.txt index 5ae7826ad9..9580ecd6ea 100644 --- a/docs/nodes/GENERATORS/SIMULATIONS/BASIC_OSCILLATOR/examples/EX1/app.txt +++ b/docs/nodes/GENERATORS/SIMULATIONS/BASIC_OSCILLATOR/examples/EX1/app.txt @@ -147,12 +147,12 @@ "width": 130, "height": 130, "id": "SINE-8aa9e195-26c1-4dd8-8e79-95a07e3b0f0e", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "SINE-8aa9e195-26c1-4dd8-8e79-95a07e3b0f0e", "label": "SINE", "func": "SINE", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "amplitude": { "type": "float", @@ -229,12 +229,12 @@ "width": 380, "height": 293, "id": "LINE-6e4cafcb-cabe-4fb8-8a29-9272f541955f", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-6e4cafcb-cabe-4fb8-8a29-9272f541955f", "label": "LINE", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -269,12 +269,12 @@ "width": 380, "height": 293, "id": "LINE-2d820744-6626-4ad9-8560-6b61fc8f2cab", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-2d820744-6626-4ad9-8560-6b61fc8f2cab", "label": "LINE 1", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -304,39 +304,6 @@ "y": 114.49352467764686 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-5e840d22-31bd-478c-aab6-a52f509edb1a", - "type": "TERMINATORS", - "data": { - "id": "END-5e840d22-31bd-478c-aab6-a52f509edb1a", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 2278.6723365080106, - "y": 250.1951820346673 - }, - "selected": false, - "positionAbsolute": { - "x": 2278.6723365080106, - "y": 250.1951820346673 - }, - "dragging": true } ], "edges": [ @@ -361,20 +328,6 @@ "target": "LINE-6e4cafcb-cabe-4fb8-8a29-9272f541955f", "targetHandle": "default", "id": "reactflow__edge-SINE-8aa9e195-26c1-4dd8-8e79-95a07e3b0f0edefault-LINE-6e4cafcb-cabe-4fb8-8a29-9272f541955fdefault" - }, - { - "source": "LINE-2d820744-6626-4ad9-8560-6b61fc8f2cab", - "sourceHandle": "default", - "target": "END-5e840d22-31bd-478c-aab6-a52f509edb1a", - "targetHandle": "default", - "id": "reactflow__edge-LINE-2d820744-6626-4ad9-8560-6b61fc8f2cabdefault-END-5e840d22-31bd-478c-aab6-a52f509edb1adefault" - }, - { - "source": "LINE-6e4cafcb-cabe-4fb8-8a29-9272f541955f", - "sourceHandle": "default", - "target": "END-5e840d22-31bd-478c-aab6-a52f509edb1a", - "targetHandle": "default", - "id": "reactflow__edge-LINE-6e4cafcb-cabe-4fb8-8a29-9272f541955fdefault-END-5e840d22-31bd-478c-aab6-a52f509edb1adefault" } ], "viewport": { diff --git a/docs/nodes/GENERATORS/SIMULATIONS/CONSTANT/a1-[autogen]/python_code.txt b/docs/nodes/GENERATORS/SIMULATIONS/CONSTANT/a1-[autogen]/python_code.txt index a6b491bbd2..5a0531074a 100644 --- a/docs/nodes/GENERATORS/SIMULATIONS/CONSTANT/a1-[autogen]/python_code.txt +++ b/docs/nodes/GENERATORS/SIMULATIONS/CONSTANT/a1-[autogen]/python_code.txt @@ -1,13 +1,23 @@ import numpy as np -from flojoy import flojoy, Vector, OrderedPair +from flojoy import DCNpArrayType, flojoy, Vector, OrderedPair from typing import Optional @flojoy -def CONSTANT(default: Optional[Vector] = None, constant: float = 3.0) -> OrderedPair: +def CONSTANT( + default: Optional[Vector | OrderedPair] = None, + constant: float = 3.0, + step: float = 1000, +) -> OrderedPair: - x = np.arange(0, 1000, 1) # type: ignore + x = np.arange(0, step, 1) if default: - x = default.v + match default: + case OrderedPair(): + x = default.y + case Vector(): + x = default.v + y = np.full(len(x), constant) + return OrderedPair(x=x, y=y) diff --git a/docs/nodes/GENERATORS/SIMULATIONS/CONSTANT/examples/EX1/app.txt b/docs/nodes/GENERATORS/SIMULATIONS/CONSTANT/examples/EX1/app.txt index a39c45058c..c058ac1335 100644 --- a/docs/nodes/GENERATORS/SIMULATIONS/CONSTANT/examples/EX1/app.txt +++ b/docs/nodes/GENERATORS/SIMULATIONS/CONSTANT/examples/EX1/app.txt @@ -2,125 +2,153 @@ "rfInstance": { "nodes": [ { - "width": 210, - "height": 130, - "id": "END-06a4da40-a0ae-44ad-873b-9b65d096880a", - "type": "TERMINATOR", + "width": 208, + "height": 96, + "id": "CONSTANT-9bfa0626-7664-41a7-b5bc-ec8f62540e35", + "type": "GENERATORS", "data": { - "id": "END-06a4da40-a0ae-44ad-873b-9b65d096880a", - "label": "END", - "func": "END", - "type": "TERMINATOR", - "ctrls": {}, + "id": "CONSTANT-9bfa0626-7664-41a7-b5bc-ec8f62540e35", + "label": "3.0", + "func": "CONSTANT", + "type": "GENERATORS", + "ctrls": { + "constant": { + "type": "float", + "default": 3, + "desc": null, + "functionName": "CONSTANT", + "param": "constant", + "value": 3 + }, + "step": { + "type": "int", + "default": 1000, + "desc": null, + "functionName": "CONSTANT", + "param": "step", + "value": 1000 + } + }, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Vector|OrderedPair", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair", + "desc": null + } + ], + "path": "PYTHON/nodes\\GENERATORS\\SIMULATIONS\\CONSTANT\\CONSTANT.py", "selected": false }, "position": { - "x": 1386.4285714285716, - "y": 595.4285714285714 + "x": -130.83989138018498, + "y": 13.422546284269998 }, "selected": false, "positionAbsolute": { - "x": 1386.4285714285716, - "y": 595.4285714285714 + "x": -130.83989138018498, + "y": 13.422546284269998 }, "dragging": true }, { - "width": 380, - "height": 293, - "id": "BIG_NUMBER-5d523fca-e2c2-4144-a091-d3d2e6482957", - "type": "PLOTLY_VISOR", + "width": 225, + "height": 226, + "id": "BIG_NUMBER-23d35b1d-f436-4201-8aa1-69c93ff7ed99", + "type": "VISUALIZERS", "data": { - "id": "BIG_NUMBER-5d523fca-e2c2-4144-a091-d3d2e6482957", + "id": "BIG_NUMBER-23d35b1d-f436-4201-8aa1-69c93ff7ed99", "label": "BIG NUMBER", "func": "BIG_NUMBER", - "type": "PLOTLY_VISOR", + "type": "VISUALIZERS", "ctrls": { "suffix": { + "type": "str", + "default": null, + "desc": null, "functionName": "BIG_NUMBER", "param": "suffix", "value": "" }, "prefix": { + "type": "str", + "default": null, + "desc": null, "functionName": "BIG_NUMBER", "param": "prefix", "value": "" }, - "relative_delta": { - "functionName": "BIG_NUMBER", - "param": "relative_delta", - "value": true - }, "title": { + "type": "str", + "default": null, + "desc": null, "functionName": "BIG_NUMBER", "param": "title", "value": "" + }, + "relative_delta": { + "type": "bool", + "default": true, + "desc": null, + "functionName": "BIG_NUMBER", + "param": "relative_delta", + "value": true } }, - "selected": false - }, - "position": { - "x": 797.9265644225578, - "y": 508.7311569539935 - }, - "selected": false, - "positionAbsolute": { - "x": 797.9265644225578, - "y": 508.7311569539935 - }, - "dragging": true - }, - { - "width": 130, - "height": 130, - "id": "CONSTANT-910cbc4f-ec37-4d77-878a-643d40f38b84", - "type": "SIMULATION", - "data": { - "id": "CONSTANT-910cbc4f-ec37-4d77-878a-643d40f38b84", - "label": "2.0", - "func": "CONSTANT", - "type": "SIMULATION", - "ctrls": { - "constant": { - "functionName": "CONSTANT", - "param": "constant", - "value": "2.0" + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair|Scalar", + "multiple": false, + "desc": null } - }, + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": null + } + ], + "path": "PYTHON/nodes\\VISUALIZERS\\PLOTLY\\BIG_NUMBER\\BIG_NUMBER.py", "selected": false }, "position": { - "x": 497.9265644225577, - "y": 591.5882998111363 + "x": 294.1748962833931, + "y": -62.1556648169163 }, "selected": false, "positionAbsolute": { - "x": 497.9265644225577, - "y": 591.5882998111363 + "x": 294.1748962833931, + "y": -62.1556648169163 }, "dragging": true } ], "edges": [ { - "source": "BIG_NUMBER-5d523fca-e2c2-4144-a091-d3d2e6482957", - "sourceHandle": "main", - "target": "END-06a4da40-a0ae-44ad-873b-9b65d096880a", - "targetHandle": "END", - "id": "reactflow__edge-BIG_NUMBER-5d523fca-e2c2-4144-a091-d3d2e6482957main-END-06a4da40-a0ae-44ad-873b-9b65d096880aEND" - }, - { - "source": "CONSTANT-910cbc4f-ec37-4d77-878a-643d40f38b84", - "sourceHandle": "main", - "target": "BIG_NUMBER-5d523fca-e2c2-4144-a091-d3d2e6482957", - "targetHandle": "BIG_NUMBER", - "id": "reactflow__edge-CONSTANT-910cbc4f-ec37-4d77-878a-643d40f38b84main-BIG_NUMBER-5d523fca-e2c2-4144-a091-d3d2e6482957BIG_NUMBER" + "source": "CONSTANT-9bfa0626-7664-41a7-b5bc-ec8f62540e35", + "sourceHandle": "default", + "target": "BIG_NUMBER-23d35b1d-f436-4201-8aa1-69c93ff7ed99", + "targetHandle": "default", + "id": "reactflow__edge-CONSTANT-9bfa0626-7664-41a7-b5bc-ec8f62540e35default-BIG_NUMBER-23d35b1d-f436-4201-8aa1-69c93ff7ed99default" } ], "viewport": { - "x": 383.94248946966945, - "y": 121.85910915060867, - "zoom": 1.1608238532718647 + "x": 606.4472645567363, + "y": 234.63130388602087, + "zoom": 0.9186369849831518 } }, "ctrlsManifest": [ diff --git a/docs/nodes/GENERATORS/SIMULATIONS/FEEDBACK/examples/EX1/app.txt b/docs/nodes/GENERATORS/SIMULATIONS/FEEDBACK/examples/EX1/app.txt index 5cbe22856f..5048a321fd 100644 --- a/docs/nodes/GENERATORS/SIMULATIONS/FEEDBACK/examples/EX1/app.txt +++ b/docs/nodes/GENERATORS/SIMULATIONS/FEEDBACK/examples/EX1/app.txt @@ -2,109 +2,91 @@ "rfInstance": { "nodes": [ { - "width": 210, - "height": 130, - "id": "END-6555aed9-4f39-456f-94bb-2fae298ae88f", - "type": "TERMINATORS", + "width": 380, + "height": 293, + "id": "BIG_NUMBER-e4942bf1-f23a-4344-80eb-c166dabb2dd2", + "type": "VISUALIZERS", "data": { - "id": "END-6555aed9-4f39-456f-94bb-2fae298ae88f", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, + "id": "BIG_NUMBER-e4942bf1-f23a-4344-80eb-c166dabb2dd2", + "label": "BIG NUMBER", + "func": "BIG_NUMBER", + "type": "VISUALIZERS", + "ctrls": { + "suffix": { + "type": "str", + "default": null, + "functionName": "BIG_NUMBER", + "param": "suffix", + "value": "" + }, + "prefix": { + "type": "str", + "default": null, + "functionName": "BIG_NUMBER", + "param": "prefix", + "value": "" + }, + "title": { + "type": "str", + "default": null, + "functionName": "BIG_NUMBER", + "param": "title", + "value": "" + }, + "relative_delta": { + "type": "bool", + "default": true, + "functionName": "BIG_NUMBER", + "param": "relative_delta", + "value": true + } + }, "inputs": [ { "name": "default", "id": "default", - "type": "Any", + "type": "OrderedPair", "multiple": false } ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", - "selected": false - }, - "position": { - "x": 201.3357255930201, - "y": 557.2980747810793 - }, - "selected": false, - "positionAbsolute": { - "x": 201.3357255930201, - "y": 557.2980747810793 - }, - "dragging": true - }, - { - "width": 150, - "height": 150, - "id": "LINSPACE-69bc9f1e-8cc8-4878-b6a4-d9a06dd33a9a", - "type": "default", - "data": { - "id": "LINSPACE-69bc9f1e-8cc8-4878-b6a4-d9a06dd33a9a", - "label": "LINSPACE", - "func": "LINSPACE", - "type": "default", - "ctrls": { - "start": { - "type": "float", - "default": 10, - "functionName": "LINSPACE", - "param": "start", - "value": 10 - }, - "end": { - "type": "float", - "default": 0, - "functionName": "LINSPACE", - "param": "end", - "value": 0 - }, - "step": { - "type": "int", - "default": 1000, - "functionName": "LINSPACE", - "param": "step", - "value": 1000 - } - }, "outputs": [ { "name": "default", "id": "default", - "type": "OrderedPair" + "type": "Plotly" } ], - "path": "PYTHON/nodes\\GENERATORS\\SIMULATIONS\\LINSPACE\\LINSPACE.py", + "path": "PYTHON/nodes\\VISUALIZERS\\PLOTLY\\BIG_NUMBER\\BIG_NUMBER.py", "selected": false }, "position": { - "x": -452.9499886926942, - "y": 298.72664620965077 + "x": 627.0045699600352, + "y": 110.02353935715365 }, "selected": false, "positionAbsolute": { - "x": -452.9499886926942, - "y": 298.72664620965077 + "x": 627.0045699600352, + "y": 110.02353935715365 }, "dragging": true }, { - "width": 150, - "height": 150, - "id": "GOTO-c29d54b5-4478-42da-b59b-5e5b190a2ee6", - "type": "LOOPS", + "width": 208, + "height": 96, + "id": "FEEDBACK-f81e0c07-98f4-4f31-b5b3-7a32118d139e", + "type": "GENERATORS", "data": { - "id": "GOTO-c29d54b5-4478-42da-b59b-5e5b190a2ee6", - "label": "GOTO", - "func": "GOTO", - "type": "LOOPS", + "id": "FEEDBACK-f81e0c07-98f4-4f31-b5b3-7a32118d139e", + "label": "FEEDBACK", + "func": "FEEDBACK", + "type": "GENERATORS", "ctrls": { - "goto_node_id": { + "referred_node": { "type": "NodeReference", "default": "", - "functionName": "GOTO", - "param": "goto_node_id", - "value": "LOOP-d294c908-88a7-4f19-8446-9a68061e1f14" + "functionName": "FEEDBACK", + "param": "referred_node", + "value": "MULTIPLY-c463c154-d47a-4ed4-bc8d-ef5e6d237a6a" } }, "inputs": [ @@ -115,34 +97,42 @@ "multiple": false } ], - "path": "PYTHON/nodes\\LOGIC_GATES\\LOOPS\\GOTO\\GOTO.py", + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Any" + } + ], + "path": "PYTHON/nodes\\GENERATORS\\SIMULATIONS\\FEEDBACK\\FEEDBACK.py", "selected": false }, "position": { - "x": 842.7642970215916, - "y": 378.7266462096507 + "x": 341.09724320819623, + "y": 92.35595321700652 }, "selected": false, "positionAbsolute": { - "x": 842.7642970215916, - "y": 378.7266462096507 + "x": 341.09724320819623, + "y": 92.35595321700652 }, "dragging": true }, { - "width": 150, - "height": 150, - "id": "LOOP-d294c908-88a7-4f19-8446-9a68061e1f14", - "type": "LOOPS", + "width": 96, + "height": 96, + "id": "LOOP-053d8521-fb3b-4c7d-85d0-9785230aeb2f", + "type": "LOGIC_GATES", "data": { - "id": "LOOP-d294c908-88a7-4f19-8446-9a68061e1f14", + "id": "LOOP-053d8521-fb3b-4c7d-85d0-9785230aeb2f", "label": "LOOP", "func": "LOOP", - "type": "LOOPS", + "type": "LOGIC_GATES", "ctrls": { "num_loops": { "type": "int", "default": -1, + "desc": "number of times to iterate through body nodes default is `-1` meaning infinity.", "functionName": "LOOP", "param": "num_loops", "value": "5" @@ -153,364 +143,254 @@ "name": "default", "id": "default", "type": "Any", - "multiple": false + "multiple": false, + "desc": null } ], "outputs": [ { "name": "body", "id": "body", - "type": "Any" + "type": "Any", + "desc": null }, { "name": "end", "id": "end", - "type": "Any" + "type": "Any", + "desc": null } ], "path": "PYTHON/nodes\\LOGIC_GATES\\LOOPS\\LOOP\\LOOP.py", "selected": false }, "position": { - "x": -147.23570297840854, - "y": 294.4409319239364 + "x": -175.2242470174267, + "y": 223.309405138469 }, "selected": false, "positionAbsolute": { - "x": -147.23570297840854, - "y": 294.4409319239364 + "x": -175.2242470174267, + "y": 223.309405138469 }, "dragging": true }, { - "width": 130, - "height": 130, - "id": "CONSTANT-b7112c9c-029c-4899-bd7f-ae304c690697", - "type": "SIMULATIONS", + "width": 208, + "height": 96, + "id": "CONSTANT-8abbba8b-424f-4b20-888f-1cca9b62f89f", + "type": "GENERATORS", "data": { - "id": "CONSTANT-b7112c9c-029c-4899-bd7f-ae304c690697", - "label": "2.0", + "id": "CONSTANT-8abbba8b-424f-4b20-888f-1cca9b62f89f", + "label": "2", "func": "CONSTANT", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "constant": { "type": "float", "default": 3, + "desc": null, "functionName": "CONSTANT", "param": "constant", - "value": "2.0" + "value": "2" + }, + "step": { + "type": "int", + "default": 1000, + "desc": null, + "functionName": "CONSTANT", + "param": "step", + "value": 1000 } }, "inputs": [ { "name": "default", "id": "default", - "type": "OrderedPair", - "multiple": false + "type": "Vector|OrderedPair", + "multiple": false, + "desc": null } ], "outputs": [ { "name": "default", "id": "default", - "type": "OrderedPair" - } - ], - "path": "PYTHON/nodes\\GENERATORS\\SIMULATIONS\\CONSTANT\\CONSTANT.py", - "selected": false - }, - "position": { - "x": 199.90715416444874, - "y": 361.5837890667936 - }, - "selected": false, - "positionAbsolute": { - "x": 199.90715416444874, - "y": 361.5837890667936 - }, - "dragging": true - }, - { - "width": 99, - "height": 130, - "id": "MULTIPLY-7682e26d-4112-44b3-9c19-c48ddce3bdbe", - "type": "ARITHMETIC", - "data": { - "id": "MULTIPLY-7682e26d-4112-44b3-9c19-c48ddce3bdbe", - "label": "MULTIPLY", - "func": "MULTIPLY", - "type": "ARITHMETIC", - "ctrls": {}, - "inputs": [ - { - "name": "a", - "id": "a", - "type": "OrderedPair", - "multiple": false - }, - { - "name": "b", - "id": "b", "type": "OrderedPair", - "multiple": false + "desc": null } ], - "outputs": [ - { - "name": "default", - "id": "default", - "type": "OrderedPair" - } - ], - "path": "PYTHON/nodes\\TRANSFORMERS\\ARITHMETIC\\MULTIPLY\\MULTIPLY.py", + "path": "PYTHON/nodes\\GENERATORS\\SIMULATIONS\\CONSTANT\\CONSTANT.py", "selected": false }, "position": { - "x": 599.9071541644489, - "y": 361.5837890667936 + "x": 50.92457046813533, + "y": 305.3771474020375 }, "selected": false, "positionAbsolute": { - "x": 599.9071541644489, - "y": 361.5837890667936 + "x": 50.92457046813533, + "y": 305.3771474020375 }, "dragging": true }, { - "width": 380, - "height": 293, - "id": "BIG_NUMBER-e4942bf1-f23a-4344-80eb-c166dabb2dd2", - "type": "PLOTLY", + "width": 208, + "height": 96, + "id": "CONSTANT-449b5a47-6d72-4f30-a239-8b3e2ba721bb", + "type": "GENERATORS", "data": { - "id": "BIG_NUMBER-e4942bf1-f23a-4344-80eb-c166dabb2dd2", - "label": "BIG NUMBER", - "func": "BIG_NUMBER", - "type": "PLOTLY", + "id": "CONSTANT-449b5a47-6d72-4f30-a239-8b3e2ba721bb", + "label": "4", + "func": "CONSTANT", + "type": "GENERATORS", "ctrls": { - "suffix": { - "type": "str", - "default": null, - "functionName": "BIG_NUMBER", - "param": "suffix", - "value": "" - }, - "prefix": { - "type": "str", - "default": null, - "functionName": "BIG_NUMBER", - "param": "prefix", - "value": "" - }, - "title": { - "type": "str", - "default": null, - "functionName": "BIG_NUMBER", - "param": "title", - "value": "" + "constant": { + "type": "float", + "default": 3, + "desc": null, + "functionName": "CONSTANT", + "param": "constant", + "value": "4" }, - "relative_delta": { - "type": "bool", - "default": true, - "functionName": "BIG_NUMBER", - "param": "relative_delta", - "value": true - } - }, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "OrderedPair", - "multiple": false - } - ], - "outputs": [ - { - "name": "default", - "id": "default", - "type": "Plotly" - } - ], - "path": "PYTHON/nodes\\VISUALIZERS\\PLOTLY\\BIG_NUMBER\\BIG_NUMBER.py", - "selected": true - }, - "position": { - "x": 659.9071541644486, - "y": 17.298074781079322 - }, - "selected": true, - "positionAbsolute": { - "x": 659.9071541644486, - "y": 17.298074781079322 - }, - "dragging": true - }, - { - "width": 130, - "height": 130, - "id": "FEEDBACK-f81e0c07-98f4-4f31-b5b3-7a32118d139e", - "type": "SIMULATIONS", - "data": { - "id": "FEEDBACK-f81e0c07-98f4-4f31-b5b3-7a32118d139e", - "label": "FEEDBACK", - "func": "FEEDBACK", - "type": "SIMULATIONS", - "ctrls": { - "referred_node": { - "type": "NodeReference", - "default": "", - "functionName": "FEEDBACK", - "param": "referred_node", - "value": "MULTIPLY-7682e26d-4112-44b3-9c19-c48ddce3bdbe" + "step": { + "type": "int", + "default": 1000, + "desc": null, + "functionName": "CONSTANT", + "param": "step", + "value": 1000 } }, "inputs": [ { "name": "default", "id": "default", - "type": "Any", - "multiple": false + "type": "Vector|OrderedPair", + "multiple": false, + "desc": null } ], "outputs": [ { "name": "default", "id": "default", - "type": "Any" + "type": "OrderedPair", + "desc": null } ], - "path": "PYTHON/nodes\\GENERATORS\\SIMULATIONS\\FEEDBACK\\FEEDBACK.py", + "path": "PYTHON/nodes\\GENERATORS\\SIMULATIONS\\CONSTANT\\CONSTANT.py", "selected": false }, "position": { - "x": 357.0500113073058, - "y": 160.15521763822215 + "x": 30.577110066478696, + "y": 130.70166876803648 }, "selected": false, "positionAbsolute": { - "x": 357.0500113073058, - "y": 160.15521763822215 + "x": 30.577110066478696, + "y": 130.70166876803648 }, "dragging": true }, { - "width": 130, - "height": 130, - "id": "CONSTANT-2c2b2a67-fa77-41db-9f40-f6bad42c460b", - "type": "SIMULATIONS", + "width": 72, + "height": 72, + "id": "MULTIPLY-c463c154-d47a-4ed4-bc8d-ef5e6d237a6a", + "type": "ARITHMETIC", "data": { - "id": "CONSTANT-2c2b2a67-fa77-41db-9f40-f6bad42c460b", - "label": "4", - "func": "CONSTANT", - "type": "SIMULATIONS", - "ctrls": { - "constant": { - "type": "float", - "default": 3, - "functionName": "CONSTANT", - "param": "constant", - "value": "4" - } - }, + "id": "MULTIPLY-c463c154-d47a-4ed4-bc8d-ef5e6d237a6a", + "label": "MULTIPLY", + "func": "MULTIPLY", + "type": "ARITHMETIC", + "ctrls": {}, "inputs": [ { - "name": "default", - "id": "default", - "type": "OrderedPair", - "multiple": false + "name": "a", + "id": "a", + "type": "OrderedPair|Scalar|Vector", + "multiple": false, + "desc": null + }, + { + "name": "b", + "id": "b", + "type": "OrderedPair|Scalar|Vector", + "multiple": true, + "desc": null } ], "outputs": [ { "name": "default", "id": "default", - "type": "OrderedPair" + "type": "OrderedPair|Scalar|Vector", + "desc": null } ], - "path": "PYTHON/nodes\\GENERATORS\\SIMULATIONS\\CONSTANT\\CONSTANT.py", + "path": "PYTHON/nodes\\TRANSFORMERS\\ARITHMETIC\\MULTIPLY\\MULTIPLY.py", "selected": false }, "position": { - "x": 122.76429702159146, - "y": 161.5837890667936 + "x": 475.6559607373604, + "y": 304.0731615929962 }, "selected": false, "positionAbsolute": { - "x": 122.76429702159146, - "y": 161.5837890667936 + "x": 475.6559607373604, + "y": 304.0731615929962 }, "dragging": true } ], "edges": [ { - "source": "LINSPACE-69bc9f1e-8cc8-4878-b6a4-d9a06dd33a9a", + "source": "FEEDBACK-f81e0c07-98f4-4f31-b5b3-7a32118d139e", "sourceHandle": "default", - "target": "LOOP-d294c908-88a7-4f19-8446-9a68061e1f14", + "target": "BIG_NUMBER-e4942bf1-f23a-4344-80eb-c166dabb2dd2", "targetHandle": "default", - "id": "reactflow__edge-LINSPACE-69bc9f1e-8cc8-4878-b6a4-d9a06dd33a9adefault-LOOP-d294c908-88a7-4f19-8446-9a68061e1f14default" + "id": "reactflow__edge-FEEDBACK-f81e0c07-98f4-4f31-b5b3-7a32118d139edefault-BIG_NUMBER-e4942bf1-f23a-4344-80eb-c166dabb2dd2default" }, { - "source": "LOOP-d294c908-88a7-4f19-8446-9a68061e1f14", + "source": "LOOP-053d8521-fb3b-4c7d-85d0-9785230aeb2f", "sourceHandle": "body", - "target": "CONSTANT-b7112c9c-029c-4899-bd7f-ae304c690697", + "target": "CONSTANT-449b5a47-6d72-4f30-a239-8b3e2ba721bb", "targetHandle": "default", - "id": "reactflow__edge-LOOP-d294c908-88a7-4f19-8446-9a68061e1f14body-CONSTANT-b7112c9c-029c-4899-bd7f-ae304c690697default" + "id": "reactflow__edge-LOOP-053d8521-fb3b-4c7d-85d0-9785230aeb2fbody-CONSTANT-449b5a47-6d72-4f30-a239-8b3e2ba721bbdefault" }, { - "source": "LOOP-d294c908-88a7-4f19-8446-9a68061e1f14", - "sourceHandle": "end", - "target": "END-6555aed9-4f39-456f-94bb-2fae298ae88f", + "source": "LOOP-053d8521-fb3b-4c7d-85d0-9785230aeb2f", + "sourceHandle": "body", + "target": "CONSTANT-8abbba8b-424f-4b20-888f-1cca9b62f89f", "targetHandle": "default", - "id": "reactflow__edge-LOOP-d294c908-88a7-4f19-8446-9a68061e1f14end-END-6555aed9-4f39-456f-94bb-2fae298ae88fdefault" + "id": "reactflow__edge-LOOP-053d8521-fb3b-4c7d-85d0-9785230aeb2fbody-CONSTANT-8abbba8b-424f-4b20-888f-1cca9b62f89fdefault" }, { - "source": "FEEDBACK-f81e0c07-98f4-4f31-b5b3-7a32118d139e", + "source": "CONSTANT-449b5a47-6d72-4f30-a239-8b3e2ba721bb", "sourceHandle": "default", - "target": "BIG_NUMBER-e4942bf1-f23a-4344-80eb-c166dabb2dd2", + "target": "FEEDBACK-f81e0c07-98f4-4f31-b5b3-7a32118d139e", "targetHandle": "default", - "id": "reactflow__edge-FEEDBACK-f81e0c07-98f4-4f31-b5b3-7a32118d139edefault-BIG_NUMBER-e4942bf1-f23a-4344-80eb-c166dabb2dd2default" - }, - { - "source": "CONSTANT-b7112c9c-029c-4899-bd7f-ae304c690697", - "sourceHandle": "default", - "target": "MULTIPLY-7682e26d-4112-44b3-9c19-c48ddce3bdbe", - "targetHandle": "b", - "id": "reactflow__edge-CONSTANT-b7112c9c-029c-4899-bd7f-ae304c690697default-MULTIPLY-7682e26d-4112-44b3-9c19-c48ddce3bdbeb" + "id": "reactflow__edge-CONSTANT-449b5a47-6d72-4f30-a239-8b3e2ba721bbdefault-FEEDBACK-f81e0c07-98f4-4f31-b5b3-7a32118d139edefault" }, { "source": "FEEDBACK-f81e0c07-98f4-4f31-b5b3-7a32118d139e", "sourceHandle": "default", - "target": "MULTIPLY-7682e26d-4112-44b3-9c19-c48ddce3bdbe", + "target": "MULTIPLY-c463c154-d47a-4ed4-bc8d-ef5e6d237a6a", "targetHandle": "a", - "id": "reactflow__edge-FEEDBACK-f81e0c07-98f4-4f31-b5b3-7a32118d139edefault-MULTIPLY-7682e26d-4112-44b3-9c19-c48ddce3bdbea" - }, - { - "source": "MULTIPLY-7682e26d-4112-44b3-9c19-c48ddce3bdbe", - "sourceHandle": "default", - "target": "GOTO-c29d54b5-4478-42da-b59b-5e5b190a2ee6", - "targetHandle": "default", - "id": "reactflow__edge-MULTIPLY-7682e26d-4112-44b3-9c19-c48ddce3bdbedefault-GOTO-c29d54b5-4478-42da-b59b-5e5b190a2ee6default" - }, - { - "source": "LOOP-d294c908-88a7-4f19-8446-9a68061e1f14", - "sourceHandle": "body", - "target": "CONSTANT-2c2b2a67-fa77-41db-9f40-f6bad42c460b", - "targetHandle": "default", - "id": "reactflow__edge-LOOP-d294c908-88a7-4f19-8446-9a68061e1f14body-CONSTANT-2c2b2a67-fa77-41db-9f40-f6bad42c460bdefault" + "id": "reactflow__edge-FEEDBACK-f81e0c07-98f4-4f31-b5b3-7a32118d139edefault-MULTIPLY-c463c154-d47a-4ed4-bc8d-ef5e6d237a6aa" }, { - "source": "CONSTANT-2c2b2a67-fa77-41db-9f40-f6bad42c460b", + "source": "CONSTANT-8abbba8b-424f-4b20-888f-1cca9b62f89f", "sourceHandle": "default", - "target": "FEEDBACK-f81e0c07-98f4-4f31-b5b3-7a32118d139e", - "targetHandle": "default", - "id": "reactflow__edge-CONSTANT-2c2b2a67-fa77-41db-9f40-f6bad42c460bdefault-FEEDBACK-f81e0c07-98f4-4f31-b5b3-7a32118d139edefault" + "target": "MULTIPLY-c463c154-d47a-4ed4-bc8d-ef5e6d237a6a", + "targetHandle": "b", + "id": "reactflow__edge-CONSTANT-8abbba8b-424f-4b20-888f-1cca9b62f89fdefault-MULTIPLY-c463c154-d47a-4ed4-bc8d-ef5e6d237a6ab" } ], "viewport": { - "x": -296.35399545928726, - "y": 66.8470830817738, - "zoom": 0.8744723800359967 + "x": 606.4472645567363, + "y": 234.63130388602087, + "zoom": 0.9186369849831518 } }, "ctrlsManifest": [ diff --git a/docs/nodes/GENERATORS/SIMULATIONS/LINSPACE/a1-[autogen]/docstring.txt b/docs/nodes/GENERATORS/SIMULATIONS/LINSPACE/a1-[autogen]/docstring.txt index e69de29bb2..17b52f037f 100644 --- a/docs/nodes/GENERATORS/SIMULATIONS/LINSPACE/a1-[autogen]/docstring.txt +++ b/docs/nodes/GENERATORS/SIMULATIONS/LINSPACE/a1-[autogen]/docstring.txt @@ -0,0 +1,17 @@ +The LINSPACE node generates data spaced evenly between two points. + It uses the numpy function linspace. It is useful for generating an x axis + for ordered pair type data. + + Parameters + ---------- + start: float + The start point of the data + end: float + The end point of the data. + step: float + The number of points in the vector. + + Returns + ------- + Vector + The vector between start and end with step number of points. diff --git a/docs/nodes/GENERATORS/SIMULATIONS/LINSPACE/examples/EX1/app.txt b/docs/nodes/GENERATORS/SIMULATIONS/LINSPACE/examples/EX1/app.txt index 8c9be8c180..2db357aae0 100644 --- a/docs/nodes/GENERATORS/SIMULATIONS/LINSPACE/examples/EX1/app.txt +++ b/docs/nodes/GENERATORS/SIMULATIONS/LINSPACE/examples/EX1/app.txt @@ -42,13 +42,13 @@ } ], "path": "PYTHON/nodes/GENERATORS/SIMULATIONS/LINSPACE/LINSPACE.py", - "selected": true + "selected": false }, "position": { "x": 1207.3462867113103, "y": 296.9547453014071 }, - "selected": true, + "selected": false, "positionAbsolute": { "x": 1207.3462867113103, "y": 296.9547453014071 @@ -59,12 +59,12 @@ "width": 225, "height": 226, "id": "SCATTER-3d3c8af8-5efd-4d15-af93-4703e1146018", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "SCATTER-3d3c8af8-5efd-4d15-af93-4703e1146018", "label": "SCATTER", "func": "SCATTER", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -94,39 +94,6 @@ "y": 263.2004437204553 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-d09bd3ca-612e-4470-ad39-4986c51b385d", - "type": "TERMINATORS", - "data": { - "id": "END-d09bd3ca-612e-4470-ad39-4986c51b385d", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 1774.4487483753492, - "y": 291.3429049728291 - }, - "selected": false, - "positionAbsolute": { - "x": 1774.4487483753492, - "y": 291.3429049728291 - }, - "dragging": true } ], "edges": [ @@ -136,13 +103,6 @@ "target": "SCATTER-3d3c8af8-5efd-4d15-af93-4703e1146018", "targetHandle": "default", "id": "reactflow__edge-LINSPACE-03f57daa-59f9-4a59-9fbd-7a15a4878b6cdefault-SCATTER-3d3c8af8-5efd-4d15-af93-4703e1146018default" - }, - { - "source": "SCATTER-3d3c8af8-5efd-4d15-af93-4703e1146018", - "sourceHandle": "default", - "target": "END-d09bd3ca-612e-4470-ad39-4986c51b385d", - "targetHandle": "default", - "id": "reactflow__edge-SCATTER-3d3c8af8-5efd-4d15-af93-4703e1146018default-END-d09bd3ca-612e-4470-ad39-4986c51b385ddefault" } ], "viewport": { diff --git a/docs/nodes/GENERATORS/SIMULATIONS/MATRIX/a1-[autogen]/python_code.txt b/docs/nodes/GENERATORS/SIMULATIONS/MATRIX/a1-[autogen]/python_code.txt index 03c02e5f26..38655ab7a0 100644 --- a/docs/nodes/GENERATORS/SIMULATIONS/MATRIX/a1-[autogen]/python_code.txt +++ b/docs/nodes/GENERATORS/SIMULATIONS/MATRIX/a1-[autogen]/python_code.txt @@ -2,7 +2,7 @@ import numpy as np from flojoy import flojoy, Matrix -@flojoy +@flojoy(node_type="default") def MATRIX(row: int = 2, column: int = 2) -> Matrix: diff --git a/docs/nodes/GENERATORS/SIMULATIONS/MATRIX/examples/EX1/app.txt b/docs/nodes/GENERATORS/SIMULATIONS/MATRIX/examples/EX1/app.txt index 9cdce5e75a..83474a70d9 100644 --- a/docs/nodes/GENERATORS/SIMULATIONS/MATRIX/examples/EX1/app.txt +++ b/docs/nodes/GENERATORS/SIMULATIONS/MATRIX/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 130, "height": 130, "id": "MATRIX-957da30a-8624-44d8-93fb-51ec90f92485", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "MATRIX-957da30a-8624-44d8-93fb-51ec90f92485", "label": "MATRIX", "func": "MATRIX", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "row": { "type": "int", @@ -52,12 +52,12 @@ "width": 240, "height": 260, "id": "MATRIX_VIEW-33a3d38e-93b1-4e33-9789-9f457d04498a", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "MATRIX_VIEW-33a3d38e-93b1-4e33-9789-9f457d04498a", "label": "MATRIX VIEW", "func": "MATRIX_VIEW", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -75,51 +75,18 @@ } ], "path": "PYTHON/nodes\\VISUALIZERS\\DATA_STRUCTURE\\MATRIX_VIEW\\MATRIX_VIEW.py", - "selected": true + "selected": false }, "position": { "x": 611.6471944648578, "y": 95.620522779557 }, - "selected": true, + "selected": false, "positionAbsolute": { "x": 611.6471944648578, "y": 95.620522779557 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-7c8843a3-119f-4f4e-83b1-0d4e55d4cbd5", - "type": "TERMINATORS", - "data": { - "id": "END-7c8843a3-119f-4f4e-83b1-0d4e55d4cbd5", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", - "selected": false - }, - "position": { - "x": 1123.2153146260518, - "y": 164.1334864111738 - }, - "selected": false, - "positionAbsolute": { - "x": 1123.2153146260518, - "y": 164.1334864111738 - }, - "dragging": true } ], "edges": [ @@ -129,13 +96,6 @@ "target": "MATRIX_VIEW-33a3d38e-93b1-4e33-9789-9f457d04498a", "targetHandle": "default", "id": "reactflow__edge-MATRIX-957da30a-8624-44d8-93fb-51ec90f92485default-MATRIX_VIEW-33a3d38e-93b1-4e33-9789-9f457d04498adefault" - }, - { - "source": "MATRIX_VIEW-33a3d38e-93b1-4e33-9789-9f457d04498a", - "sourceHandle": "default", - "target": "END-7c8843a3-119f-4f4e-83b1-0d4e55d4cbd5", - "targetHandle": "default", - "id": "reactflow__edge-MATRIX_VIEW-33a3d38e-93b1-4e33-9789-9f457d04498adefault-END-7c8843a3-119f-4f4e-83b1-0d4e55d4cbd5default" } ], "viewport": { diff --git a/docs/nodes/GENERATORS/SIMULATIONS/RAND/examples/EX1/app.txt b/docs/nodes/GENERATORS/SIMULATIONS/RAND/examples/EX1/app.txt index a4a362a6c3..cc4910b1e8 100644 --- a/docs/nodes/GENERATORS/SIMULATIONS/RAND/examples/EX1/app.txt +++ b/docs/nodes/GENERATORS/SIMULATIONS/RAND/examples/EX1/app.txt @@ -59,12 +59,12 @@ "width": 250, "height": 159, "id": "HISTOGRAM-c5469532-dd28-4465-b8b0-524174db86e4", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "HISTOGRAM-c5469532-dd28-4465-b8b0-524174db86e4", "label": "HISTOGRAM", "func": "HISTOGRAM", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -95,49 +95,16 @@ }, "dragging": true }, - { - "width": 210, - "height": 130, - "id": "END-ebbe9c0f-1a6d-4781-9441-be59a8e49036", - "type": "TERMINATORS", - "data": { - "id": "END-ebbe9c0f-1a6d-4781-9441-be59a8e49036", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 1375.1520235520945, - "y": 103.4971422058673 - }, - "selected": false, - "positionAbsolute": { - "x": 1375.1520235520945, - "y": 103.4971422058673 - }, - "dragging": true - }, { "width": 130, "height": 130, "id": "RAND-1fe43d0a-6b15-49d0-b6e0-35c61744a60a", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "RAND-1fe43d0a-6b15-49d0-b6e0-35c61744a60a", "label": "RAND", "func": "RAND", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "distribution": { "type": "select", @@ -220,12 +187,12 @@ "width": 130, "height": 130, "id": "RAND-e09e675f-ccaf-44b3-8842-6cea418c4b00", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "RAND-e09e675f-ccaf-44b3-8842-6cea418c4b00", "label": "RAND 1", "func": "RAND", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "distribution": { "type": "select", @@ -291,13 +258,13 @@ } ], "path": "PYTHON/nodes/GENERATORS/SIMULATIONS/RAND/RAND.py", - "selected": true + "selected": false }, "position": { "x": 385.163294287524, "y": 328.61362457174704 }, - "selected": true, + "selected": false, "positionAbsolute": { "x": 385.163294287524, "y": 328.61362457174704 @@ -308,12 +275,12 @@ "width": 225, "height": 226, "id": "BIG_NUMBER-59ecc8d4-f674-4af7-869f-f429f0b1c266", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "BIG_NUMBER-59ecc8d4-f674-4af7-869f-f429f0b1c266", "label": "BIG NUMBER", "func": "BIG_NUMBER", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": { "suffix": { "type": "str", @@ -375,13 +342,6 @@ } ], "edges": [ - { - "source": "HISTOGRAM-c5469532-dd28-4465-b8b0-524174db86e4", - "sourceHandle": "default", - "target": "END-ebbe9c0f-1a6d-4781-9441-be59a8e49036", - "targetHandle": "default", - "id": "reactflow__edge-HISTOGRAM-c5469532-dd28-4465-b8b0-524174db86e4default-END-ebbe9c0f-1a6d-4781-9441-be59a8e49036default" - }, { "source": "LINSPACE-cc55781a-14c8-4405-8fd1-0157351b3486", "sourceHandle": "default", @@ -402,13 +362,6 @@ "target": "BIG_NUMBER-59ecc8d4-f674-4af7-869f-f429f0b1c266", "targetHandle": "default", "id": "reactflow__edge-RAND-e09e675f-ccaf-44b3-8842-6cea418c4b00default-BIG_NUMBER-59ecc8d4-f674-4af7-869f-f429f0b1c266default" - }, - { - "source": "BIG_NUMBER-59ecc8d4-f674-4af7-869f-f429f0b1c266", - "sourceHandle": "default", - "target": "END-ebbe9c0f-1a6d-4781-9441-be59a8e49036", - "targetHandle": "default", - "id": "reactflow__edge-BIG_NUMBER-59ecc8d4-f674-4af7-869f-f429f0b1c266default-END-ebbe9c0f-1a6d-4781-9441-be59a8e49036default" } ], "viewport": { diff --git a/docs/nodes/GENERATORS/SIMULATIONS/SECOND_ORDER_SYSTEM/examples/EX1/app.txt b/docs/nodes/GENERATORS/SIMULATIONS/SECOND_ORDER_SYSTEM/examples/EX1/app.txt index 2d25aaeeff..2ebbfa25dd 100644 --- a/docs/nodes/GENERATORS/SIMULATIONS/SECOND_ORDER_SYSTEM/examples/EX1/app.txt +++ b/docs/nodes/GENERATORS/SIMULATIONS/SECOND_ORDER_SYSTEM/examples/EX1/app.txt @@ -2,109 +2,15 @@ "rfInstance": { "nodes": [ { - "width": 150, - "height": 150, - "id": "LOOP-67e6ac26-cc23-4159-8659-ef0577421ee3", - "type": "LOOPS", - "data": { - "id": "LOOP-67e6ac26-cc23-4159-8659-ef0577421ee3", - "label": "LOOP", - "func": "LOOP", - "type": "LOOPS", - "ctrls": { - "num_loops": { - "type": "int", - "default": -1, - "functionName": "LOOP", - "param": "num_loops", - "value": "15" - } - }, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "outputs": [ - { - "name": "body", - "id": "body", - "type": "Any" - }, - { - "name": "end", - "id": "end", - "type": "Any" - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\LOOPS\\LOOP\\LOOP.py", - "selected": true - }, - "position": { - "x": -120.5168017191627, - "y": 215.79596215972782 - }, - "selected": true, - "positionAbsolute": { - "x": -120.5168017191627, - "y": 215.79596215972782 - }, - "dragging": true - }, - { - "width": 150, - "height": 150, - "id": "GOTO-077af2ac-636b-4abb-a574-33e669e64457", - "type": "LOOPS", - "data": { - "id": "GOTO-077af2ac-636b-4abb-a574-33e669e64457", - "label": "GOTO", - "func": "GOTO", - "type": "LOOPS", - "ctrls": { - "goto_node_id": { - "type": "NodeReference", - "default": null, - "functionName": "GOTO", - "param": "goto_node_id", - "value": "LOOP-67e6ac26-cc23-4159-8659-ef0577421ee3" - } - }, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\LOOPS\\GOTO\\GOTO.py", - "selected": false - }, - "position": { - "x": 1258.0674029322674, - "y": 80.81660196613069 - }, - "selected": false, - "positionAbsolute": { - "x": 1258.0674029322674, - "y": 80.81660196613069 - }, - "dragging": true - }, - { - "width": 130, - "height": 130, + "width": 208, + "height": 96, "id": "CONSTANT-763b863d-7a28-4264-8f33-3e02c65f85d5", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "CONSTANT-763b863d-7a28-4264-8f33-3e02c65f85d5", "label": "100", "func": "CONSTANT", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "constant": { "type": "float", @@ -144,15 +50,15 @@ "dragging": true }, { - "width": 150, - "height": 150, + "width": 160, + "height": 160, "id": "PID-cee43c6b-237d-45f8-98d0-319f48acaebf", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "data": { "id": "PID-cee43c6b-237d-45f8-98d0-319f48acaebf", "label": "PID", "func": "PID", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "ctrls": { "Kp": { "type": "float", @@ -206,15 +112,15 @@ "dragging": true }, { - "width": 130, - "height": 130, + "width": 208, + "height": 96, "id": "SECOND_ORDER_SYSTEM-f97650dd-54de-4204-be2d-a04451e4b622", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "SECOND_ORDER_SYSTEM-f97650dd-54de-4204-be2d-a04451e4b622", "label": "SECOND ORDER SYSTEM", "func": "SECOND_ORDER_SYSTEM", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "d1": { "type": "float", @@ -261,15 +167,15 @@ "dragging": true }, { - "width": 130, - "height": 130, + "width": 208, + "height": 96, "id": "FEEDBACK-7dce3ba5-d2e2-4b60-8a2c-06218b5f718d", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "FEEDBACK-7dce3ba5-d2e2-4b60-8a2c-06218b5f718d", "label": "FEEDBACK", "func": "FEEDBACK", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "referred_node": { "type": "NodeReference", @@ -309,8 +215,8 @@ "dragging": true }, { - "width": 99, - "height": 130, + "width": 72, + "height": 72, "id": "SUBTRACT-3a3c4ed2-1ec0-433a-b6d6-d9819a2a02c1", "type": "ARITHMETIC", "data": { @@ -358,12 +264,12 @@ "width": 380, "height": 293, "id": "LINE-ed3aba7c-7235-43dd-baeb-6ad9dbc763b9", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-ed3aba7c-7235-43dd-baeb-6ad9dbc763b9", "label": "LINE", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -395,48 +301,15 @@ "dragging": true }, { - "width": 210, - "height": 130, - "id": "END-c14d955a-8357-4341-8221-caf9f2832174", - "type": "TERMINATORS", - "data": { - "id": "END-c14d955a-8357-4341-8221-caf9f2832174", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", - "selected": false - }, - "position": { - "x": 1058.3707129617164, - "y": 465.2386207280347 - }, - "selected": false, - "positionAbsolute": { - "x": 1058.3707129617164, - "y": 465.2386207280347 - }, - "dragging": true - }, - { - "width": 150, - "height": 150, + "width": 160, + "height": 160, "id": "DS_LOAD-1cfd0ec3-cbf0-4316-b2f0-2654e5a54e49", - "type": "INTERNAL_MEMORY", + "type": "LOADERS", "data": { "id": "DS_LOAD-1cfd0ec3-cbf0-4316-b2f0-2654e5a54e49", "label": "DS LOAD", "func": "DS_LOAD", - "type": "INTERNAL_MEMORY", + "type": "LOADERS", "ctrls": { "referred_node": { "type": "NodeReference", @@ -474,23 +347,66 @@ "y": 460.341992432171 }, "dragging": true + }, + { + "width": 96, + "height": 96, + "id": "LOOP-55a3deaf-9012-4d05-ad8a-b903d3e07ce5", + "type": "LOGIC_GATES", + "data": { + "id": "LOOP-55a3deaf-9012-4d05-ad8a-b903d3e07ce5", + "label": "LOOP", + "func": "LOOP", + "type": "LOGIC_GATES", + "ctrls": { + "num_loops": { + "type": "int", + "default": -1, + "desc": "number of times to iterate through body nodes default is `-1` meaning infinity.", + "functionName": "LOOP", + "param": "num_loops", + "value": "15" + } + }, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Any", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "body", + "id": "body", + "type": "Any", + "desc": null + }, + { + "name": "end", + "id": "end", + "type": "Any", + "desc": null + } + ], + "path": "PYTHON/nodes\\LOGIC_GATES\\LOOPS\\LOOP\\LOOP.py", + "selected": false + }, + "position": { + "x": -69.14789865874168, + "y": 265.86960150811666 + }, + "selected": false, + "positionAbsolute": { + "x": -69.14789865874168, + "y": 265.86960150811666 + }, + "dragging": true } ], "edges": [ - { - "source": "LOOP-67e6ac26-cc23-4159-8659-ef0577421ee3", - "sourceHandle": "body", - "target": "CONSTANT-763b863d-7a28-4264-8f33-3e02c65f85d5", - "targetHandle": "default", - "id": "reactflow__edge-LOOP-67e6ac26-cc23-4159-8659-ef0577421ee3body-CONSTANT-763b863d-7a28-4264-8f33-3e02c65f85d5default" - }, - { - "source": "LOOP-67e6ac26-cc23-4159-8659-ef0577421ee3", - "sourceHandle": "body", - "target": "FEEDBACK-7dce3ba5-d2e2-4b60-8a2c-06218b5f718d", - "targetHandle": "default", - "id": "reactflow__edge-LOOP-67e6ac26-cc23-4159-8659-ef0577421ee3body-FEEDBACK-7dce3ba5-d2e2-4b60-8a2c-06218b5f718ddefault" - }, { "source": "SUBTRACT-3a3c4ed2-1ec0-433a-b6d6-d9819a2a02c1", "sourceHandle": "default", @@ -505,13 +421,6 @@ "targetHandle": "default", "id": "reactflow__edge-PID-cee43c6b-237d-45f8-98d0-319f48acaebfdefault-SECOND_ORDER_SYSTEM-f97650dd-54de-4204-be2d-a04451e4b622default" }, - { - "source": "SECOND_ORDER_SYSTEM-f97650dd-54de-4204-be2d-a04451e4b622", - "sourceHandle": "default", - "target": "GOTO-077af2ac-636b-4abb-a574-33e669e64457", - "targetHandle": "default", - "id": "reactflow__edge-SECOND_ORDER_SYSTEM-f97650dd-54de-4204-be2d-a04451e4b622default-GOTO-077af2ac-636b-4abb-a574-33e669e64457default" - }, { "source": "FEEDBACK-7dce3ba5-d2e2-4b60-8a2c-06218b5f718d", "sourceHandle": "default", @@ -527,31 +436,38 @@ "id": "reactflow__edge-CONSTANT-763b863d-7a28-4264-8f33-3e02c65f85d5default-SUBTRACT-3a3c4ed2-1ec0-433a-b6d6-d9819a2a02c1b" }, { - "source": "LINE-ed3aba7c-7235-43dd-baeb-6ad9dbc763b9", + "source": "DS_LOAD-1cfd0ec3-cbf0-4316-b2f0-2654e5a54e49", "sourceHandle": "default", - "target": "END-c14d955a-8357-4341-8221-caf9f2832174", + "target": "LINE-ed3aba7c-7235-43dd-baeb-6ad9dbc763b9", "targetHandle": "default", - "id": "reactflow__edge-LINE-ed3aba7c-7235-43dd-baeb-6ad9dbc763b9default-END-c14d955a-8357-4341-8221-caf9f2832174default" + "id": "reactflow__edge-DS_LOAD-1cfd0ec3-cbf0-4316-b2f0-2654e5a54e49default-LINE-ed3aba7c-7235-43dd-baeb-6ad9dbc763b9default" }, { - "source": "LOOP-67e6ac26-cc23-4159-8659-ef0577421ee3", - "sourceHandle": "end", - "target": "DS_LOAD-1cfd0ec3-cbf0-4316-b2f0-2654e5a54e49", + "source": "LOOP-55a3deaf-9012-4d05-ad8a-b903d3e07ce5", + "sourceHandle": "body", + "target": "FEEDBACK-7dce3ba5-d2e2-4b60-8a2c-06218b5f718d", "targetHandle": "default", - "id": "reactflow__edge-LOOP-67e6ac26-cc23-4159-8659-ef0577421ee3end-DS_LOAD-1cfd0ec3-cbf0-4316-b2f0-2654e5a54e49default" + "id": "reactflow__edge-LOOP-55a3deaf-9012-4d05-ad8a-b903d3e07ce5body-FEEDBACK-7dce3ba5-d2e2-4b60-8a2c-06218b5f718ddefault" }, { - "source": "DS_LOAD-1cfd0ec3-cbf0-4316-b2f0-2654e5a54e49", - "sourceHandle": "default", - "target": "LINE-ed3aba7c-7235-43dd-baeb-6ad9dbc763b9", + "source": "LOOP-55a3deaf-9012-4d05-ad8a-b903d3e07ce5", + "sourceHandle": "body", + "target": "CONSTANT-763b863d-7a28-4264-8f33-3e02c65f85d5", "targetHandle": "default", - "id": "reactflow__edge-DS_LOAD-1cfd0ec3-cbf0-4316-b2f0-2654e5a54e49default-LINE-ed3aba7c-7235-43dd-baeb-6ad9dbc763b9default" + "id": "reactflow__edge-LOOP-55a3deaf-9012-4d05-ad8a-b903d3e07ce5body-CONSTANT-763b863d-7a28-4264-8f33-3e02c65f85d5default" + }, + { + "source": "LOOP-55a3deaf-9012-4d05-ad8a-b903d3e07ce5", + "sourceHandle": "end", + "target": "DS_LOAD-1cfd0ec3-cbf0-4316-b2f0-2654e5a54e49", + "targetHandle": "default", + "id": "reactflow__edge-LOOP-55a3deaf-9012-4d05-ad8a-b903d3e07ce5end-DS_LOAD-1cfd0ec3-cbf0-4316-b2f0-2654e5a54e49default" } ], "viewport": { - "x": -296.35399545928726, - "y": 66.8470830817738, - "zoom": 0.8744723800359967 + "x": 606.4472645567363, + "y": 234.63130388602087, + "zoom": 0.9186369849831518 } }, "ctrlsManifest": [ diff --git a/docs/nodes/GENERATORS/SIMULATIONS/SINE/examples/EX1/app.txt b/docs/nodes/GENERATORS/SIMULATIONS/SINE/examples/EX1/app.txt index 286f2d3534..a21039a97c 100644 --- a/docs/nodes/GENERATORS/SIMULATIONS/SINE/examples/EX1/app.txt +++ b/docs/nodes/GENERATORS/SIMULATIONS/SINE/examples/EX1/app.txt @@ -59,12 +59,12 @@ "width": 130, "height": 130, "id": "SINE-eea67eed-8065-40ba-9f28-3420f1f4a62a", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "SINE-eea67eed-8065-40ba-9f28-3420f1f4a62a", "label": "SINE", "func": "SINE", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "amplitude": { "type": "float", @@ -137,49 +137,16 @@ }, "dragging": true }, - { - "width": 210, - "height": 130, - "id": "END-819e566f-0195-4801-a339-ccb70f162bc3", - "type": "TERMINATORS", - "data": { - "id": "END-819e566f-0195-4801-a339-ccb70f162bc3", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": true - }, - "position": { - "x": 2076.467025365936, - "y": 329.35460171622043 - }, - "selected": true, - "positionAbsolute": { - "x": 2076.467025365936, - "y": 329.35460171622043 - }, - "dragging": true - }, { "width": 380, "height": 293, "id": "SCATTER-0966e710-b72c-4cf4-ade7-1c09a3b14b37", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "SCATTER-0966e710-b72c-4cf4-ade7-1c09a3b14b37", "label": "SCATTER", "func": "SCATTER", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -225,13 +192,6 @@ "target": "SCATTER-0966e710-b72c-4cf4-ade7-1c09a3b14b37", "targetHandle": "default", "id": "reactflow__edge-SINE-eea67eed-8065-40ba-9f28-3420f1f4a62adefault-SCATTER-0966e710-b72c-4cf4-ade7-1c09a3b14b37default" - }, - { - "source": "SCATTER-0966e710-b72c-4cf4-ade7-1c09a3b14b37", - "sourceHandle": "default", - "target": "END-819e566f-0195-4801-a339-ccb70f162bc3", - "targetHandle": "default", - "id": "reactflow__edge-SCATTER-0966e710-b72c-4cf4-ade7-1c09a3b14b37default-END-819e566f-0195-4801-a339-ccb70f162bc3default" } ], "viewport": { diff --git a/docs/nodes/GENERATORS/SIMULATIONS/TIMESERIES/examples/EX1/app.txt b/docs/nodes/GENERATORS/SIMULATIONS/TIMESERIES/examples/EX1/app.txt index fcdad54d3c..dd68cf28ce 100644 --- a/docs/nodes/GENERATORS/SIMULATIONS/TIMESERIES/examples/EX1/app.txt +++ b/docs/nodes/GENERATORS/SIMULATIONS/TIMESERIES/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 225, "height": 226, "id": "TABLE-e495f7ee-9936-41e5-8341-8532fbe7fc37", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "TABLE-e495f7ee-9936-41e5-8341-8532fbe7fc37", "label": "TABLE", "func": "TABLE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -28,62 +28,29 @@ } ], "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/TABLE/TABLE.py", - "selected": true + "selected": false }, "position": { "x": 1454.0240539163242, "y": 449.24417024363777 }, - "selected": true, + "selected": false, "positionAbsolute": { "x": 1454.0240539163242, "y": 449.24417024363777 }, "dragging": true }, - { - "width": 210, - "height": 130, - "id": "END-3194a892-6069-4c33-9b6a-e8b977e6cb91", - "type": "TERMINATORS", - "data": { - "id": "END-3194a892-6069-4c33-9b6a-e8b977e6cb91", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 1853.4255726844237, - "y": 486.7125864969281 - }, - "selected": false, - "positionAbsolute": { - "x": 1853.4255726844237, - "y": 486.7125864969281 - }, - "dragging": true - }, { "width": 130, "height": 130, "id": "TIMESERIES-32359924-1394-434a-a933-965680772cfb", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "TIMESERIES-32359924-1394-434a-a933-965680772cfb", "label": "TIMESERIES", "func": "TIMESERIES", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "start_date": { "type": "str", @@ -129,13 +96,6 @@ "target": "TABLE-e495f7ee-9936-41e5-8341-8532fbe7fc37", "targetHandle": "default", "id": "reactflow__edge-TIMESERIES-32359924-1394-434a-a933-965680772cfbdefault-TABLE-e495f7ee-9936-41e5-8341-8532fbe7fc37default" - }, - { - "source": "TABLE-e495f7ee-9936-41e5-8341-8532fbe7fc37", - "sourceHandle": "default", - "target": "END-3194a892-6069-4c33-9b6a-e8b977e6cb91", - "targetHandle": "default", - "id": "reactflow__edge-TABLE-e495f7ee-9936-41e5-8341-8532fbe7fc37default-END-3194a892-6069-4c33-9b6a-e8b977e6cb91default" } ], "viewport": { diff --git a/docs/nodes/GENERATORS/SIMULATIONS/WAVEPACKET/WAVEPACKET.md b/docs/nodes/GENERATORS/SIMULATIONS/WAVEPACKET/WAVEPACKET.md new file mode 100644 index 0000000000..4b7effaf16 --- /dev/null +++ b/docs/nodes/GENERATORS/SIMULATIONS/WAVEPACKET/WAVEPACKET.md @@ -0,0 +1,47 @@ + +[//]: # (Custom component imports) + +import DocString from '@site/src/components/DocString'; +import PythonCode from '@site/src/components/PythonCode'; +import AppDisplay from '@site/src/components/AppDisplay'; +import SectionBreak from '@site/src/components/SectionBreak'; +import AppendixSection from '@site/src/components/AppendixSection'; + +[//]: # (Docstring) + +import DocstringSource from '!!raw-loader!./a1-[autogen]/docstring.txt'; +import PythonSource from '!!raw-loader!./a1-[autogen]/python_code.txt'; + +{DocstringSource} +{PythonSource} + + + + + +[//]: # (Examples) + +## Examples + + + + + + + + +[//]: # (Appendix) + +import Notes from '!!raw-loader!./appendix/notes.md'; +import Hardware from '!!raw-loader!./appendix/hardware.md'; +import Media from '!!raw-loader!./appendix/media.md'; + +## Appendix + +{Notes} +{Hardware} +{Media} + + diff --git a/docs/nodes/GENERATORS/SIMULATIONS/WAVEPACKET/a1-[autogen]/docstring.txt b/docs/nodes/GENERATORS/SIMULATIONS/WAVEPACKET/a1-[autogen]/docstring.txt new file mode 100644 index 0000000000..190c92aa61 --- /dev/null +++ b/docs/nodes/GENERATORS/SIMULATIONS/WAVEPACKET/a1-[autogen]/docstring.txt @@ -0,0 +1,2 @@ + +One dimensional Gaussian wavepacket diff --git a/docs/nodes/GENERATORS/SIMULATIONS/WAVEPACKET/a1-[autogen]/python_code.txt b/docs/nodes/GENERATORS/SIMULATIONS/WAVEPACKET/a1-[autogen]/python_code.txt new file mode 100644 index 0000000000..e438528663 --- /dev/null +++ b/docs/nodes/GENERATORS/SIMULATIONS/WAVEPACKET/a1-[autogen]/python_code.txt @@ -0,0 +1,110 @@ +import numpy as np +import scipy.sparse as spa +from scipy.sparse.linalg import splu +from flojoy import flojoy, OrderedPair, SmallMemory, DefaultParams +from typing import Optional + + +def gaussian_wavepacket(x, x0, k, sigma=0.1): + + x = np.asarray(x) + g = np.sqrt(1 / np.sqrt(np.pi) / sigma) * np.exp(-((x - x0) ** 2) / 2 / sigma**2) + + return np.exp(1j * k * (x - x0)) * g + + +def CrankNicolson(psi, V, x, dt): + + Crank-Nicolson method for the 1D Schrodinger equation. + + # No. of spatial grid points + J = x.size - 1 + dx = x[1] - x[0] + + # the external potential + V_e = spa.diags(V) + # the kinetic operator + O_k = np.ones(J + 1) + T = (-1 / 2 / dx**2) * spa.spdiags([O_k, -2 * O_k, O_k], [-1, 0, 1], J + 1, J + 1) + + # the two unitary matrices + U2 = spa.eye(J + 1) + (1j * 0.5 * dt) * (T + V_e) + U1 = spa.eye(J + 1) - (1j * 0.5 * dt) * (T + V_e) + # splu requires CSC matrix format for efficient decomposition + U2 = U2.tocsc() + LU = splu(U2) + + b = U1.dot(psi) + PSI_t = LU.solve(b) + + return PSI_t + + +memory_key = "WAVEPACKET" + + +@flojoy(inject_node_metadata=True) +def WAVEPACKET( + default_params: DefaultParams, + default: Optional[OrderedPair] = None, + L_box: float = 20, + center: float = 0, + momentum: float = 5, + sigma: float = 1, + dt: float = 0.2, +) -> OrderedPair: + The WAVEPACKET node approximates the behaviour of a 1D Gaussian + wavepacket in an infinite-well potential box. This example uses the + Crank-Nicolson Method to solve the 1D Schrodinger equation. + + Further reading: + http://staff.ustc.edu.cn/~zqj/posts/Numerical_TDSE/ + + Parameters + ---------- + L_box: float + The width of the box in Bohr lengths. + center: float + The center of the initial wavepacket. + momentum: float + The momentum of the initial wavepacket. + sigma: float + The width of the initial wavepacket. + dt: float + Time steps in atomic units, 1 a.u. = 24.188 as + + Returns + ------- + OrderedPair + The most recent wavepacket. + + + node_id = default_params.node_id + + psi_t = SmallMemory().read_memory(node_id, memory_key) + if psi_t is None: + initialize = True + elif isinstance(psi_t, np.ndarray): + initialize = False + else: + raise TypeError("Error loading object from SmallMemory.") + + # Box parameters. + xmin = -L_box / 2.0 # left boundary + J = 999 # No. of spatial grid points + x = np.linspace(xmin, xmin + L_box, J + 1, endpoint=True) + + # The gaussian wavepacket as the initial wavefunction. + psi0 = gaussian_wavepacket(x, x0=center, k=momentum, sigma=sigma) + V_e = np.zeros_like(x) # The externial potentials. + + # The time evolution of the Schrodinger equation. + if initialize: + PSI = CrankNicolson(psi0, V_e, x, dt) + elif not initialize: + PSI = CrankNicolson(psi_t, V_e, x, dt) + + SmallMemory().write_to_memory(node_id, memory_key, PSI) + y = np.abs(PSI) + + return OrderedPair(x=x, y=y) diff --git a/docs/nodes/GENERATORS/SIMULATIONS/WAVEPACKET/appendix/hardware.md b/docs/nodes/GENERATORS/SIMULATIONS/WAVEPACKET/appendix/hardware.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/nodes/GENERATORS/SIMULATIONS/WAVEPACKET/appendix/media.md b/docs/nodes/GENERATORS/SIMULATIONS/WAVEPACKET/appendix/media.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/nodes/GENERATORS/SIMULATIONS/WAVEPACKET/appendix/notes.md b/docs/nodes/GENERATORS/SIMULATIONS/WAVEPACKET/appendix/notes.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/nodes/GENERATORS/SIMULATIONS/WAVEPACKET/examples/EX1/app.txt b/docs/nodes/GENERATORS/SIMULATIONS/WAVEPACKET/examples/EX1/app.txt new file mode 100644 index 0000000000..0585934c8f --- /dev/null +++ b/docs/nodes/GENERATORS/SIMULATIONS/WAVEPACKET/examples/EX1/app.txt @@ -0,0 +1,228 @@ +{ + "rfInstance": { + "nodes": [ + { + "width": 380, + "height": 293, + "id": "LINE-04475ad6-db8e-485b-8169-a90dfb525a8f", + "type": "VISUALIZERS", + "data": { + "id": "LINE-04475ad6-db8e-485b-8169-a90dfb525a8f", + "label": "LINE", + "func": "LINE", + "type": "VISUALIZERS", + "ctrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair|DataFrame|Matrix", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": null + } + ], + "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/LINE/LINE.py", + "selected": false + }, + "position": { + "x": 327.14642964578854, + "y": 198.79482276769716 + }, + "selected": false, + "positionAbsolute": { + "x": 327.14642964578854, + "y": 198.79482276769716 + }, + "dragging": true + }, + { + "width": 208, + "height": 96, + "id": "WAVEPACKET-ee6f2fc1-8cef-400a-895c-abe0564b1261", + "type": "GENERATORS", + "data": { + "id": "WAVEPACKET-ee6f2fc1-8cef-400a-895c-abe0564b1261", + "label": "WAVEPACKET", + "func": "WAVEPACKET", + "type": "GENERATORS", + "ctrls": { + "L_box": { + "type": "float", + "default": 20, + "desc": "The width of the box in Bohr lengths.", + "functionName": "WAVEPACKET", + "param": "L_box", + "value": 20 + }, + "center": { + "type": "float", + "default": 0, + "desc": "The center of the initial wavepacket.", + "functionName": "WAVEPACKET", + "param": "center", + "value": "5" + }, + "momentum": { + "type": "float", + "default": 5, + "desc": "The momentum of the initial wavepacket.", + "functionName": "WAVEPACKET", + "param": "momentum", + "value": 5 + }, + "sigma": { + "type": "float", + "default": 1, + "desc": "The width of the initial wavepacket.", + "functionName": "WAVEPACKET", + "param": "sigma", + "value": "1" + }, + "dt": { + "type": "float", + "default": 0.2, + "desc": "Time steps in atomic units, 1 a.u. = 24.188 as", + "functionName": "WAVEPACKET", + "param": "dt", + "value": "0.1" + } + }, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair", + "desc": "The most recent wavepacket." + } + ], + "path": "PYTHON/nodes/GENERATORS/SIMULATIONS/WAVEPACKET/WAVEPACKET.py", + "selected": false + }, + "position": { + "x": -71.22529418711089, + "y": 231.12759430779778 + }, + "selected": false, + "positionAbsolute": { + "x": -71.22529418711089, + "y": 231.12759430779778 + }, + "dragging": true + }, + { + "width": 96, + "height": 96, + "id": "LOOP-4a9435b9-f3d9-42bb-ac6f-058b309d33f5", + "type": "LOGIC_GATES", + "data": { + "id": "LOOP-4a9435b9-f3d9-42bb-ac6f-058b309d33f5", + "label": "LOOP", + "func": "LOOP", + "type": "LOGIC_GATES", + "ctrls": { + "num_loops": { + "type": "int", + "default": -1, + "desc": "number of times to iterate through body nodes default is `-1` meaning infinity.", + "functionName": "LOOP", + "param": "num_loops", + "value": "20" + } + }, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Any", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "body", + "id": "body", + "type": "Any", + "desc": null + }, + { + "name": "end", + "id": "end", + "type": "Any", + "desc": null + } + ], + "path": "PYTHON/nodes\\LOGIC_GATES\\LOOPS\\LOOP\\LOOP.py", + "selected": false + }, + "position": { + "x": -398.0667272413819, + "y": 300.8094166726855 + }, + "selected": false, + "positionAbsolute": { + "x": -398.0667272413819, + "y": 300.8094166726855 + }, + "dragging": true + } + ], + "edges": [ + { + "source": "WAVEPACKET-ee6f2fc1-8cef-400a-895c-abe0564b1261", + "sourceHandle": "default", + "target": "LINE-04475ad6-db8e-485b-8169-a90dfb525a8f", + "targetHandle": "default", + "id": "reactflow__edge-WAVEPACKET-ee6f2fc1-8cef-400a-895c-abe0564b1261default-LINE-04475ad6-db8e-485b-8169-a90dfb525a8fdefault" + }, + { + "source": "LOOP-4a9435b9-f3d9-42bb-ac6f-058b309d33f5", + "sourceHandle": "body", + "target": "WAVEPACKET-ee6f2fc1-8cef-400a-895c-abe0564b1261", + "targetHandle": "default", + "id": "reactflow__edge-LOOP-4a9435b9-f3d9-42bb-ac6f-058b309d33f5body-WAVEPACKET-ee6f2fc1-8cef-400a-895c-abe0564b1261default" + } + ], + "viewport": { + "x": 606.4472645567363, + "y": 234.63130388602087, + "zoom": 0.9186369849831518 + } + }, + "ctrlsManifest": [ + { + "type": "input", + "name": "Slider", + "id": "INPUT_PLACEHOLDER", + "hidden": false, + "minHeight": 1, + "minWidth": 2, + "layout": { + "x": 0, + "y": 0, + "h": 2, + "w": 2, + "minH": 1, + "minW": 2, + "i": "INPUT_PLACEHOLDER" + } + } + ] +} \ No newline at end of file diff --git a/docs/nodes/INSTRUMENTS/KEITHLEY/KEITHLEY2400/examples/EX1/app.txt b/docs/nodes/INSTRUMENTS/KEITHLEY/KEITHLEY2400/examples/EX1/app.txt index 6b0118c552..5fe64f22da 100644 --- a/docs/nodes/INSTRUMENTS/KEITHLEY/KEITHLEY2400/examples/EX1/app.txt +++ b/docs/nodes/INSTRUMENTS/KEITHLEY/KEITHLEY2400/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 150, "height": 150, "id": "KEITHLEY2400-06832353-c0e3-4b21-80f1-99f7827063ab", - "type": "KEITHLEY", + "type": "INSTRUMENTS", "data": { "id": "KEITHLEY2400-06832353-c0e3-4b21-80f1-99f7827063ab", "label": "KEITHLEY2400", "func": "KEITHLEY2400", - "type": "KEITHLEY", + "type": "INSTRUMENTS", "ctrls": { "comport": { "type": "str", @@ -66,12 +66,12 @@ "width": 225, "height": 226, "id": "LINE-c497dfe3-5697-43ea-89ae-49855ed1fd06", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-c497dfe3-5697-43ea-89ae-49855ed1fd06", "label": "LINE", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -102,39 +102,6 @@ }, "dragging": true }, - { - "width": 210, - "height": 130, - "id": "END-4ab72a2d-4c0a-422f-aac2-1adfc221c8aa", - "type": "TERMINATORS", - "data": { - "id": "END-4ab72a2d-4c0a-422f-aac2-1adfc221c8aa", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 920.4465656226953, - "y": 27.238771529071983 - }, - "selected": false, - "positionAbsolute": { - "x": 920.4465656226953, - "y": 27.238771529071983 - }, - "dragging": true - }, { "width": 150, "height": 150, @@ -204,13 +171,6 @@ "target": "LINE-c497dfe3-5697-43ea-89ae-49855ed1fd06", "targetHandle": "default", "id": "reactflow__edge-KEITHLEY2400-06832353-c0e3-4b21-80f1-99f7827063abdefault-LINE-c497dfe3-5697-43ea-89ae-49855ed1fd06default" - }, - { - "source": "LINE-c497dfe3-5697-43ea-89ae-49855ed1fd06", - "sourceHandle": "default", - "target": "END-4ab72a2d-4c0a-422f-aac2-1adfc221c8aa", - "targetHandle": "default", - "id": "reactflow__edge-LINE-c497dfe3-5697-43ea-89ae-49855ed1fd06default-END-4ab72a2d-4c0a-422f-aac2-1adfc221c8aadefault" } ], "viewport": { diff --git a/docs/nodes/INSTRUMENTS/LABJACK/LABJACKU3/examples/EX1/app.txt b/docs/nodes/INSTRUMENTS/LABJACK/LABJACKU3/examples/EX1/app.txt index 06322d896a..a93d2c3a7c 100644 --- a/docs/nodes/INSTRUMENTS/LABJACK/LABJACKU3/examples/EX1/app.txt +++ b/docs/nodes/INSTRUMENTS/LABJACK/LABJACKU3/examples/EX1/app.txt @@ -1,49 +1,16 @@ { "rfInstance": { "nodes": [ - { - "width": 210, - "height": 130, - "id": "END-04176810-8104-4747-9a8f-df79d12c5298", - "type": "TERMINATORS", - "data": { - "id": "END-04176810-8104-4747-9a8f-df79d12c5298", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 512.2688682914458, - "y": -277.4889314258646 - }, - "selected": false, - "positionAbsolute": { - "x": 512.2688682914458, - "y": -277.4889314258646 - }, - "dragging": true - }, { "width": 150, "height": 150, "id": "LABJACKU3-8bb214ab-525a-490d-b539-7811b057d85f", - "type": "LABJACK", + "type": "INSTRUMENTS", "data": { "id": "LABJACKU3-8bb214ab-525a-490d-b539-7811b057d85f", "label": "LABJACKU3", "func": "LABJACKU3", - "type": "LABJACK", + "type": "INSTRUMENTS", "ctrls": { "sensor_number": { "type": "int", @@ -88,57 +55,16 @@ }, "dragging": true }, - { - "width": 150, - "height": 150, - "id": "GOTO-b8fa97e1-9bb8-4236-ad03-12f028086a7b", - "type": "LOOPS", - "data": { - "id": "GOTO-b8fa97e1-9bb8-4236-ad03-12f028086a7b", - "label": "GOTO", - "func": "GOTO", - "type": "LOOPS", - "ctrls": { - "goto_node_id": { - "type": "NodeReference", - "default": null, - "functionName": "GOTO", - "param": "goto_node_id", - "value": "LOOP-744fed19-65b1-47c3-ad99-28db2e906bde" - } - }, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/LOOPS/GOTO/GOTO.py", - "selected": false - }, - "position": { - "x": 925.848254563315, - "y": 101.9860610943698 - }, - "selected": false, - "positionAbsolute": { - "x": 925.848254563315, - "y": 101.9860610943698 - }, - "dragging": true - }, { "width": 150, "height": 150, "id": "LOOP-744fed19-65b1-47c3-ad99-28db2e906bde", - "type": "LOOPS", + "type": "LOGIC_GATES", "data": { "id": "LOOP-744fed19-65b1-47c3-ad99-28db2e906bde", "label": "LOOP", "func": "LOOP", - "type": "LOOPS", + "type": "LOGIC_GATES", "ctrls": { "num_loops": { "type": "int", @@ -186,12 +112,12 @@ "width": 225, "height": 226, "id": "BAR-d54011a8-5b19-471e-9aad-74ce3ca62914", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "BAR-d54011a8-5b19-471e-9aad-74ce3ca62914", "label": "BAR", "func": "BAR", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -209,13 +135,13 @@ } ], "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/BAR/BAR.py", - "selected": true + "selected": false }, "position": { "x": 509.9694052032725, "y": 64.67437309401998 }, - "selected": true, + "selected": false, "positionAbsolute": { "x": 509.9694052032725, "y": 64.67437309401998 @@ -224,13 +150,6 @@ } ], "edges": [ - { - "source": "LOOP-744fed19-65b1-47c3-ad99-28db2e906bde", - "sourceHandle": "end", - "target": "END-04176810-8104-4747-9a8f-df79d12c5298", - "targetHandle": "default", - "id": "reactflow__edge-LOOP-744fed19-65b1-47c3-ad99-28db2e906bdeend-END-04176810-8104-4747-9a8f-df79d12c5298default" - }, { "source": "LOOP-744fed19-65b1-47c3-ad99-28db2e906bde", "sourceHandle": "body", @@ -244,13 +163,6 @@ "target": "BAR-d54011a8-5b19-471e-9aad-74ce3ca62914", "targetHandle": "default", "id": "reactflow__edge-LABJACKU3-8bb214ab-525a-490d-b539-7811b057d85fdefault-BAR-d54011a8-5b19-471e-9aad-74ce3ca62914default" - }, - { - "source": "BAR-d54011a8-5b19-471e-9aad-74ce3ca62914", - "sourceHandle": "default", - "target": "GOTO-b8fa97e1-9bb8-4236-ad03-12f028086a7b", - "targetHandle": "default", - "id": "reactflow__edge-BAR-d54011a8-5b19-471e-9aad-74ce3ca62914default-GOTO-b8fa97e1-9bb8-4236-ad03-12f028086a7bdefault" } ], "viewport": { diff --git a/docs/nodes/INSTRUMENTS/PHIDGET/PHIDGET22/examples/EX1/app.txt b/docs/nodes/INSTRUMENTS/PHIDGET/PHIDGET22/examples/EX1/app.txt index a3fdcb9de5..644e55a154 100644 --- a/docs/nodes/INSTRUMENTS/PHIDGET/PHIDGET22/examples/EX1/app.txt +++ b/docs/nodes/INSTRUMENTS/PHIDGET/PHIDGET22/examples/EX1/app.txt @@ -1,49 +1,16 @@ { "rfInstance": { "nodes": [ - { - "width": 210, - "height": 130, - "id": "END-04176810-8104-4747-9a8f-df79d12c5298", - "type": "TERMINATORS", - "data": { - "id": "END-04176810-8104-4747-9a8f-df79d12c5298", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 983.3699387834349, - "y": -33.88997242431205 - }, - "selected": false, - "positionAbsolute": { - "x": 983.3699387834349, - "y": -33.88997242431205 - }, - "dragging": true - }, { "width": 150, "height": 150, "id": "PHIDGET22-c6e0fa47-17f1-4642-ae9e-f52453b7c526", - "type": "PHIDGET", + "type": "INSTRUMENTS", "data": { "id": "PHIDGET22-c6e0fa47-17f1-4642-ae9e-f52453b7c526", "label": "PHIDGET22", "func": "PHIDGET22", - "type": "PHIDGET", + "type": "INSTRUMENTS", "ctrls": { "n_sensors": { "type": "int", @@ -106,12 +73,12 @@ "width": 225, "height": 226, "id": "BAR-8788c5f3-d566-4c58-85dc-59af4e81d36c", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "BAR-8788c5f3-d566-4c58-85dc-59af4e81d36c", "label": "BAR", "func": "BAR", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -150,13 +117,6 @@ "target": "BAR-8788c5f3-d566-4c58-85dc-59af4e81d36c", "targetHandle": "default", "id": "reactflow__edge-PHIDGET22-c6e0fa47-17f1-4642-ae9e-f52453b7c526default-BAR-8788c5f3-d566-4c58-85dc-59af4e81d36cdefault" - }, - { - "source": "BAR-8788c5f3-d566-4c58-85dc-59af4e81d36c", - "sourceHandle": "default", - "target": "END-04176810-8104-4747-9a8f-df79d12c5298", - "targetHandle": "default", - "id": "reactflow__edge-BAR-8788c5f3-d566-4c58-85dc-59af4e81d36cdefault-END-04176810-8104-4747-9a8f-df79d12c5298default" } ], "viewport": { diff --git a/docs/nodes/INSTRUMENTS/SERIAL/SERIAL_SINGLE_MEASUREMENT/examples/EX1/app.txt b/docs/nodes/INSTRUMENTS/SERIAL/SERIAL_SINGLE_MEASUREMENT/examples/EX1/app.txt index 7eb994132f..6830c2f250 100644 --- a/docs/nodes/INSTRUMENTS/SERIAL/SERIAL_SINGLE_MEASUREMENT/examples/EX1/app.txt +++ b/docs/nodes/INSTRUMENTS/SERIAL/SERIAL_SINGLE_MEASUREMENT/examples/EX1/app.txt @@ -1,49 +1,16 @@ { "rfInstance": { "nodes": [ - { - "width": 210, - "height": 130, - "id": "END-04176810-8104-4747-9a8f-df79d12c5298", - "type": "TERMINATORS", - "data": { - "id": "END-04176810-8104-4747-9a8f-df79d12c5298", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": true - }, - "position": { - "x": 1043.2541336405363, - "y": -66.93653968941925 - }, - "selected": true, - "positionAbsolute": { - "x": 1043.2541336405363, - "y": -66.93653968941925 - }, - "dragging": true - }, { "width": 225, "height": 226, "id": "BAR-a5dad7fa-f6be-4814-9b64-a5c67318c653", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "BAR-a5dad7fa-f6be-4814-9b64-a5c67318c653", "label": "BAR", "func": "BAR", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -78,12 +45,12 @@ "width": 150, "height": 150, "id": "SERIAL_SINGLE_MEASUREMENT-e2db0dcb-93ee-4548-babe-27a69ed71b1b", - "type": "SERIAL", + "type": "INSTRUMENTS", "data": { "id": "SERIAL_SINGLE_MEASUREMENT-e2db0dcb-93ee-4548-babe-27a69ed71b1b", "label": "SERIAL SINGLE MEASUREMENT", "func": "SERIAL_SINGLE_MEASUREMENT", - "type": "SERIAL", + "type": "INSTRUMENTS", "ctrls": { "comport": { "type": "str", @@ -143,13 +110,6 @@ "target": "BAR-a5dad7fa-f6be-4814-9b64-a5c67318c653", "targetHandle": "default", "id": "reactflow__edge-SERIAL_SINGLE_MEASUREMENT-e2db0dcb-93ee-4548-babe-27a69ed71b1bdefault-BAR-a5dad7fa-f6be-4814-9b64-a5c67318c653default" - }, - { - "source": "BAR-a5dad7fa-f6be-4814-9b64-a5c67318c653", - "sourceHandle": "default", - "target": "END-04176810-8104-4747-9a8f-df79d12c5298", - "targetHandle": "default", - "id": "reactflow__edge-BAR-a5dad7fa-f6be-4814-9b64-a5c67318c653default-END-04176810-8104-4747-9a8f-df79d12c5298default" } ], "viewport": { diff --git a/docs/nodes/INSTRUMENTS/SERIAL/SERIAL_TIMESERIES/examples/EX1/app.txt b/docs/nodes/INSTRUMENTS/SERIAL/SERIAL_TIMESERIES/examples/EX1/app.txt index 074ec276a3..dee623195b 100644 --- a/docs/nodes/INSTRUMENTS/SERIAL/SERIAL_TIMESERIES/examples/EX1/app.txt +++ b/docs/nodes/INSTRUMENTS/SERIAL/SERIAL_TIMESERIES/examples/EX1/app.txt @@ -1,49 +1,16 @@ { "rfInstance": { "nodes": [ - { - "width": 210, - "height": 130, - "id": "END-04176810-8104-4747-9a8f-df79d12c5298", - "type": "TERMINATORS", - "data": { - "id": "END-04176810-8104-4747-9a8f-df79d12c5298", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 1300.8469442106318, - "y": 13.910523009412998 - }, - "selected": false, - "positionAbsolute": { - "x": 1300.8469442106318, - "y": 13.910523009412998 - }, - "dragging": true - }, { "width": 150, "height": 150, "id": "SERIAL_TIMESERIES-d9520c8e-120d-488b-a042-dac8b39b294c", - "type": "SERIAL", + "type": "INSTRUMENTS", "data": { "id": "SERIAL_TIMESERIES-d9520c8e-120d-488b-a042-dac8b39b294c", "label": "SERIAL TIMESERIES", "func": "SERIAL_TIMESERIES", - "type": "SERIAL", + "type": "INSTRUMENTS", "ctrls": { "comport": { "type": "str", @@ -113,12 +80,12 @@ "width": 225, "height": 226, "id": "TABLE-e0ba3b06-fcc8-40a5-bb12-14370fe009e9", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "TABLE-e0ba3b06-fcc8-40a5-bb12-14370fe009e9", "label": "TABLE", "func": "TABLE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -157,13 +124,6 @@ "target": "TABLE-e0ba3b06-fcc8-40a5-bb12-14370fe009e9", "targetHandle": "default", "id": "reactflow__edge-SERIAL_TIMESERIES-d9520c8e-120d-488b-a042-dac8b39b294cdefault-TABLE-e0ba3b06-fcc8-40a5-bb12-14370fe009e9default" - }, - { - "source": "TABLE-e0ba3b06-fcc8-40a5-bb12-14370fe009e9", - "sourceHandle": "default", - "target": "END-04176810-8104-4747-9a8f-df79d12c5298", - "targetHandle": "default", - "id": "reactflow__edge-TABLE-e0ba3b06-fcc8-40a5-bb12-14370fe009e9default-END-04176810-8104-4747-9a8f-df79d12c5298default" } ], "viewport": { diff --git a/docs/nodes/INSTRUMENTS/STEPPER_MOTOR/STEPPER_DRIVER_TIC/examples/EX1/app.txt b/docs/nodes/INSTRUMENTS/STEPPER_MOTOR/STEPPER_DRIVER_TIC/examples/EX1/app.txt index e82d5f4a07..4afb8bd038 100644 --- a/docs/nodes/INSTRUMENTS/STEPPER_MOTOR/STEPPER_DRIVER_TIC/examples/EX1/app.txt +++ b/docs/nodes/INSTRUMENTS/STEPPER_MOTOR/STEPPER_DRIVER_TIC/examples/EX1/app.txt @@ -1,49 +1,16 @@ { "rfInstance": { "nodes": [ - { - "width": 210, - "height": 130, - "id": "END-04176810-8104-4747-9a8f-df79d12c5298", - "type": "TERMINATORS", - "data": { - "id": "END-04176810-8104-4747-9a8f-df79d12c5298", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 1289.1115606130968, - "y": 7.591470303047913 - }, - "selected": false, - "positionAbsolute": { - "x": 1289.1115606130968, - "y": 7.591470303047913 - }, - "dragging": true - }, { "width": 150, "height": 150, "id": "STEPPER_DRIVER_TIC-deb4fca7-fc18-443d-bd70-f1455a749eff", - "type": "STEPPER_MOTOR", + "type": "INSTRUMENTS", "data": { "id": "STEPPER_DRIVER_TIC-deb4fca7-fc18-443d-bd70-f1455a749eff", "label": "STEPPER DRIVER TIC", "func": "STEPPER_DRIVER_TIC", - "type": "STEPPER_MOTOR", + "type": "INSTRUMENTS", "ctrls": { "current_limit": { "type": "int", @@ -89,13 +56,13 @@ } ], "path": "PYTHON/nodes/INSTRUMENTS/STEPPER_MOTOR/STEPPER_DRIVER_TIC/STEPPER_DRIVER_TIC.py", - "selected": true + "selected": false }, "position": { "x": 883.1245033729516, "y": -2.309719518942927 }, - "selected": true, + "selected": false, "positionAbsolute": { "x": 883.1245033729516, "y": -2.309719518942927 @@ -103,15 +70,7 @@ "dragging": true } ], - "edges": [ - { - "source": "STEPPER_DRIVER_TIC-deb4fca7-fc18-443d-bd70-f1455a749eff", - "sourceHandle": "default", - "target": "END-04176810-8104-4747-9a8f-df79d12c5298", - "targetHandle": "default", - "id": "reactflow__edge-STEPPER_DRIVER_TIC-deb4fca7-fc18-443d-bd70-f1455a749effdefault-END-04176810-8104-4747-9a8f-df79d12c5298default" - } - ], + "edges": [], "viewport": { "x": -358.59636577932724, "y": 99.85117439980638, diff --git a/docs/nodes/INSTRUMENTS/STEPPER_MOTOR/STEPPER_DRIVER_TIC_KNOB/examples/EX1/app.txt b/docs/nodes/INSTRUMENTS/STEPPER_MOTOR/STEPPER_DRIVER_TIC_KNOB/examples/EX1/app.txt index baba9961ed..e0a12da8f6 100644 --- a/docs/nodes/INSTRUMENTS/STEPPER_MOTOR/STEPPER_DRIVER_TIC_KNOB/examples/EX1/app.txt +++ b/docs/nodes/INSTRUMENTS/STEPPER_MOTOR/STEPPER_DRIVER_TIC_KNOB/examples/EX1/app.txt @@ -1,49 +1,16 @@ { "rfInstance": { "nodes": [ - { - "width": 210, - "height": 130, - "id": "END-04176810-8104-4747-9a8f-df79d12c5298", - "type": "TERMINATORS", - "data": { - "id": "END-04176810-8104-4747-9a8f-df79d12c5298", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 1285.4771983735734, - "y": 8.31834275095261 - }, - "selected": false, - "positionAbsolute": { - "x": 1285.4771983735734, - "y": 8.31834275095261 - }, - "dragging": true - }, { "width": 150, "height": 150, "id": "STEPPER_DRIVER_TIC_KNOB-3b234e79-4648-4661-a8e8-3e14b3d0e72b", - "type": "STEPPER_MOTOR", + "type": "INSTRUMENTS", "data": { "id": "STEPPER_DRIVER_TIC_KNOB-3b234e79-4648-4661-a8e8-3e14b3d0e72b", "label": "STEPPER DRIVER TIC KNOB", "func": "STEPPER_DRIVER_TIC_KNOB", - "type": "STEPPER_MOTOR", + "type": "INSTRUMENTS", "ctrls": { "knob_value": { "type": "int", @@ -96,13 +63,13 @@ } ], "path": "PYTHON/nodes/INSTRUMENTS/STEPPER_MOTOR/STEPPER_DRIVER_TIC_KNOB/STEPPER_DRIVER_TIC_KNOB.py", - "selected": true + "selected": false }, "position": { "x": 934.1949826356821, "y": -1.452956731347598 }, - "selected": true, + "selected": false, "positionAbsolute": { "x": 934.1949826356821, "y": -1.452956731347598 @@ -110,15 +77,7 @@ "dragging": true } ], - "edges": [ - { - "source": "STEPPER_DRIVER_TIC_KNOB-3b234e79-4648-4661-a8e8-3e14b3d0e72b", - "sourceHandle": "default", - "target": "END-04176810-8104-4747-9a8f-df79d12c5298", - "targetHandle": "default", - "id": "reactflow__edge-STEPPER_DRIVER_TIC_KNOB-3b234e79-4648-4661-a8e8-3e14b3d0e72bdefault-END-04176810-8104-4747-9a8f-df79d12c5298default" - } - ], + "edges": [], "viewport": { "x": -358.59636577932724, "y": 99.85117439980638, diff --git a/docs/nodes/INSTRUMENTS/WEB_CAM/CAMERA/examples/EX1/app.txt b/docs/nodes/INSTRUMENTS/WEB_CAM/CAMERA/examples/EX1/app.txt index 152559298b..b0da688128 100644 --- a/docs/nodes/INSTRUMENTS/WEB_CAM/CAMERA/examples/EX1/app.txt +++ b/docs/nodes/INSTRUMENTS/WEB_CAM/CAMERA/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 150, "height": 150, "id": "CAMERA-29dc2b2f-b87c-46a3-9ddc-11e685de3206", - "type": "WEB_CAM", + "type": "INSTRUMENTS", "data": { "id": "CAMERA-29dc2b2f-b87c-46a3-9ddc-11e685de3206", "label": "CAMERA", "func": "CAMERA", - "type": "WEB_CAM", + "type": "INSTRUMENTS", "ctrls": { "camera_ind": { "type": "int", @@ -69,49 +69,16 @@ }, "dragging": true }, - { - "width": 210, - "height": 130, - "id": "END-238f7854-48d7-4171-bfe7-d376550d8ba5", - "type": "TERMINATORS", - "data": { - "id": "END-238f7854-48d7-4171-bfe7-d376550d8ba5", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": true - }, - "position": { - "x": 1628.0823470465116, - "y": -29.451507877603746 - }, - "selected": true, - "positionAbsolute": { - "x": 1628.0823470465116, - "y": -29.451507877603746 - }, - "dragging": true - }, { "width": 225, "height": 226, "id": "IMAGE-cd503f68-87fd-478a-b577-baa959f3df08", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "IMAGE-cd503f68-87fd-478a-b577-baa959f3df08", "label": "IMAGE", "func": "IMAGE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -150,13 +117,6 @@ "target": "IMAGE-cd503f68-87fd-478a-b577-baa959f3df08", "targetHandle": "default", "id": "reactflow__edge-CAMERA-29dc2b2f-b87c-46a3-9ddc-11e685de3206default-IMAGE-cd503f68-87fd-478a-b577-baa959f3df08default" - }, - { - "source": "IMAGE-cd503f68-87fd-478a-b577-baa959f3df08", - "sourceHandle": "default", - "target": "END-238f7854-48d7-4171-bfe7-d376550d8ba5", - "targetHandle": "default", - "id": "reactflow__edge-IMAGE-cd503f68-87fd-478a-b577-baa959f3df08default-END-238f7854-48d7-4171-bfe7-d376550d8ba5default" } ], "viewport": { diff --git a/docs/nodes/LOADERS/CLOUD_DATABASE/LOADER/a1-[autogen]/python_code.txt b/docs/nodes/LOADERS/CLOUD_DATABASE/LOADER/a1-[autogen]/python_code.txt index 39294adec0..0ee8125669 100644 --- a/docs/nodes/LOADERS/CLOUD_DATABASE/LOADER/a1-[autogen]/python_code.txt +++ b/docs/nodes/LOADERS/CLOUD_DATABASE/LOADER/a1-[autogen]/python_code.txt @@ -1,47 +1,66 @@ import json import os +from typing import Optional import requests -from flojoy import DataContainer, flojoy -from flojoy.utils import PlotlyJSONEncoder, get_frontier_api_key +from flojoy import DataContainer, flojoy, get_env_var +from flojoy.utils import PlotlyJSONEncoder -FRONTIER_URI: str = os.environ.get("FRONTIER_URI") or "https://frontier.flojoy.io" -MEASUREMENT_API: str = f"{FRONTIER_URI}/api/streaming" + +FRONTIER_URI: str = os.environ.get("FRONTIER_URI") or "https://cloud.flojoy.ai" @flojoy -def LOADER(default: DataContainer, measurement_uuid: str = "") -> DataContainer: - api_key: str | None = get_frontier_api_key() - if api_key is None: - raise KeyError(f"Frontier API key is not found!") +def LOADER( + default: DataContainer, + measurement_id: Optional[str] = None, + dc_id: Optional[str] = None, +) -> DataContainer: + api_key = get_env_var("FLOJOY_CLOUD_API_KEY") - if measurement_uuid == "": - raise KeyError(f"Measurement ID is not found!") + if api_key is None: + raise KeyError("Frontier API key is not found!") if default: - resp = requests.post( - MEASUREMENT_API, - json={ - "api_key": api_key, - "measurement_id": measurement_uuid, - "measurement": json.dumps(default, cls=PlotlyJSONEncoder), - }, - ) - if not (resp.status_code == 200 or resp.status_code == 201): + # This will stream the data to the cloud + resp: requests.Response + if measurement_id is None: + resp = requests.post( + f"{FRONTIER_URI}/api/v1/measurements/{measurement_id}", + headers={"api_key": api_key}, + json={ + "measurement": json.dumps(default, cls=PlotlyJSONEncoder), + }, + ) + + else: + resp = requests.post( + f"{FRONTIER_URI}/api/v1/dcs", + headers={"api_key": api_key}, + json={ + "measurement_id": measurement_id, + "measurement": json.dumps(default, cls=PlotlyJSONEncoder), + }, + ) + + if not (resp.status_code >= 200 and resp.status_code < 300): raise Exception(str(resp.json()["error"])) + return default else: + # If there is nothing connected to the node, then it will download from cloud + if dc_id is None: + raise Exception("A data container ID is required for downstreaming") + resp = requests.get( - MEASUREMENT_API, - params={ - "api_key": api_key, - "measurement_id": measurement_uuid, - }, + f"{FRONTIER_URI}/api/v1/dcs/{dc_id}", + headers={"api_key": api_key}, ) print(resp.json()) - # TODO: now it only supports x and y, and it only loads the first entry + # TODO: now it only supports x and y if not (resp.status_code == 200 or resp.status_code == 201): raise Exception(resp.json()["error"]) + return DataContainer( x=resp.json()["data"][0]["dataContainer"]["x"], y=resp.json()["data"][0]["dataContainer"]["y"], diff --git a/docs/nodes/LOADERS/CLOUD_DATABASE/LOADER/examples/EX1/app.txt b/docs/nodes/LOADERS/CLOUD_DATABASE/LOADER/examples/EX1/app.txt index 7ecb56d805..3f35aead07 100644 --- a/docs/nodes/LOADERS/CLOUD_DATABASE/LOADER/examples/EX1/app.txt +++ b/docs/nodes/LOADERS/CLOUD_DATABASE/LOADER/examples/EX1/app.txt @@ -47,12 +47,12 @@ "width": 130, "height": 130, "id": "CONSTANT-ee40698d-60e6-4eb4-88b5-4d19e0c41138", - "type": "SIMULATION", + "type": "GENERATORS", "data": { "id": "CONSTANT-ee40698d-60e6-4eb4-88b5-4d19e0c41138", "label": "12", "func": "CONSTANT", - "type": "SIMULATION", + "type": "GENERATORS", "ctrls": { "constant": { "functionName": "CONSTANT", @@ -104,70 +104,16 @@ }, "dragging": true }, - { - "width": 150, - "height": 150, - "id": "GOTO-d1e8f8ee-4907-4fd5-9d89-2f65351c2263", - "type": "LOOP", - "data": { - "id": "GOTO-d1e8f8ee-4907-4fd5-9d89-2f65351c2263", - "label": "Goto Loop", - "func": "GOTO", - "type": "LOOP", - "ctrls": { - "goto_node_id": { - "functionName": "GOTO", - "param": "goto_node_id", - "value": "LOOP-faed7bdc-f766-4742-b48f-d31a7b8083fb" - } - }, - "selected": false - }, - "position": { - "x": 1314.5272324794553, - "y": 311.04162375361295 - }, - "selected": false, - "positionAbsolute": { - "x": 1314.5272324794553, - "y": 311.04162375361295 - }, - "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-12d90ef2-4084-4532-94f2-dde2ba198b79", - "type": "TERMINATOR", - "data": { - "id": "END-12d90ef2-4084-4532-94f2-dde2ba198b79", - "label": "Terminate", - "func": "END", - "type": "TERMINATOR", - "ctrls": {}, - "selected": false - }, - "position": { - "x": 478.0211151222852, - "y": -26.63223441103102 - }, - "selected": false, - "positionAbsolute": { - "x": 478.0211151222852, - "y": -26.63223441103102 - }, - "dragging": true - }, { "width": 130, "height": 130, "id": "FEEDBACK-bce3a2a9-20e8-4841-8404-1d91fcfac4f0", - "type": "SIMULATION", + "type": "GENERATORS", "data": { "id": "FEEDBACK-bce3a2a9-20e8-4841-8404-1d91fcfac4f0", "label": "FeedBack", "func": "FEEDBACK", - "type": "SIMULATION", + "type": "GENERATORS", "ctrls": { "referred_node": { "functionName": "FEEDBACK", @@ -192,12 +138,12 @@ "width": 150, "height": 150, "id": "LOADER-0ade6235-d420-468c-89af-bc408aee3a24", - "type": "CLOUD_DATABASE", + "type": "LOADERS", "data": { "id": "LOADER-0ade6235-d420-468c-89af-bc408aee3a24", "label": "LOADER", "func": "LOADER", - "type": "CLOUD_DATABASE", + "type": "LOADERS", "ctrls": { "measurement_uuid": { "functionName": "LOADER", @@ -222,12 +168,12 @@ "width": 130, "height": 130, "id": "CONSTANT-a17e1542-74ca-4999-985f-e69f71750b1a", - "type": "SIMULATION", + "type": "GENERATORS", "data": { "id": "CONSTANT-a17e1542-74ca-4999-985f-e69f71750b1a", "label": "-1", "func": "CONSTANT", - "type": "SIMULATION", + "type": "GENERATORS", "ctrls": { "constant": { "functionName": "CONSTANT", @@ -252,12 +198,12 @@ "width": 130, "height": 130, "id": "CONSTANT-dae9c5e6-fa8a-4f2c-8d56-f77445749237", - "type": "SIMULATION", + "type": "GENERATORS", "data": { "id": "CONSTANT-dae9c5e6-fa8a-4f2c-8d56-f77445749237", "label": "42", "func": "CONSTANT", - "type": "SIMULATION", + "type": "GENERATORS", "ctrls": { "constant": { "functionName": "CONSTANT", @@ -287,13 +233,6 @@ "targetHandle": "CONSTANT", "id": "reactflow__edge-LOOP-faed7bdc-f766-4742-b48f-d31a7b8083fbbody-CONSTANT-ee40698d-60e6-4eb4-88b5-4d19e0c41138CONSTANT" }, - { - "source": "LOOP-faed7bdc-f766-4742-b48f-d31a7b8083fb", - "sourceHandle": "end", - "target": "END-12d90ef2-4084-4532-94f2-dde2ba198b79", - "targetHandle": "END", - "id": "reactflow__edge-LOOP-faed7bdc-f766-4742-b48f-d31a7b8083fbend-END-12d90ef2-4084-4532-94f2-dde2ba198b79END" - }, { "source": "CONSTANT-ee40698d-60e6-4eb4-88b5-4d19e0c41138", "sourceHandle": "main", @@ -315,13 +254,6 @@ "targetHandle": "LOADER", "id": "reactflow__edge-ADD-0758c6a8-52b4-4b5b-9c46-2a83bdef2a04main-LOADER-0ade6235-d420-468c-89af-bc408aee3a24LOADER" }, - { - "source": "LOADER-0ade6235-d420-468c-89af-bc408aee3a24", - "sourceHandle": "main", - "target": "GOTO-d1e8f8ee-4907-4fd5-9d89-2f65351c2263", - "targetHandle": "GOTO", - "id": "reactflow__edge-LOADER-0ade6235-d420-468c-89af-bc408aee3a24main-GOTO-d1e8f8ee-4907-4fd5-9d89-2f65351c2263GOTO" - }, { "source": "LOOP-faed7bdc-f766-4742-b48f-d31a7b8083fb", "sourceHandle": "body", diff --git a/docs/nodes/LOADERS/LOCAL_FILE_SYSTEM/LOCAL_FILE/LOCAL_FILE.md b/docs/nodes/LOADERS/LOCAL_FILE_SYSTEM/LOCAL_FILE/LOCAL_FILE.md index 0cd1dfcbf7..9a40781440 100644 --- a/docs/nodes/LOADERS/LOCAL_FILE_SYSTEM/LOCAL_FILE/LOCAL_FILE.md +++ b/docs/nodes/LOADERS/LOCAL_FILE_SYSTEM/LOCAL_FILE/LOCAL_FILE.md @@ -25,13 +25,13 @@ import PythonSource from '!!raw-loader!./a1-[autogen]/python_code.txt'; import Example1 from './examples/EX1/example.md'; import App1 from '!!raw-loader!./examples/EX1/app.txt'; - - +import appImg from './examples/EX1/app.jpeg' +import outputImg from './examples/EX1/output.jpeg' {App1} diff --git a/docs/nodes/LOADERS/LOCAL_FILE_SYSTEM/LOCAL_FILE/a1-[autogen]/python_code.txt b/docs/nodes/LOADERS/LOCAL_FILE_SYSTEM/LOCAL_FILE/a1-[autogen]/python_code.txt index bc52fd723a..b64600f1e5 100644 --- a/docs/nodes/LOADERS/LOCAL_FILE_SYSTEM/LOCAL_FILE/a1-[autogen]/python_code.txt +++ b/docs/nodes/LOADERS/LOCAL_FILE_SYSTEM/LOCAL_FILE/a1-[autogen]/python_code.txt @@ -1,4 +1,4 @@ -from flojoy import flojoy, Image, DataFrame +from flojoy import flojoy, Image, DataFrame, Bytes from typing import Literal import numpy as np from PIL import Image as PIL_Image @@ -14,11 +14,11 @@ def get_file_path(file_path: str, default_path: str | None = None): return f_path -@flojoy(deps={"xlrd": "2.0.1", "lxml": "4.9.2"}) +@flojoy(deps={"xlrd": "2.0.1", "lxml": "4.9.2", "openpyxl": "3.0.10"}) def LOCAL_FILE( file_path: str, - file_type: Literal["Image", "JSON", "CSV", "Excel", "XML"] = "Image", -) -> Image | DataFrame: + file_type: Literal["Image", "JSON", "CSV", "Excel", "XML", "mp3", "wav"] = "Image", +) -> Image | DataFrame | Bytes: match file_type: case "Image": @@ -59,3 +59,8 @@ def LOCAL_FILE( file_path = get_file_path(file_path) df = pd.read_excel(file_path) return DataFrame(df=df) + case "mp3" | "wav": + file_path = get_file_path(file_path) + with open(file_path, "rb") as inp: + audio_bytes_stream = inp.read() + return Bytes(b=audio_bytes_stream) diff --git a/docs/nodes/LOADERS/LOCAL_FILE_SYSTEM/LOCAL_FILE/examples/EX1/app.txt b/docs/nodes/LOADERS/LOCAL_FILE_SYSTEM/LOCAL_FILE/examples/EX1/app.txt index b16c0f75c1..ca89aa46e4 100644 --- a/docs/nodes/LOADERS/LOCAL_FILE_SYSTEM/LOCAL_FILE/examples/EX1/app.txt +++ b/docs/nodes/LOADERS/LOCAL_FILE_SYSTEM/LOCAL_FILE/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 150, "height": 150, "id": "LOCAL_FILE-f21874a3-6a2f-4f64-ae87-faebdfba5c6d", - "type": "LOCAL_FILE_SYSTEM", + "type": "LOADERS", "data": { "id": "LOCAL_FILE-f21874a3-6a2f-4f64-ae87-faebdfba5c6d", "label": "LOCAL FILE", "func": "LOCAL_FILE", - "type": "LOCAL_FILE_SYSTEM", + "type": "LOADERS", "ctrls": { "file_path": { "type": "str", @@ -69,12 +69,12 @@ "width": 380, "height": 293, "id": "IMAGE-c69df1a9-06a0-41aa-beb2-41bc8a400ed5", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "IMAGE-c69df1a9-06a0-41aa-beb2-41bc8a400ed5", "label": "IMAGE", "func": "IMAGE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -104,39 +104,6 @@ "y": 79.87310163004685 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-796cba6c-8b14-44eb-9236-6e57d899421d", - "type": "TERMINATORS", - "data": { - "id": "END-796cba6c-8b14-44eb-9236-6e57d899421d", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", - "selected": false - }, - "position": { - "x": 1089.9445089046596, - "y": 167.0159587729039 - }, - "selected": false, - "positionAbsolute": { - "x": 1089.9445089046596, - "y": 167.0159587729039 - }, - "dragging": true } ], "edges": [ @@ -146,13 +113,6 @@ "target": "IMAGE-c69df1a9-06a0-41aa-beb2-41bc8a400ed5", "targetHandle": "default", "id": "reactflow__edge-LOCAL_FILE-f21874a3-6a2f-4f64-ae87-faebdfba5c6ddefault-IMAGE-c69df1a9-06a0-41aa-beb2-41bc8a400ed5default" - }, - { - "source": "IMAGE-c69df1a9-06a0-41aa-beb2-41bc8a400ed5", - "sourceHandle": "default", - "target": "END-796cba6c-8b14-44eb-9236-6e57d899421d", - "targetHandle": "default", - "id": "reactflow__edge-IMAGE-c69df1a9-06a0-41aa-beb2-41bc8a400ed5default-END-796cba6c-8b14-44eb-9236-6e57d899421ddefault" } ], "viewport": { diff --git a/docs/nodes/LOADERS/LOCAL_FILE_SYSTEM/OPEN_MATLAB/examples/EX1/app.txt b/docs/nodes/LOADERS/LOCAL_FILE_SYSTEM/OPEN_MATLAB/examples/EX1/app.txt index bc73a9464b..9e707cd660 100644 --- a/docs/nodes/LOADERS/LOCAL_FILE_SYSTEM/OPEN_MATLAB/examples/EX1/app.txt +++ b/docs/nodes/LOADERS/LOCAL_FILE_SYSTEM/OPEN_MATLAB/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 150, "height": 150, "id": "OPEN_MATLAB-ca242c1a-4bfc-4c1c-bf96-a1b556428e0d", - "type": "LOCAL_FILE_SYSTEM", + "type": "LOADERS", "data": { "id": "OPEN_MATLAB-ca242c1a-4bfc-4c1c-bf96-a1b556428e0d", "label": "OPEN MATLAB", "func": "OPEN_MATLAB", - "type": "LOCAL_FILE_SYSTEM", + "type": "LOADERS", "ctrls": { "file_path": { "type": "str", @@ -44,12 +44,12 @@ "width": 240, "height": 260, "id": "ARRAY_VIEW-ae48effe-f242-41ee-8822-93fb92679ecd", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "ARRAY_VIEW-ae48effe-f242-41ee-8822-93fb92679ecd", "label": "ARRAY VIEW", "func": "ARRAY_VIEW", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -79,39 +79,6 @@ "y": 335.0194036085589 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-18bb38b6-6e7b-422b-8e63-c9333fc29eb6", - "type": "TERMINATORS", - "data": { - "id": "END-18bb38b6-6e7b-422b-8e63-c9333fc29eb6", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": true - }, - "position": { - "x": 1589.3591099328337, - "y": 408.7666562279173 - }, - "selected": true, - "positionAbsolute": { - "x": 1589.3591099328337, - "y": 408.7666562279173 - }, - "dragging": true } ], "edges": [ @@ -121,13 +88,6 @@ "target": "ARRAY_VIEW-ae48effe-f242-41ee-8822-93fb92679ecd", "targetHandle": "default", "id": "reactflow__edge-OPEN_MATLAB-ca242c1a-4bfc-4c1c-bf96-a1b556428e0ddefault-ARRAY_VIEW-ae48effe-f242-41ee-8822-93fb92679ecddefault" - }, - { - "source": "ARRAY_VIEW-ae48effe-f242-41ee-8822-93fb92679ecd", - "sourceHandle": "default", - "target": "END-18bb38b6-6e7b-422b-8e63-c9333fc29eb6", - "targetHandle": "default", - "id": "reactflow__edge-ARRAY_VIEW-ae48effe-f242-41ee-8822-93fb92679ecddefault-END-18bb38b6-6e7b-422b-8e63-c9333fc29eb6default" } ], "viewport": { diff --git a/docs/nodes/LOGIC_GATES/CONDITIONALS/CONDITIONAL/examples/EX1/app.txt b/docs/nodes/LOGIC_GATES/CONDITIONALS/CONDITIONAL/examples/EX1/app.txt index c907d9a988..ab90846aa2 100644 --- a/docs/nodes/LOGIC_GATES/CONDITIONALS/CONDITIONAL/examples/EX1/app.txt +++ b/docs/nodes/LOGIC_GATES/CONDITIONALS/CONDITIONAL/examples/EX1/app.txt @@ -72,12 +72,12 @@ "width": 130, "height": 130, "id": "CONSTANT-3ab4671f-65c7-48d6-a2c2-d03c4cd4bd8f", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "CONSTANT-3ab4671f-65c7-48d6-a2c2-d03c4cd4bd8f", "label": "8", "func": "CONSTANT", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "constant": { "type": "float", @@ -120,12 +120,12 @@ "width": 130, "height": 130, "id": "CONSTANT-8ac72ae0-8f52-47e4-a1c9-76167f0b0706", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "CONSTANT-8ac72ae0-8f52-47e4-a1c9-76167f0b0706", "label": "4", "func": "CONSTANT", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "constant": { "type": "float", @@ -168,12 +168,12 @@ "width": 380, "height": 293, "id": "LINE-3c753e5a-5d90-4d92-92f9-b955d32bd24e", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-3c753e5a-5d90-4d92-92f9-b955d32bd24e", "label": "LINE", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -208,12 +208,12 @@ "width": 225, "height": 226, "id": "LINE-6a05bf10-f19b-401d-b8e4-0a4d56d8f27c", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-6a05bf10-f19b-401d-b8e4-0a4d56d8f27c", "label": "LINE 1", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -243,72 +243,6 @@ "y": 333.5593015742577 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-daab7962-8e6b-40db-8e40-b4e3a819279d", - "type": "TERMINATORS", - "data": { - "id": "END-daab7962-8e6b-40db-8e40-b4e3a819279d", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", - "selected": true - }, - "position": { - "x": 1118.8842817507389, - "y": 56.72683796976071 - }, - "selected": true, - "positionAbsolute": { - "x": 1118.8842817507389, - "y": 56.72683796976071 - }, - "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-a52e223f-0b17-4e49-8113-eb849b9886bf", - "type": "TERMINATORS", - "data": { - "id": "END-a52e223f-0b17-4e49-8113-eb849b9886bf", - "label": "END 1", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", - "selected": false - }, - "position": { - "x": 1109.6029321227763, - "y": 375.92720318857823 - }, - "selected": false, - "positionAbsolute": { - "x": 1109.6029321227763, - "y": 375.92720318857823 - }, - "dragging": true } ], "edges": [ @@ -333,26 +267,12 @@ "targetHandle": "default", "id": "reactflow__edge-CONDITIONAL-c44f8006-f1fb-41be-ab39-de40becaf62ctrue-LINE-3c753e5a-5d90-4d92-92f9-b955d32bd24edefault" }, - { - "source": "LINE-3c753e5a-5d90-4d92-92f9-b955d32bd24e", - "sourceHandle": "default", - "target": "END-daab7962-8e6b-40db-8e40-b4e3a819279d", - "targetHandle": "default", - "id": "reactflow__edge-LINE-3c753e5a-5d90-4d92-92f9-b955d32bd24edefault-END-daab7962-8e6b-40db-8e40-b4e3a819279ddefault" - }, { "source": "CONDITIONAL-c44f8006-f1fb-41be-ab39-de40becaf62c", "sourceHandle": "false", "target": "LINE-6a05bf10-f19b-401d-b8e4-0a4d56d8f27c", "targetHandle": "default", "id": "reactflow__edge-CONDITIONAL-c44f8006-f1fb-41be-ab39-de40becaf62cfalse-LINE-6a05bf10-f19b-401d-b8e4-0a4d56d8f27cdefault" - }, - { - "source": "LINE-6a05bf10-f19b-401d-b8e4-0a4d56d8f27c", - "sourceHandle": "default", - "target": "END-a52e223f-0b17-4e49-8113-eb849b9886bf", - "targetHandle": "default", - "id": "reactflow__edge-LINE-6a05bf10-f19b-401d-b8e4-0a4d56d8f27cdefault-END-a52e223f-0b17-4e49-8113-eb849b9886bfdefault" } ], "viewport": { diff --git a/docs/nodes/LOGIC_GATES/LOOPS/APPEND/examples/EX1/app.txt b/docs/nodes/LOGIC_GATES/LOOPS/APPEND/examples/EX1/app.txt index 16f99d6db6..287d30d6e6 100644 --- a/docs/nodes/LOGIC_GATES/LOOPS/APPEND/examples/EX1/app.txt +++ b/docs/nodes/LOGIC_GATES/LOOPS/APPEND/examples/EX1/app.txt @@ -1,49 +1,16 @@ { "rfInstance": { "nodes": [ - { - "width": 210, - "height": 130, - "id": "END-aa17356b-c7af-408e-8c56-531a3fe595d1", - "type": "TERMINATORS", - "data": { - "id": "END-aa17356b-c7af-408e-8c56-531a3fe595d1", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 1083.6954766397828, - "y": 123.17066593843452 - }, - "selected": false, - "positionAbsolute": { - "x": 1083.6954766397828, - "y": 123.17066593843452 - }, - "dragging": true - }, { "width": 150, "height": 150, "id": "APPEND-a2c9923a-6e0d-4eee-9075-b898669afef4", - "type": "LOOPS", + "type": "LOGIC_GATES", "data": { "id": "APPEND-a2c9923a-6e0d-4eee-9075-b898669afef4", "label": "APPEND", "func": "APPEND", - "type": "LOOPS", + "type": "LOGIC_GATES", "ctrls": {}, "inputs": [ { @@ -84,12 +51,12 @@ "width": 130, "height": 130, "id": "RAND-c7739b2a-89f6-46fd-ac17-b3fdbec8c586", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "RAND-c7739b2a-89f6-46fd-ac17-b3fdbec8c586", "label": "RAND", "func": "RAND", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "distribution": { "type": "select", @@ -155,13 +122,13 @@ } ], "path": "PYTHON/nodes/GENERATORS/SIMULATIONS/RAND/RAND.py", - "selected": true + "selected": false }, "position": { "x": -116.99910130481645, "y": 31.67641795910953 }, - "selected": true, + "selected": false, "positionAbsolute": { "x": -116.99910130481645, "y": 31.67641795910953 @@ -296,12 +263,12 @@ "width": 130, "height": 130, "id": "RAND-604d3223-83f7-4e62-851c-567cf7d10cfe", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "RAND-604d3223-83f7-4e62-851c-567cf7d10cfe", "label": "RAND 1", "func": "RAND", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "distribution": { "type": "select", @@ -384,12 +351,12 @@ "width": 380, "height": 293, "id": "SCATTER-fe4b85c2-0917-4786-a715-836201d919cf", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "SCATTER-fe4b85c2-0917-4786-a715-836201d919cf", "label": "SCATTER 1", "func": "SCATTER", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -424,12 +391,12 @@ "width": 380, "height": 293, "id": "SCATTER-ee3d567b-33c6-4700-a8ff-dd4f091e2d27", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "SCATTER-ee3d567b-33c6-4700-a8ff-dd4f091e2d27", "label": "SCATTER 1", "func": "SCATTER", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -503,13 +470,6 @@ "target": "SCATTER-fe4b85c2-0917-4786-a715-836201d919cf", "targetHandle": "default", "id": "reactflow__edge-APPEND-a2c9923a-6e0d-4eee-9075-b898669afef4default-SCATTER-fe4b85c2-0917-4786-a715-836201d919cfdefault" - }, - { - "source": "SCATTER-fe4b85c2-0917-4786-a715-836201d919cf", - "sourceHandle": "default", - "target": "END-aa17356b-c7af-408e-8c56-531a3fe595d1", - "targetHandle": "default", - "id": "reactflow__edge-SCATTER-fe4b85c2-0917-4786-a715-836201d919cfdefault-END-aa17356b-c7af-408e-8c56-531a3fe595d1default" } ], "viewport": { @@ -537,4 +497,4 @@ } } ] -} +} \ No newline at end of file diff --git a/docs/nodes/LOGIC_GATES/LOOPS/LOOP/a1-[autogen]/docstring.txt b/docs/nodes/LOGIC_GATES/LOOPS/LOOP/a1-[autogen]/docstring.txt index 488d8c9033..f57b598a45 100644 --- a/docs/nodes/LOGIC_GATES/LOOPS/LOOP/a1-[autogen]/docstring.txt +++ b/docs/nodes/LOGIC_GATES/LOOPS/LOOP/a1-[autogen]/docstring.txt @@ -1,8 +1,6 @@ The LOOP node is a specialized node that iterates through the body nodes for a given number of times. - To ensure proper functionality, the LOOP node relies on a companion node called the `GOTO` node. Parameters ---------- num_loops : int number of times to iterate through body nodes default is `-1` meaning infinity. - \ No newline at end of file diff --git a/docs/nodes/LOGIC_GATES/LOOPS/LOOP/examples/EX1/app.jpeg b/docs/nodes/LOGIC_GATES/LOOPS/LOOP/examples/EX1/app.jpeg index aa30a106fc..9fd52bb34f 100644 Binary files a/docs/nodes/LOGIC_GATES/LOOPS/LOOP/examples/EX1/app.jpeg and b/docs/nodes/LOGIC_GATES/LOOPS/LOOP/examples/EX1/app.jpeg differ diff --git a/docs/nodes/LOGIC_GATES/LOOPS/LOOP/examples/EX1/app.txt b/docs/nodes/LOGIC_GATES/LOOPS/LOOP/examples/EX1/app.txt index 33169bed43..95f5d226ae 100644 --- a/docs/nodes/LOGIC_GATES/LOOPS/LOOP/examples/EX1/app.txt +++ b/docs/nodes/LOGIC_GATES/LOOPS/LOOP/examples/EX1/app.txt @@ -2,109 +2,23 @@ "rfInstance": { "nodes": [ { - "width": 210, - "height": 130, - "id": "END-6555aed9-4f39-456f-94bb-2fae298ae88f", - "type": "TERMINATORS", + "width": 96, + "height": 96, + "id": "LOOP-e209afec-0fe8-41e1-a665-d055e0179cc7", + "type": "LOGIC_GATES", "data": { - "id": "END-6555aed9-4f39-456f-94bb-2fae298ae88f", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", - "selected": false - }, - "position": { - "x": 201.3357255930201, - "y": 557.2980747810793 - }, - "selected": false, - "positionAbsolute": { - "x": 201.3357255930201, - "y": 557.2980747810793 - }, - "dragging": true - }, - { - "width": 150, - "height": 150, - "id": "LINSPACE-69bc9f1e-8cc8-4878-b6a4-d9a06dd33a9a", - "type": "default", - "data": { - "id": "LINSPACE-69bc9f1e-8cc8-4878-b6a4-d9a06dd33a9a", - "label": "LINSPACE", - "func": "LINSPACE", - "type": "default", + "id": "LOOP-e209afec-0fe8-41e1-a665-d055e0179cc7", + "label": "LOOP", + "func": "LOOP", + "type": "LOGIC_GATES", "ctrls": { - "start": { - "type": "float", - "default": 10, - "functionName": "LINSPACE", - "param": "start", - "value": 10 - }, - "end": { - "type": "float", - "default": 0, - "functionName": "LINSPACE", - "param": "end", - "value": 0 - }, - "step": { + "num_loops": { "type": "int", - "default": 1000, - "functionName": "LINSPACE", - "param": "step", - "value": 1000 - } - }, - "outputs": [ - { - "name": "default", - "id": "default", - "type": "OrderedPair" - } - ], - "path": "PYTHON/nodes\\GENERATORS\\SIMULATIONS\\LINSPACE\\LINSPACE.py", - "selected": false - }, - "position": { - "x": -452.9499886926942, - "y": 298.72664620965077 - }, - "selected": false, - "positionAbsolute": { - "x": -452.9499886926942, - "y": 298.72664620965077 - }, - "dragging": true - }, - { - "width": 150, - "height": 150, - "id": "GOTO-c29d54b5-4478-42da-b59b-5e5b190a2ee6", - "type": "LOOPS", - "data": { - "id": "GOTO-c29d54b5-4478-42da-b59b-5e5b190a2ee6", - "label": "GOTO", - "func": "GOTO", - "type": "LOOPS", - "ctrls": { - "goto_node_id": { - "type": "NodeReference", - "default": "", - "functionName": "GOTO", - "param": "goto_node_id", - "value": "LOOP-05cb3304-8821-40d9-8c1a-035a2211090e" + "default": -1, + "desc": "number of times to iterate through body nodes default is `-1` meaning infinity.", + "functionName": "LOOP", + "param": "num_loops", + "value": "100" } }, "inputs": [ @@ -112,85 +26,52 @@ "name": "default", "id": "default", "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\LOOPS\\GOTO\\GOTO.py", - "selected": false - }, - "position": { - "x": 974.1928684501631, - "y": 260.15521763822215 - }, - "selected": false, - "positionAbsolute": { - "x": 974.1928684501631, - "y": 260.15521763822215 - }, - "dragging": true - }, - { - "width": 130, - "height": 130, - "id": "CONSTANT-b7112c9c-029c-4899-bd7f-ae304c690697", - "type": "SIMULATIONS", - "data": { - "id": "CONSTANT-b7112c9c-029c-4899-bd7f-ae304c690697", - "label": "2.0", - "func": "CONSTANT", - "type": "SIMULATIONS", - "ctrls": { - "constant": { - "type": "float", - "default": 3, - "functionName": "CONSTANT", - "param": "constant", - "value": "2.0" - } - }, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "OrderedPair", - "multiple": false + "multiple": false, + "desc": null } ], "outputs": [ { - "name": "default", - "id": "default", - "type": "OrderedPair" + "name": "body", + "id": "body", + "type": "Any", + "desc": null + }, + { + "name": "end", + "id": "end", + "type": "Any", + "desc": null } ], - "path": "PYTHON/nodes\\GENERATORS\\SIMULATIONS\\CONSTANT\\CONSTANT.py", + "path": "PYTHON/nodes/LOGIC_GATES/LOOPS/LOOP/LOOP.py", "selected": false }, "position": { - "x": 188.47858273587735, - "y": 384.4409319239364 + "x": 153.08826345429478, + "y": 125.76028881809133 }, "selected": false, "positionAbsolute": { - "x": 188.47858273587735, - "y": 384.4409319239364 - }, - "dragging": true + "x": 153.08826345429478, + "y": 125.76028881809133 + } }, { "width": 380, "height": 293, - "id": "BIG_NUMBER-e4942bf1-f23a-4344-80eb-c166dabb2dd2", - "type": "PLOTLY", + "id": "BIG_NUMBER-ca0dc263-0e3f-4c7e-9a71-50dd014ec851", + "type": "VISUALIZERS", "data": { - "id": "BIG_NUMBER-e4942bf1-f23a-4344-80eb-c166dabb2dd2", + "id": "BIG_NUMBER-ca0dc263-0e3f-4c7e-9a71-50dd014ec851", "label": "BIG NUMBER", "func": "BIG_NUMBER", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": { "suffix": { "type": "str", "default": null, + "desc": null, "functionName": "BIG_NUMBER", "param": "suffix", "value": "" @@ -198,6 +79,7 @@ "prefix": { "type": "str", "default": null, + "desc": null, "functionName": "BIG_NUMBER", "param": "prefix", "value": "" @@ -205,6 +87,7 @@ "title": { "type": "str", "default": null, + "desc": null, "functionName": "BIG_NUMBER", "param": "title", "value": "" @@ -212,6 +95,7 @@ "relative_delta": { "type": "bool", "default": true, + "desc": null, "functionName": "BIG_NUMBER", "param": "relative_delta", "value": true @@ -221,233 +105,105 @@ { "name": "default", "id": "default", - "type": "OrderedPair", - "multiple": false + "type": "OrderedPair|Scalar", + "multiple": false, + "desc": null } ], "outputs": [ { "name": "default", "id": "default", - "type": "Plotly" + "type": "Plotly", + "desc": null } ], - "path": "PYTHON/nodes\\VISUALIZERS\\PLOTLY\\BIG_NUMBER\\BIG_NUMBER.py", + "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/BIG_NUMBER/BIG_NUMBER.py", "selected": false }, "position": { - "x": 599.9071541644486, - "y": 217.29807478107926 + "x": 821.3726227277857, + "y": -56.51459992169677 }, "selected": false, "positionAbsolute": { - "x": 599.9071541644486, - "y": 217.29807478107926 + "x": 821.3726227277857, + "y": -56.51459992169677 }, "dragging": true }, { - "width": 210, - "height": 130, - "id": "LOOP-05cb3304-8821-40d9-8c1a-035a2211090e", - "type": "CONDITIONALS", + "width": 150, + "height": 180, + "id": "LOOP_INDEX-908a6860-ae5a-4be7-bff4-bb92070f526a", + "type": "default", "data": { - "id": "LOOP-05cb3304-8821-40d9-8c1a-035a2211090e", - "label": "LOOP", - "func": "LOOP", - "type": "CONDITIONALS", + "id": "LOOP_INDEX-908a6860-ae5a-4be7-bff4-bb92070f526a", + "label": "LOOP INDEX", + "func": "LOOP_INDEX", + "type": "default", "ctrls": { - "num_loops": { - "type": "int", - "default": -1, - "functionName": "LOOP", - "param": "num_loops", - "value": "10" + "loop_node": { + "type": "NodeReference", + "default": null, + "desc": "The LOOP node to track the loop index from.", + "functionName": "LOOP_INDEX", + "param": "loop_node", + "value": "LOOP-e209afec-0fe8-41e1-a665-d055e0179cc7" } }, "inputs": [ { "name": "default", "id": "default", - "type": "Any", - "multiple": false - } - ], - "outputs": [ - { - "name": "body", - "id": "body", - "type": "Any" - }, - { - "name": "end", - "id": "end", - "type": "Any" - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\LOOPS\\LOOP\\LOOP.py", - "selected": false - }, - "position": { - "x": -203.56512669590455, - "y": 281.08232359673536 - }, - "selected": false, - "positionAbsolute": { - "x": -203.56512669590455, - "y": 281.08232359673536 - }, - "dragging": true - }, - { - "width": 130, - "height": 130, - "id": "RAND-1e92e816-84fd-4fe0-8b74-293116963487", - "type": "SIMULATIONS", - "data": { - "id": "RAND-1e92e816-84fd-4fe0-8b74-293116963487", - "label": "RAND", - "func": "RAND", - "type": "SIMULATIONS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "OrderedPair", - "multiple": false + "type": "OrderedPair|Scalar", + "multiple": false, + "desc": null } ], "outputs": [ { "name": "default", "id": "default", - "type": "OrderedPair" + "type": "Scalar", + "desc": "The loop index in Scalar form." } ], - "path": "PYTHON/nodes\\GENERATORS\\SIMULATIONS\\RAND\\RAND.py", + "path": "PYTHON/nodes\\LOGIC_GATES\\LOOP_TOOLS\\LOOP_INDEX\\LOOP_INDEX.py", "selected": false }, "position": { - "x": 175.93112497840912, - "y": 148.7226449679037 + "x": 472.5656805220707, + "y": 3.5093485056772806 }, "selected": false, "positionAbsolute": { - "x": 175.93112497840912, - "y": 148.7226449679037 - }, - "dragging": true - }, - { - "width": 99, - "height": 130, - "id": "MULTIPLY-f5e99c8e-bf71-4dda-9dd9-4f75618990d4", - "type": "ARITHMETIC", - "data": { - "id": "MULTIPLY-f5e99c8e-bf71-4dda-9dd9-4f75618990d4", - "label": "MULTIPLY", - "func": "MULTIPLY", - "type": "ARITHMETIC", - "ctrls": {}, - "inputs": [ - { - "name": "a", - "id": "a", - "type": "OrderedPair", - "multiple": false - }, - { - "name": "b", - "id": "b", - "type": "OrderedPair", - "multiple": true - } - ], - "outputs": [ - { - "name": "default", - "id": "default", - "type": "OrderedPair" - } - ], - "path": "PYTHON/nodes\\TRANSFORMERS\\ARITHMETIC\\MULTIPLY\\MULTIPLY.py", - "selected": false - }, - "position": { - "x": 410.0735924539597, - "y": 244.1385709283291 - }, - "selected": false, - "positionAbsolute": { - "x": 410.0735924539597, - "y": 244.1385709283291 + "x": 472.5656805220707, + "y": 3.5093485056772806 }, "dragging": true } ], "edges": [ { - "source": "LINSPACE-69bc9f1e-8cc8-4878-b6a4-d9a06dd33a9a", - "sourceHandle": "default", - "target": "LOOP-05cb3304-8821-40d9-8c1a-035a2211090e", - "targetHandle": "default", - "id": "reactflow__edge-LINSPACE-69bc9f1e-8cc8-4878-b6a4-d9a06dd33a9adefault-LOOP-05cb3304-8821-40d9-8c1a-035a2211090edefault" - }, - { - "source": "LOOP-05cb3304-8821-40d9-8c1a-035a2211090e", - "sourceHandle": "body", - "target": "CONSTANT-b7112c9c-029c-4899-bd7f-ae304c690697", - "targetHandle": "default", - "id": "reactflow__edge-LOOP-05cb3304-8821-40d9-8c1a-035a2211090ebody-CONSTANT-b7112c9c-029c-4899-bd7f-ae304c690697default" - }, - { - "source": "LOOP-05cb3304-8821-40d9-8c1a-035a2211090e", - "sourceHandle": "end", - "target": "END-6555aed9-4f39-456f-94bb-2fae298ae88f", - "targetHandle": "default", - "id": "reactflow__edge-LOOP-05cb3304-8821-40d9-8c1a-035a2211090eend-END-6555aed9-4f39-456f-94bb-2fae298ae88fdefault" - }, - { - "source": "LOOP-05cb3304-8821-40d9-8c1a-035a2211090e", + "source": "LOOP-e209afec-0fe8-41e1-a665-d055e0179cc7", "sourceHandle": "body", - "target": "RAND-1e92e816-84fd-4fe0-8b74-293116963487", + "target": "LOOP_INDEX-908a6860-ae5a-4be7-bff4-bb92070f526a", "targetHandle": "default", - "id": "reactflow__edge-LOOP-05cb3304-8821-40d9-8c1a-035a2211090ebody-RAND-1e92e816-84fd-4fe0-8b74-293116963487default" - }, - { - "source": "BIG_NUMBER-e4942bf1-f23a-4344-80eb-c166dabb2dd2", - "sourceHandle": "default", - "target": "GOTO-c29d54b5-4478-42da-b59b-5e5b190a2ee6", - "targetHandle": "default", - "id": "reactflow__edge-BIG_NUMBER-e4942bf1-f23a-4344-80eb-c166dabb2dd2default-GOTO-c29d54b5-4478-42da-b59b-5e5b190a2ee6default" - }, - { - "source": "RAND-1e92e816-84fd-4fe0-8b74-293116963487", - "sourceHandle": "default", - "target": "MULTIPLY-f5e99c8e-bf71-4dda-9dd9-4f75618990d4", - "targetHandle": "a", - "id": "reactflow__edge-RAND-1e92e816-84fd-4fe0-8b74-293116963487default-MULTIPLY-f5e99c8e-bf71-4dda-9dd9-4f75618990d4a" - }, - { - "source": "CONSTANT-b7112c9c-029c-4899-bd7f-ae304c690697", - "sourceHandle": "default", - "target": "MULTIPLY-f5e99c8e-bf71-4dda-9dd9-4f75618990d4", - "targetHandle": "b", - "id": "reactflow__edge-CONSTANT-b7112c9c-029c-4899-bd7f-ae304c690697default-MULTIPLY-f5e99c8e-bf71-4dda-9dd9-4f75618990d4b" + "id": "reactflow__edge-LOOP-e209afec-0fe8-41e1-a665-d055e0179cc7body-LOOP_INDEX-908a6860-ae5a-4be7-bff4-bb92070f526adefault" }, { - "source": "MULTIPLY-f5e99c8e-bf71-4dda-9dd9-4f75618990d4", + "source": "LOOP_INDEX-908a6860-ae5a-4be7-bff4-bb92070f526a", "sourceHandle": "default", - "target": "BIG_NUMBER-e4942bf1-f23a-4344-80eb-c166dabb2dd2", + "target": "BIG_NUMBER-ca0dc263-0e3f-4c7e-9a71-50dd014ec851", "targetHandle": "default", - "id": "reactflow__edge-MULTIPLY-f5e99c8e-bf71-4dda-9dd9-4f75618990d4default-BIG_NUMBER-e4942bf1-f23a-4344-80eb-c166dabb2dd2default" + "id": "reactflow__edge-LOOP_INDEX-908a6860-ae5a-4be7-bff4-bb92070f526adefault-BIG_NUMBER-ca0dc263-0e3f-4c7e-9a71-50dd014ec851default" } ], "viewport": { - "x": -296.35399545928726, - "y": 66.8470830817738, - "zoom": 0.8744723800359967 + "x": 555.0976680981258, + "y": 214.4419430555007, + "zoom": 0.8287213244976164 } }, "ctrlsManifest": [ diff --git a/docs/nodes/LOGIC_GATES/LOOPS/LOOP/examples/EX1/example.md b/docs/nodes/LOGIC_GATES/LOOPS/LOOP/examples/EX1/example.md index 21b1de8270..4a881ba185 100644 --- a/docs/nodes/LOGIC_GATES/LOOPS/LOOP/examples/EX1/example.md +++ b/docs/nodes/LOGIC_GATES/LOOPS/LOOP/examples/EX1/example.md @@ -1,16 +1,12 @@ This example shows a simple way to create a loop with Flojoy. First, you'll need to place these three nodes: -- The [`LINSPACE`](https://github.com/flojoy-io/nodes/blob/main/GENERATORS/SIMULATIONS/LINSPACE/LINSPACE.py) node which will genearte evenly spaced numbers over a specified interval. This node is needed to pass value to LOOP node as it requires a input node. - - The [`LOOP`](https://github.com/flojoy-io/nodes/blob/main/LOGIC_GATES/LOOPS/LOOP/LOOP.py) node which will define the number of loops. -- The [`GOTO`](https://github.com/flojoy-io/nodes/blob/main/LOGIC_GATES/LOOPS/GOTO/GOTO.py) node will define where the loop ends. This node takes a parameter called 'referred_node' in which you can choose where the loop starts again (Generally, it's the [`LOOP`](https://github.com/flojoy-io/nodes/blob/main/LOGIC_GATES/LOOPS/LOOP/LOOP.py) node). - -- The [`END`](https://github.com/flojoy-io/nodes/blob/main/LOGIC_GATES/TERMINATORS/END/END.py) node which is connected to the "end" output of the [`LOOP`](https://github.com/flojoy-io/nodes/blob/main/LOGIC_GATES/LOOPS/LOOP/LOOP.py) node, which serve, to terminate the program. +- The [`LOOP_INDEX`](https://github.com/flojoy-io/nodes/blob/main/LOGIC_GATES/) node tracks the loop index (the number of loops that has occured). The index starts at 1 in Flojoy. -After that, we can place nodes to generate and visualize data within the loop : +- The [`BIG_NUMBER`](https://github.com/flojoy-io/nodes/blob/main/VISUALIZERS/PLOTLY/BIG_NUMBER/BIG_NUMBER.py) node which is connected to the "end" output of the [`LOOP`] node, which serve, to terminate the program. -A random number is generated by the node ['RAND'](https://github.com/flojoy-io/nodes/blob/main/GENERATORS/SIMULATIONS/CONSTANT/CONSTANT.py) and multiplied with a constant defined by the user with the node [`CONSTANT`](https://github.com/flojoy-io/nodes/blob/main/GENERATORS/SIMULATIONS/CONSTANT/CONSTANT.py). Finally the result is displayed with the visualization node [`BIG_NUMBER`](https://github.com/flojoy-io/nodes/blob/main/VISUALIZERS/PLOTLY/BIG_NUMBER/BIG_NUMBER.py) and updated during each iteration of the loop. +Then click on [`LOOP`] and change the number of loops to 100 (the default is -1 which causes the loop to repeat indefinitely). Click on [`LOOP_INDEX`] and change the referred node to [`LOOP`]. -After each iteration, the [`LOOP`](https://github.com/flojoy-io/nodes/blob/main/LOGIC_GATES/LOOPS/LOOP/LOOP.py) node checks if the remaining number of iterations is greater than zero. If so, it enqueues its body nodes again until the number of remaining iterations becomes zero. Finally, it enqueues the nodes connected to its "end" output. \ No newline at end of file +You can then run the app and watch the loop index increase to 100 as the loop continues. diff --git a/docs/nodes/LOGIC_GATES/LOOPS/LOOP/examples/EX1/output.jpeg b/docs/nodes/LOGIC_GATES/LOOPS/LOOP/examples/EX1/output.jpeg index 2b4b1e21d6..bf7d763e5f 100644 Binary files a/docs/nodes/LOGIC_GATES/LOOPS/LOOP/examples/EX1/output.jpeg and b/docs/nodes/LOGIC_GATES/LOOPS/LOOP/examples/EX1/output.jpeg differ diff --git a/docs/nodes/LOGIC_GATES/LOOP_TOOLS/LOOP_INDEX/LOOP_INDEX.md b/docs/nodes/LOGIC_GATES/LOOP_TOOLS/LOOP_INDEX/LOOP_INDEX.md new file mode 100644 index 0000000000..fe52427cc6 --- /dev/null +++ b/docs/nodes/LOGIC_GATES/LOOP_TOOLS/LOOP_INDEX/LOOP_INDEX.md @@ -0,0 +1,57 @@ + +[//]: # (Custom component imports) + +import DocString from '@site/src/components/DocString'; +import PythonCode from '@site/src/components/PythonCode'; +import AppDisplay from '@site/src/components/AppDisplay'; +import SectionBreak from '@site/src/components/SectionBreak'; +import AppendixSection from '@site/src/components/AppendixSection'; + +[//]: # (Docstring) + +import DocstringSource from '!!raw-loader!./a1-[autogen]/docstring.txt'; +import PythonSource from '!!raw-loader!./a1-[autogen]/python_code.txt'; + +{DocstringSource} +{PythonSource} + + + + + +[//]: # (Examples) + +## Examples + +import Example1 from './examples/EX1/example.md'; +import App1 from '!!raw-loader!./examples/EX1/app.txt'; + + + + + {App1} + + + + + + + + +[//]: # (Appendix) + +import Notes from '!!raw-loader!./appendix/notes.md'; +import Hardware from '!!raw-loader!./appendix/hardware.md'; +import Media from '!!raw-loader!./appendix/media.md'; + +## Appendix + +{Notes} +{Hardware} +{Media} + + diff --git a/docs/nodes/LOGIC_GATES/LOOP_TOOLS/LOOP_INDEX/a1-[autogen]/docstring.txt b/docs/nodes/LOGIC_GATES/LOOP_TOOLS/LOOP_INDEX/a1-[autogen]/docstring.txt new file mode 100644 index 0000000000..7b2c303ce7 --- /dev/null +++ b/docs/nodes/LOGIC_GATES/LOOP_TOOLS/LOOP_INDEX/a1-[autogen]/docstring.txt @@ -0,0 +1,12 @@ +The LOOP_INDEX node loads the loop index from the LOOP node. + A loop index in Flojoy starts at 1 and increases by 1 for each loop. + + Parameters + ---------- + loop_node: str + The LOOP node to track the loop index from. + + Returns + ------- + Scalar + The loop index in Scalar form. diff --git a/docs/nodes/LOGIC_GATES/LOOP_TOOLS/LOOP_INDEX/a1-[autogen]/python_code.txt b/docs/nodes/LOGIC_GATES/LOOP_TOOLS/LOOP_INDEX/a1-[autogen]/python_code.txt new file mode 100644 index 0000000000..35a7e7a12c --- /dev/null +++ b/docs/nodes/LOGIC_GATES/LOOP_TOOLS/LOOP_INDEX/a1-[autogen]/python_code.txt @@ -0,0 +1,32 @@ +from flojoy import ( + flojoy, + Scalar, + OrderedPair, + SmallMemory, + NodeReference, +) +from typing import Optional + + +memory_key = "LOOP_INDEX" + + +@flojoy(node_type="default") +def LOOP_INDEX( + loop_node: NodeReference, + default: Optional[OrderedPair | Scalar] = None, +) -> Scalar: + + + ref_loop_node = loop_node.unwrap() + + if ref_loop_node == "" or "LOOP" not in ref_loop_node: + raise ValueError("A LOOP node id must be given.") + + loop_info = SmallMemory().read_memory(ref_loop_node, "loop-info") + if loop_info is None: + c = 1 + else: + c = loop_info.get("current_iteration") + + return Scalar(c=float(c)) diff --git a/docs/nodes/LOGIC_GATES/LOOP_TOOLS/LOOP_INDEX/appendix/hardware.md b/docs/nodes/LOGIC_GATES/LOOP_TOOLS/LOOP_INDEX/appendix/hardware.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/nodes/LOGIC_GATES/LOOP_TOOLS/LOOP_INDEX/appendix/media.md b/docs/nodes/LOGIC_GATES/LOOP_TOOLS/LOOP_INDEX/appendix/media.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/nodes/LOGIC_GATES/LOOP_TOOLS/LOOP_INDEX/appendix/notes.md b/docs/nodes/LOGIC_GATES/LOOP_TOOLS/LOOP_INDEX/appendix/notes.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/nodes/LOGIC_GATES/LOOP_TOOLS/LOOP_INDEX/examples/EX1/app.txt b/docs/nodes/LOGIC_GATES/LOOP_TOOLS/LOOP_INDEX/examples/EX1/app.txt new file mode 100644 index 0000000000..95f5d226ae --- /dev/null +++ b/docs/nodes/LOGIC_GATES/LOOP_TOOLS/LOOP_INDEX/examples/EX1/app.txt @@ -0,0 +1,228 @@ +{ + "rfInstance": { + "nodes": [ + { + "width": 96, + "height": 96, + "id": "LOOP-e209afec-0fe8-41e1-a665-d055e0179cc7", + "type": "LOGIC_GATES", + "data": { + "id": "LOOP-e209afec-0fe8-41e1-a665-d055e0179cc7", + "label": "LOOP", + "func": "LOOP", + "type": "LOGIC_GATES", + "ctrls": { + "num_loops": { + "type": "int", + "default": -1, + "desc": "number of times to iterate through body nodes default is `-1` meaning infinity.", + "functionName": "LOOP", + "param": "num_loops", + "value": "100" + } + }, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Any", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "body", + "id": "body", + "type": "Any", + "desc": null + }, + { + "name": "end", + "id": "end", + "type": "Any", + "desc": null + } + ], + "path": "PYTHON/nodes/LOGIC_GATES/LOOPS/LOOP/LOOP.py", + "selected": false + }, + "position": { + "x": 153.08826345429478, + "y": 125.76028881809133 + }, + "selected": false, + "positionAbsolute": { + "x": 153.08826345429478, + "y": 125.76028881809133 + } + }, + { + "width": 380, + "height": 293, + "id": "BIG_NUMBER-ca0dc263-0e3f-4c7e-9a71-50dd014ec851", + "type": "VISUALIZERS", + "data": { + "id": "BIG_NUMBER-ca0dc263-0e3f-4c7e-9a71-50dd014ec851", + "label": "BIG NUMBER", + "func": "BIG_NUMBER", + "type": "VISUALIZERS", + "ctrls": { + "suffix": { + "type": "str", + "default": null, + "desc": null, + "functionName": "BIG_NUMBER", + "param": "suffix", + "value": "" + }, + "prefix": { + "type": "str", + "default": null, + "desc": null, + "functionName": "BIG_NUMBER", + "param": "prefix", + "value": "" + }, + "title": { + "type": "str", + "default": null, + "desc": null, + "functionName": "BIG_NUMBER", + "param": "title", + "value": "" + }, + "relative_delta": { + "type": "bool", + "default": true, + "desc": null, + "functionName": "BIG_NUMBER", + "param": "relative_delta", + "value": true + } + }, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair|Scalar", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": null + } + ], + "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/BIG_NUMBER/BIG_NUMBER.py", + "selected": false + }, + "position": { + "x": 821.3726227277857, + "y": -56.51459992169677 + }, + "selected": false, + "positionAbsolute": { + "x": 821.3726227277857, + "y": -56.51459992169677 + }, + "dragging": true + }, + { + "width": 150, + "height": 180, + "id": "LOOP_INDEX-908a6860-ae5a-4be7-bff4-bb92070f526a", + "type": "default", + "data": { + "id": "LOOP_INDEX-908a6860-ae5a-4be7-bff4-bb92070f526a", + "label": "LOOP INDEX", + "func": "LOOP_INDEX", + "type": "default", + "ctrls": { + "loop_node": { + "type": "NodeReference", + "default": null, + "desc": "The LOOP node to track the loop index from.", + "functionName": "LOOP_INDEX", + "param": "loop_node", + "value": "LOOP-e209afec-0fe8-41e1-a665-d055e0179cc7" + } + }, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair|Scalar", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Scalar", + "desc": "The loop index in Scalar form." + } + ], + "path": "PYTHON/nodes\\LOGIC_GATES\\LOOP_TOOLS\\LOOP_INDEX\\LOOP_INDEX.py", + "selected": false + }, + "position": { + "x": 472.5656805220707, + "y": 3.5093485056772806 + }, + "selected": false, + "positionAbsolute": { + "x": 472.5656805220707, + "y": 3.5093485056772806 + }, + "dragging": true + } + ], + "edges": [ + { + "source": "LOOP-e209afec-0fe8-41e1-a665-d055e0179cc7", + "sourceHandle": "body", + "target": "LOOP_INDEX-908a6860-ae5a-4be7-bff4-bb92070f526a", + "targetHandle": "default", + "id": "reactflow__edge-LOOP-e209afec-0fe8-41e1-a665-d055e0179cc7body-LOOP_INDEX-908a6860-ae5a-4be7-bff4-bb92070f526adefault" + }, + { + "source": "LOOP_INDEX-908a6860-ae5a-4be7-bff4-bb92070f526a", + "sourceHandle": "default", + "target": "BIG_NUMBER-ca0dc263-0e3f-4c7e-9a71-50dd014ec851", + "targetHandle": "default", + "id": "reactflow__edge-LOOP_INDEX-908a6860-ae5a-4be7-bff4-bb92070f526adefault-BIG_NUMBER-ca0dc263-0e3f-4c7e-9a71-50dd014ec851default" + } + ], + "viewport": { + "x": 555.0976680981258, + "y": 214.4419430555007, + "zoom": 0.8287213244976164 + } + }, + "ctrlsManifest": [ + { + "type": "input", + "name": "Slider", + "id": "INPUT_PLACEHOLDER", + "hidden": false, + "minHeight": 1, + "minWidth": 2, + "layout": { + "x": 0, + "y": 0, + "h": 2, + "w": 2, + "minH": 1, + "minW": 2, + "i": "INPUT_PLACEHOLDER" + } + } + ] +} \ No newline at end of file diff --git a/docs/nodes/LOGIC_GATES/LOOP_TOOLS/LOOP_INDEX/examples/EX1/example.md b/docs/nodes/LOGIC_GATES/LOOP_TOOLS/LOOP_INDEX/examples/EX1/example.md new file mode 100644 index 0000000000..4a881ba185 --- /dev/null +++ b/docs/nodes/LOGIC_GATES/LOOP_TOOLS/LOOP_INDEX/examples/EX1/example.md @@ -0,0 +1,12 @@ +This example shows a simple way to create a loop with Flojoy. +First, you'll need to place these three nodes: + +- The [`LOOP`](https://github.com/flojoy-io/nodes/blob/main/LOGIC_GATES/LOOPS/LOOP/LOOP.py) node which will define the number of loops. + +- The [`LOOP_INDEX`](https://github.com/flojoy-io/nodes/blob/main/LOGIC_GATES/) node tracks the loop index (the number of loops that has occured). The index starts at 1 in Flojoy. + +- The [`BIG_NUMBER`](https://github.com/flojoy-io/nodes/blob/main/VISUALIZERS/PLOTLY/BIG_NUMBER/BIG_NUMBER.py) node which is connected to the "end" output of the [`LOOP`] node, which serve, to terminate the program. + +Then click on [`LOOP`] and change the number of loops to 100 (the default is -1 which causes the loop to repeat indefinitely). Click on [`LOOP_INDEX`] and change the referred node to [`LOOP`]. + +You can then run the app and watch the loop index increase to 100 as the loop continues. diff --git a/docs/nodes/LOGIC_GATES/TIMERS/TIMER/a1-[autogen]/python_code.txt b/docs/nodes/LOGIC_GATES/TIMERS/TIMER/a1-[autogen]/python_code.txt index 812d07c9d0..eed957bcde 100644 --- a/docs/nodes/LOGIC_GATES/TIMERS/TIMER/a1-[autogen]/python_code.txt +++ b/docs/nodes/LOGIC_GATES/TIMERS/TIMER/a1-[autogen]/python_code.txt @@ -40,7 +40,7 @@ def TIMER( "NODE_RESULTS": { "cmd": "TIMER", "id": node_id, - "result": {"default_fig": fig, "data": result}, + "result": {"plotly_fig": fig}, }, "proceed_to_next": False, "jobsetId": jobset_id, diff --git a/docs/nodes/LOGIC_GATES/TIMERS/TIMER/examples/EX1/app.txt b/docs/nodes/LOGIC_GATES/TIMERS/TIMER/examples/EX1/app.txt index 14a24157c3..74020c08fc 100644 --- a/docs/nodes/LOGIC_GATES/TIMERS/TIMER/examples/EX1/app.txt +++ b/docs/nodes/LOGIC_GATES/TIMERS/TIMER/examples/EX1/app.txt @@ -2,22 +2,22 @@ "rfInstance": { "nodes": [ { - "width": 150, - "height": 150, + "width": 96, + "height": 96, "id": "TIMER-b85f2c5b-f7de-4485-953d-986177ab9d31", - "type": "TIMERS", + "type": "LOGIC_GATES", "data": { "id": "TIMER-b85f2c5b-f7de-4485-953d-986177ab9d31", "label": "TIMER", "func": "TIMER", - "type": "TIMERS", + "type": "LOGIC_GATES", "ctrls": { "sleep_time": { "type": "float", "default": 0, "functionName": "TIMER", "param": "sleep_time", - "value": "0.5" + "value": "1.5" } }, "inputs": [ @@ -36,97 +36,150 @@ } ], "path": "PYTHON/nodes\\LOGIC_GATES\\TIMERS\\TIMER\\TIMER.py", - "selected": true + "selected": false }, "position": { - "x": 102.89594923414663, - "y": 110.49136885391965 + "x": 248.76423256094694, + "y": 106.13709173968681 }, - "selected": true, + "selected": false, "positionAbsolute": { - "x": 102.89594923414663, - "y": 110.49136885391965 + "x": 248.76423256094694, + "y": 106.13709173968681 }, "dragging": true }, { - "width": 130, - "height": 130, - "id": "CONSTANT-e21a2fe3-d370-4587-b0c6-7c61f8656fd0", - "type": "SIMULATIONS", + "width": 380, + "height": 293, + "id": "BIG_NUMBER-65eb6fbe-2374-4cf8-ba51-c40c7eb017aa", + "type": "VISUALIZERS", "data": { - "id": "CONSTANT-e21a2fe3-d370-4587-b0c6-7c61f8656fd0", - "label": "2.0", - "func": "CONSTANT", - "type": "SIMULATIONS", + "id": "BIG_NUMBER-65eb6fbe-2374-4cf8-ba51-c40c7eb017aa", + "label": "BIG NUMBER", + "func": "BIG_NUMBER", + "type": "VISUALIZERS", "ctrls": { - "constant": { - "type": "float", - "default": 3, - "functionName": "CONSTANT", - "param": "constant", - "value": "2.0" + "suffix": { + "type": "str", + "default": null, + "desc": null, + "functionName": "BIG_NUMBER", + "param": "suffix", + "value": "" + }, + "prefix": { + "type": "str", + "default": null, + "desc": null, + "functionName": "BIG_NUMBER", + "param": "prefix", + "value": "" + }, + "title": { + "type": "str", + "default": null, + "desc": null, + "functionName": "BIG_NUMBER", + "param": "title", + "value": "" + }, + "relative_delta": { + "type": "bool", + "default": true, + "desc": null, + "functionName": "BIG_NUMBER", + "param": "relative_delta", + "value": true } }, "inputs": [ { "name": "default", "id": "default", - "type": "OrderedPair", - "multiple": false + "type": "OrderedPair|Scalar", + "multiple": false, + "desc": null } ], "outputs": [ { "name": "default", "id": "default", - "type": "OrderedPair" + "type": "Plotly", + "desc": null } ], - "path": "PYTHON/nodes\\GENERATORS\\SIMULATIONS\\CONSTANT\\CONSTANT.py", + "path": "PYTHON/nodes\\VISUALIZERS\\PLOTLY\\BIG_NUMBER\\BIG_NUMBER.py", "selected": false }, "position": { - "x": 434.9361307844173, - "y": 123.1192529249758 + "x": 518.2358414847172, + "y": 4.169096131465835 }, "selected": false, "positionAbsolute": { - "x": 434.9361307844173, - "y": 123.1192529249758 + "x": 518.2358414847172, + "y": 4.169096131465835 }, "dragging": true }, { - "width": 210, - "height": 130, - "id": "END-ab10e538-ad40-4af1-a447-979a455ba0d3", - "type": "TERMINATORS", + "width": 208, + "height": 96, + "id": "CONSTANT-8797a1fe-b49f-469e-81a7-813fe7638a7e", + "type": "GENERATORS", "data": { - "id": "END-ab10e538-ad40-4af1-a447-979a455ba0d3", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, + "id": "CONSTANT-8797a1fe-b49f-469e-81a7-813fe7638a7e", + "label": "3.0", + "func": "CONSTANT", + "type": "GENERATORS", + "ctrls": { + "constant": { + "type": "float", + "default": 3, + "desc": null, + "functionName": "CONSTANT", + "param": "constant", + "value": 3 + }, + "step": { + "type": "int", + "default": 1000, + "desc": null, + "functionName": "CONSTANT", + "param": "step", + "value": 1000 + } + }, "inputs": [ { "name": "default", "id": "default", - "type": "Any", - "multiple": false + "type": "Vector|OrderedPair", + "multiple": false, + "desc": null } ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", + "outputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair", + "desc": null + } + ], + "path": "PYTHON/nodes\\GENERATORS\\SIMULATIONS\\CONSTANT\\CONSTANT.py", "selected": false }, "position": { - "x": 880.8948891200718, - "y": 120.18610526153276 + "x": -125.44180464761385, + "y": 104.56416879553518 }, "selected": false, "positionAbsolute": { - "x": 880.8948891200718, - "y": 120.18610526153276 + "x": -125.44180464761385, + "y": 104.56416879553518 }, "dragging": true } @@ -135,22 +188,22 @@ { "source": "TIMER-b85f2c5b-f7de-4485-953d-986177ab9d31", "sourceHandle": "default", - "target": "CONSTANT-e21a2fe3-d370-4587-b0c6-7c61f8656fd0", + "target": "BIG_NUMBER-65eb6fbe-2374-4cf8-ba51-c40c7eb017aa", "targetHandle": "default", - "id": "reactflow__edge-TIMER-b85f2c5b-f7de-4485-953d-986177ab9d31default-CONSTANT-e21a2fe3-d370-4587-b0c6-7c61f8656fd0default" + "id": "reactflow__edge-TIMER-b85f2c5b-f7de-4485-953d-986177ab9d31default-BIG_NUMBER-65eb6fbe-2374-4cf8-ba51-c40c7eb017aadefault" }, { - "source": "CONSTANT-e21a2fe3-d370-4587-b0c6-7c61f8656fd0", + "source": "CONSTANT-8797a1fe-b49f-469e-81a7-813fe7638a7e", "sourceHandle": "default", - "target": "END-ab10e538-ad40-4af1-a447-979a455ba0d3", + "target": "TIMER-b85f2c5b-f7de-4485-953d-986177ab9d31", "targetHandle": "default", - "id": "reactflow__edge-CONSTANT-e21a2fe3-d370-4587-b0c6-7c61f8656fd0default-END-ab10e538-ad40-4af1-a447-979a455ba0d3default" + "id": "reactflow__edge-CONSTANT-8797a1fe-b49f-469e-81a7-813fe7638a7edefault-TIMER-b85f2c5b-f7de-4485-953d-986177ab9d31default" } ], "viewport": { - "x": -296.35399545928726, - "y": 66.8470830817738, - "zoom": 0.8744723800359967 + "x": 606.4472645567363, + "y": 234.63130388602087, + "zoom": 0.9186369849831518 } }, "ctrlsManifest": [ diff --git a/docs/nodes/NUMPY/LINALG/CHOLESKY/a1-[autogen]/python_code.txt b/docs/nodes/NUMPY/LINALG/CHOLESKY/a1-[autogen]/python_code.txt index 34adc4d81b..f34169c30f 100644 --- a/docs/nodes/NUMPY/LINALG/CHOLESKY/a1-[autogen]/python_code.txt +++ b/docs/nodes/NUMPY/LINALG/CHOLESKY/a1-[autogen]/python_code.txt @@ -1,4 +1,4 @@ -from flojoy import OrderedPair, flojoy, Matrix, Scalar +from flojoy import flojoy, Matrix, Scalar import numpy as np from collections import namedtuple from typing import Literal @@ -6,7 +6,7 @@ from typing import Literal import numpy.linalg -@flojoy(node_type="default") +@flojoy def CHOLESKY( default: Matrix, ) -> Matrix | Scalar: @@ -18,7 +18,10 @@ def CHOLESKY( if isinstance(result, np.ndarray): result = Matrix(m=result) - elif isinstance(result, np.float64): - result = Scalar(c=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) return result diff --git a/docs/nodes/NUMPY/LINALG/DET/a1-[autogen]/python_code.txt b/docs/nodes/NUMPY/LINALG/DET/a1-[autogen]/python_code.txt index f77d9fd893..08c5f0aac6 100644 --- a/docs/nodes/NUMPY/LINALG/DET/a1-[autogen]/python_code.txt +++ b/docs/nodes/NUMPY/LINALG/DET/a1-[autogen]/python_code.txt @@ -1,4 +1,4 @@ -from flojoy import OrderedPair, flojoy, Matrix, Scalar +from flojoy import flojoy, Matrix, Scalar import numpy as np from collections import namedtuple from typing import Literal @@ -6,7 +6,7 @@ from typing import Literal import numpy.linalg -@flojoy(node_type="default") +@flojoy def DET( default: Matrix, ) -> Matrix | Scalar: @@ -18,7 +18,10 @@ def DET( if isinstance(result, np.ndarray): result = Matrix(m=result) - elif isinstance(result, np.float64): - result = Scalar(c=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) return result diff --git a/docs/nodes/NUMPY/LINALG/EIG/a1-[autogen]/docstring.txt b/docs/nodes/NUMPY/LINALG/EIG/a1-[autogen]/docstring.txt index ebbd0d4c0b..bae2994928 100644 --- a/docs/nodes/NUMPY/LINALG/EIG/a1-[autogen]/docstring.txt +++ b/docs/nodes/NUMPY/LINALG/EIG/a1-[autogen]/docstring.txt @@ -6,7 +6,7 @@ The EIG node is based on a numpy or scipy function. Parameters ---------- - select_return : This function has returns multiple Objects: + select_return : This function has returns multiple objects: ['w', 'v']. Select the desired one to return. See the respective function docs for descriptors. a : (..., M, M) array diff --git a/docs/nodes/NUMPY/LINALG/EIG/a1-[autogen]/python_code.txt b/docs/nodes/NUMPY/LINALG/EIG/a1-[autogen]/python_code.txt index dfba47c49c..77a85086f2 100644 --- a/docs/nodes/NUMPY/LINALG/EIG/a1-[autogen]/python_code.txt +++ b/docs/nodes/NUMPY/LINALG/EIG/a1-[autogen]/python_code.txt @@ -1,4 +1,4 @@ -from flojoy import OrderedPair, flojoy, Matrix, Scalar +from flojoy import flojoy, Matrix, Scalar import numpy as np from collections import namedtuple from typing import Literal @@ -6,7 +6,7 @@ from typing import Literal import numpy.linalg -@flojoy(node_type="default") +@flojoy def EIG( default: Matrix, select_return: Literal["w", "v"] = "w", @@ -17,13 +17,23 @@ def EIG( a=default.m, ) - if isinstance(result, namedtuple): + return_list = ["w", "v"] + if isinstance(result, tuple): + res_dict = {} + num = min(len(result), len(return_list)) + for i in range(num): + res_dict[return_list[i]] = result[i] + result = res_dict[select_return] + else: result = result._asdict() result = result[select_return] if isinstance(result, np.ndarray): result = Matrix(m=result) - elif isinstance(result, np.float64): - result = Scalar(c=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) return result diff --git a/docs/nodes/NUMPY/LINALG/EIGH/a1-[autogen]/python_code.txt b/docs/nodes/NUMPY/LINALG/EIGH/a1-[autogen]/python_code.txt index 2551616699..c468f8f310 100644 --- a/docs/nodes/NUMPY/LINALG/EIGH/a1-[autogen]/python_code.txt +++ b/docs/nodes/NUMPY/LINALG/EIGH/a1-[autogen]/python_code.txt @@ -1,4 +1,4 @@ -from flojoy import OrderedPair, flojoy, Matrix, Scalar +from flojoy import flojoy, Matrix, Scalar import numpy as np from collections import namedtuple from typing import Literal @@ -6,7 +6,7 @@ from typing import Literal import numpy.linalg -@flojoy(node_type="default") +@flojoy def EIGH( default: Matrix, UPLO: str = "L", @@ -19,13 +19,23 @@ def EIGH( UPLO=UPLO, ) - if isinstance(result, namedtuple): + return_list = ["w", "v"] + if isinstance(result, tuple): + res_dict = {} + num = min(len(result), len(return_list)) + for i in range(num): + res_dict[return_list[i]] = result[i] + result = res_dict[select_return] + else: result = result._asdict() result = result[select_return] if isinstance(result, np.ndarray): result = Matrix(m=result) - elif isinstance(result, np.float64): - result = Scalar(c=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) return result diff --git a/docs/nodes/NUMPY/LINALG/EIGVALS/a1-[autogen]/python_code.txt b/docs/nodes/NUMPY/LINALG/EIGVALS/a1-[autogen]/python_code.txt index 40ad225d44..7ab5f830dd 100644 --- a/docs/nodes/NUMPY/LINALG/EIGVALS/a1-[autogen]/python_code.txt +++ b/docs/nodes/NUMPY/LINALG/EIGVALS/a1-[autogen]/python_code.txt @@ -1,4 +1,4 @@ -from flojoy import OrderedPair, flojoy, Matrix, Scalar +from flojoy import flojoy, Matrix, Scalar import numpy as np from collections import namedtuple from typing import Literal @@ -6,7 +6,7 @@ from typing import Literal import numpy.linalg -@flojoy(node_type="default") +@flojoy def EIGVALS( default: Matrix, ) -> Matrix | Scalar: @@ -18,7 +18,10 @@ def EIGVALS( if isinstance(result, np.ndarray): result = Matrix(m=result) - elif isinstance(result, np.float64): - result = Scalar(c=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) return result diff --git a/docs/nodes/NUMPY/LINALG/EIGVALSH/a1-[autogen]/python_code.txt b/docs/nodes/NUMPY/LINALG/EIGVALSH/a1-[autogen]/python_code.txt index 2b31fe9ef5..503afa1080 100644 --- a/docs/nodes/NUMPY/LINALG/EIGVALSH/a1-[autogen]/python_code.txt +++ b/docs/nodes/NUMPY/LINALG/EIGVALSH/a1-[autogen]/python_code.txt @@ -1,4 +1,4 @@ -from flojoy import OrderedPair, flojoy, Matrix, Scalar +from flojoy import flojoy, Matrix, Scalar import numpy as np from collections import namedtuple from typing import Literal @@ -6,7 +6,7 @@ from typing import Literal import numpy.linalg -@flojoy(node_type="default") +@flojoy def EIGVALSH( default: Matrix, UPLO: str = "L", @@ -20,7 +20,10 @@ def EIGVALSH( if isinstance(result, np.ndarray): result = Matrix(m=result) - elif isinstance(result, np.float64): - result = Scalar(c=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) return result diff --git a/docs/nodes/NUMPY/LINALG/INV/a1-[autogen]/python_code.txt b/docs/nodes/NUMPY/LINALG/INV/a1-[autogen]/python_code.txt index 8f534d3b48..d277d554eb 100644 --- a/docs/nodes/NUMPY/LINALG/INV/a1-[autogen]/python_code.txt +++ b/docs/nodes/NUMPY/LINALG/INV/a1-[autogen]/python_code.txt @@ -1,4 +1,4 @@ -from flojoy import OrderedPair, flojoy, Matrix, Scalar +from flojoy import flojoy, Matrix, Scalar import numpy as np from collections import namedtuple from typing import Literal @@ -6,7 +6,7 @@ from typing import Literal import numpy.linalg -@flojoy(node_type="default") +@flojoy def INV( default: Matrix, ) -> Matrix | Scalar: @@ -18,7 +18,10 @@ def INV( if isinstance(result, np.ndarray): result = Matrix(m=result) - elif isinstance(result, np.float64): - result = Scalar(c=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) return result diff --git a/docs/nodes/NUMPY/LINALG/MATRIX_POWER/a1-[autogen]/python_code.txt b/docs/nodes/NUMPY/LINALG/MATRIX_POWER/a1-[autogen]/python_code.txt index 2c8c149e13..7e8c7b082c 100644 --- a/docs/nodes/NUMPY/LINALG/MATRIX_POWER/a1-[autogen]/python_code.txt +++ b/docs/nodes/NUMPY/LINALG/MATRIX_POWER/a1-[autogen]/python_code.txt @@ -1,4 +1,4 @@ -from flojoy import OrderedPair, flojoy, Matrix, Scalar +from flojoy import flojoy, Matrix, Scalar import numpy as np from collections import namedtuple from typing import Literal @@ -6,10 +6,10 @@ from typing import Literal import numpy.linalg -@flojoy(node_type="default") +@flojoy def MATRIX_POWER( default: Matrix, - n: int, + n: int = 2, ) -> Matrix | Scalar: @@ -20,7 +20,10 @@ def MATRIX_POWER( if isinstance(result, np.ndarray): result = Matrix(m=result) - elif isinstance(result, np.float64): - result = Scalar(c=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) return result diff --git a/docs/nodes/NUMPY/LINALG/PINV/a1-[autogen]/python_code.txt b/docs/nodes/NUMPY/LINALG/PINV/a1-[autogen]/python_code.txt index 9a73b2fcfb..162168177a 100644 --- a/docs/nodes/NUMPY/LINALG/PINV/a1-[autogen]/python_code.txt +++ b/docs/nodes/NUMPY/LINALG/PINV/a1-[autogen]/python_code.txt @@ -1,4 +1,4 @@ -from flojoy import OrderedPair, flojoy, Matrix, Scalar +from flojoy import flojoy, Matrix, Scalar import numpy as np from collections import namedtuple from typing import Literal @@ -6,7 +6,7 @@ from typing import Literal import numpy.linalg -@flojoy(node_type="default") +@flojoy def PINV( default: Matrix, rcond: float = 1e-15, @@ -22,7 +22,10 @@ def PINV( if isinstance(result, np.ndarray): result = Matrix(m=result) - elif isinstance(result, np.float64): - result = Scalar(c=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) return result diff --git a/docs/nodes/NUMPY/LINALG/QR/a1-[autogen]/docstring.txt b/docs/nodes/NUMPY/LINALG/QR/a1-[autogen]/docstring.txt index 0f66122eb7..ba28cae97b 100644 --- a/docs/nodes/NUMPY/LINALG/QR/a1-[autogen]/docstring.txt +++ b/docs/nodes/NUMPY/LINALG/QR/a1-[autogen]/docstring.txt @@ -9,7 +9,7 @@ The QR node is based on a numpy or scipy function. Parameters ---------- - select_return : This function has returns multiple Objects: + select_return : This function has returns multiple objects: ['q', 'r', '(h, tau)']. Select the desired one to return. See the respective function docs for descriptors. a : array_like, shape (..., M, N) diff --git a/docs/nodes/NUMPY/LINALG/QR/a1-[autogen]/python_code.txt b/docs/nodes/NUMPY/LINALG/QR/a1-[autogen]/python_code.txt index 398e9ebc94..d9491266f1 100644 --- a/docs/nodes/NUMPY/LINALG/QR/a1-[autogen]/python_code.txt +++ b/docs/nodes/NUMPY/LINALG/QR/a1-[autogen]/python_code.txt @@ -1,4 +1,4 @@ -from flojoy import OrderedPair, flojoy, Matrix, Scalar +from flojoy import flojoy, Matrix, Scalar import numpy as np from collections import namedtuple from typing import Literal @@ -6,7 +6,7 @@ from typing import Literal import numpy.linalg -@flojoy(node_type="default") +@flojoy def QR( default: Matrix, mode: str = "reduced", @@ -19,13 +19,23 @@ def QR( mode=mode, ) - if isinstance(result, namedtuple): + return_list = ["q", "r", "(h, tau)"] + if isinstance(result, tuple): + res_dict = {} + num = min(len(result), len(return_list)) + for i in range(num): + res_dict[return_list[i]] = result[i] + result = res_dict[select_return] + else: result = result._asdict() result = result[select_return] if isinstance(result, np.ndarray): result = Matrix(m=result) - elif isinstance(result, np.float64): - result = Scalar(c=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) return result diff --git a/docs/nodes/NUMPY/LINALG/SLOGDET/a1-[autogen]/docstring.txt b/docs/nodes/NUMPY/LINALG/SLOGDET/a1-[autogen]/docstring.txt index aba848cd89..fc9bb6c122 100644 --- a/docs/nodes/NUMPY/LINALG/SLOGDET/a1-[autogen]/docstring.txt +++ b/docs/nodes/NUMPY/LINALG/SLOGDET/a1-[autogen]/docstring.txt @@ -11,7 +11,7 @@ The SLOGDET node is based on a numpy or scipy function. Parameters ---------- - select_return : This function has returns multiple Objects: + select_return : This function has returns multiple objects: ['sign', 'logdet']. Select the desired one to return. See the respective function docs for descriptors. a : (..., M, M) array_like diff --git a/docs/nodes/NUMPY/LINALG/SLOGDET/a1-[autogen]/python_code.txt b/docs/nodes/NUMPY/LINALG/SLOGDET/a1-[autogen]/python_code.txt index 8acea38eaf..4f462df5f8 100644 --- a/docs/nodes/NUMPY/LINALG/SLOGDET/a1-[autogen]/python_code.txt +++ b/docs/nodes/NUMPY/LINALG/SLOGDET/a1-[autogen]/python_code.txt @@ -1,4 +1,4 @@ -from flojoy import OrderedPair, flojoy, Matrix, Scalar +from flojoy import flojoy, Matrix, Scalar import numpy as np from collections import namedtuple from typing import Literal @@ -6,7 +6,7 @@ from typing import Literal import numpy.linalg -@flojoy(node_type="default") +@flojoy def SLOGDET( default: Matrix, select_return: Literal["sign", "logdet"] = "sign", @@ -17,13 +17,23 @@ def SLOGDET( a=default.m, ) - if isinstance(result, namedtuple): + return_list = ["sign", "logdet"] + if isinstance(result, tuple): + res_dict = {} + num = min(len(result), len(return_list)) + for i in range(num): + res_dict[return_list[i]] = result[i] + result = res_dict[select_return] + else: result = result._asdict() result = result[select_return] if isinstance(result, np.ndarray): result = Matrix(m=result) - elif isinstance(result, np.float64): - result = Scalar(c=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) return result diff --git a/docs/nodes/NUMPY/LINALG/SVD/a1-[autogen]/docstring.txt b/docs/nodes/NUMPY/LINALG/SVD/a1-[autogen]/docstring.txt index 62354f4003..e217cfd158 100644 --- a/docs/nodes/NUMPY/LINALG/SVD/a1-[autogen]/docstring.txt +++ b/docs/nodes/NUMPY/LINALG/SVD/a1-[autogen]/docstring.txt @@ -13,7 +13,7 @@ The SVD node is based on a numpy or scipy function. Parameters ---------- - select_return : This function has returns multiple Objects: + select_return : This function has returns multiple objects: ['u', 's', 'vh']. Select the desired one to return. See the respective function docs for descriptors. a : (..., M, N) array_like diff --git a/docs/nodes/NUMPY/LINALG/SVD/a1-[autogen]/python_code.txt b/docs/nodes/NUMPY/LINALG/SVD/a1-[autogen]/python_code.txt index 1abc8f8bde..b2e72292de 100644 --- a/docs/nodes/NUMPY/LINALG/SVD/a1-[autogen]/python_code.txt +++ b/docs/nodes/NUMPY/LINALG/SVD/a1-[autogen]/python_code.txt @@ -1,4 +1,4 @@ -from flojoy import OrderedPair, flojoy, Matrix, Scalar +from flojoy import flojoy, Matrix, Scalar import numpy as np from collections import namedtuple from typing import Literal @@ -6,7 +6,7 @@ from typing import Literal import numpy.linalg -@flojoy(node_type="default") +@flojoy def SVD( default: Matrix, full_matrices: bool = True, @@ -23,13 +23,23 @@ def SVD( hermitian=hermitian, ) - if isinstance(result, namedtuple): + return_list = ["u", "s", "vh"] + if isinstance(result, tuple): + res_dict = {} + num = min(len(result), len(return_list)) + for i in range(num): + res_dict[return_list[i]] = result[i] + result = res_dict[select_return] + else: result = result._asdict() result = result[select_return] if isinstance(result, np.ndarray): result = Matrix(m=result) - elif isinstance(result, np.float64): - result = Scalar(c=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) return result diff --git a/docs/nodes/NUMPY/LINALG/TENSORINV/a1-[autogen]/python_code.txt b/docs/nodes/NUMPY/LINALG/TENSORINV/a1-[autogen]/python_code.txt index 8e3a934bb7..fde430f4de 100644 --- a/docs/nodes/NUMPY/LINALG/TENSORINV/a1-[autogen]/python_code.txt +++ b/docs/nodes/NUMPY/LINALG/TENSORINV/a1-[autogen]/python_code.txt @@ -1,4 +1,4 @@ -from flojoy import OrderedPair, flojoy, Matrix, Scalar +from flojoy import flojoy, Matrix, Scalar import numpy as np from collections import namedtuple from typing import Literal @@ -6,7 +6,7 @@ from typing import Literal import numpy.linalg -@flojoy(node_type="default") +@flojoy def TENSORINV( default: Matrix, ind: int = 2, @@ -20,7 +20,10 @@ def TENSORINV( if isinstance(result, np.ndarray): result = Matrix(m=result) - elif isinstance(result, np.float64): - result = Scalar(c=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) return result diff --git a/docs/nodes/SCIPY/SIGNAL/ARGRELMAX/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/SIGNAL/ARGRELMAX/a1-[autogen]/python_code.txt index ce25f027c0..44bfe3febb 100644 --- a/docs/nodes/SCIPY/SIGNAL/ARGRELMAX/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/SIGNAL/ARGRELMAX/a1-[autogen]/python_code.txt @@ -6,7 +6,7 @@ from typing import Literal import scipy.signal -@flojoy(node_type="default") +@flojoy def ARGRELMAX( default: OrderedPair | Matrix, axis: int = 0, diff --git a/docs/nodes/SCIPY/SIGNAL/ARGRELMIN/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/SIGNAL/ARGRELMIN/a1-[autogen]/python_code.txt index deda81fa21..80f54f55ef 100644 --- a/docs/nodes/SCIPY/SIGNAL/ARGRELMIN/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/SIGNAL/ARGRELMIN/a1-[autogen]/python_code.txt @@ -6,7 +6,7 @@ from typing import Literal import scipy.signal -@flojoy(node_type="default") +@flojoy def ARGRELMIN( default: OrderedPair | Matrix, axis: int = 0, diff --git a/docs/nodes/SCIPY/SIGNAL/BSPLINE/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/SIGNAL/BSPLINE/a1-[autogen]/python_code.txt index fa929737ff..87f2a30f4c 100644 --- a/docs/nodes/SCIPY/SIGNAL/BSPLINE/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/SIGNAL/BSPLINE/a1-[autogen]/python_code.txt @@ -6,19 +6,24 @@ from typing import Literal import scipy.signal -@flojoy(node_type="default") +@flojoy def BSPLINE( default: OrderedPair | Matrix, - n: int, + n: int = 2, ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.signal.bspline( - x=default.y, - n=n, - ), + result = scipy.signal.bspline( + x=default.y, + n=n, ) + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/SIGNAL/CUBIC/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/SIGNAL/CUBIC/a1-[autogen]/python_code.txt index 231fea90b9..58317b8c9b 100644 --- a/docs/nodes/SCIPY/SIGNAL/CUBIC/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/SIGNAL/CUBIC/a1-[autogen]/python_code.txt @@ -6,17 +6,22 @@ from typing import Literal import scipy.signal -@flojoy(node_type="default") +@flojoy def CUBIC( default: OrderedPair | Matrix, ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.signal.cubic( - x=default.y, - ), + result = scipy.signal.cubic( + x=default.y, ) + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/SIGNAL/DECIMATE/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/SIGNAL/DECIMATE/a1-[autogen]/python_code.txt index 9ae41dd4a5..c85438bbde 100644 --- a/docs/nodes/SCIPY/SIGNAL/DECIMATE/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/SIGNAL/DECIMATE/a1-[autogen]/python_code.txt @@ -6,27 +6,32 @@ from typing import Literal import scipy.signal -@flojoy(node_type="default") +@flojoy def DECIMATE( default: OrderedPair | Matrix, - q: int, - n: int, + q: int = 2, + n: int = 2, ftype: str = "iir", axis: int = -1, zero_phase: bool = True, ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.signal.decimate( - x=default.y, - q=q, - n=n, - ftype=ftype, - axis=axis, - zero_phase=zero_phase, - ), + result = scipy.signal.decimate( + x=default.y, + q=q, + n=n, + ftype=ftype, + axis=axis, + zero_phase=zero_phase, ) + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/SIGNAL/DETREND/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/SIGNAL/DETREND/a1-[autogen]/python_code.txt index 6704e2a1b7..7706cb42a4 100644 --- a/docs/nodes/SCIPY/SIGNAL/DETREND/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/SIGNAL/DETREND/a1-[autogen]/python_code.txt @@ -6,7 +6,7 @@ from typing import Literal import scipy.signal -@flojoy(node_type="default") +@flojoy def DETREND( default: OrderedPair | Matrix, axis: int = -1, @@ -16,15 +16,20 @@ def DETREND( ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.signal.detrend( - data=default.y, - axis=axis, - type=type, - bp=bp, - overwrite_data=overwrite_data, - ), + result = scipy.signal.detrend( + data=default.y, + axis=axis, + type=type, + bp=bp, + overwrite_data=overwrite_data, ) + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/SIGNAL/GAUSS_SPLINE/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/SIGNAL/GAUSS_SPLINE/a1-[autogen]/python_code.txt index f17bb191c0..0a1af53793 100644 --- a/docs/nodes/SCIPY/SIGNAL/GAUSS_SPLINE/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/SIGNAL/GAUSS_SPLINE/a1-[autogen]/python_code.txt @@ -6,19 +6,24 @@ from typing import Literal import scipy.signal -@flojoy(node_type="default") +@flojoy def GAUSS_SPLINE( default: OrderedPair | Matrix, - n: int, + n: int = 2, ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.signal.gauss_spline( - x=default.y, - n=n, - ), + result = scipy.signal.gauss_spline( + x=default.y, + n=n, ) + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/SIGNAL/HILBERT/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/SIGNAL/HILBERT/a1-[autogen]/python_code.txt index 29328380d8..aa6798b0a2 100644 --- a/docs/nodes/SCIPY/SIGNAL/HILBERT/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/SIGNAL/HILBERT/a1-[autogen]/python_code.txt @@ -6,21 +6,26 @@ from typing import Literal import scipy.signal -@flojoy(node_type="default") +@flojoy def HILBERT( default: OrderedPair | Matrix, - N: int, + N: int = 2, axis: int = -1, ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.signal.hilbert( - x=default.y, - N=N, - axis=axis, - ), + result = scipy.signal.hilbert( + x=default.y, + N=N, + axis=axis, ) + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/SIGNAL/KAISER_BETA/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/SIGNAL/KAISER_BETA/a1-[autogen]/python_code.txt index d9a5a493e0..307acdf009 100644 --- a/docs/nodes/SCIPY/SIGNAL/KAISER_BETA/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/SIGNAL/KAISER_BETA/a1-[autogen]/python_code.txt @@ -6,17 +6,22 @@ from typing import Literal import scipy.signal -@flojoy(node_type="default") +@flojoy def KAISER_BETA( default: OrderedPair | Matrix, ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.signal.kaiser_beta( - a=default.y, - ), + result = scipy.signal.kaiser_beta( + a=default.y, ) + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/SIGNAL/PERIODOGRAM/a1-[autogen]/docstring.txt b/docs/nodes/SCIPY/SIGNAL/PERIODOGRAM/a1-[autogen]/docstring.txt index cc2da51d83..2706b161d0 100644 --- a/docs/nodes/SCIPY/SIGNAL/PERIODOGRAM/a1-[autogen]/docstring.txt +++ b/docs/nodes/SCIPY/SIGNAL/PERIODOGRAM/a1-[autogen]/docstring.txt @@ -1,43 +1,49 @@ +The PERIODOGRAM node is based on a numpy or scipy function. + The description of that function is as follows: - Estimate power spectral density using a periodogram. + Estimate power spectral density using a periodogram. --.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. -The parameters of the function in this Flojoy wrapper are given below. --.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. + Parameters + ---------- + select_return : This function has returns multiple objects: + ['f', 'Pxx']. Select the desired one to return. + See the respective function docs for descriptors. + x : array_like + Time series of measurement values + fs : float, optional + Sampling frequency of the `x` time series. Defaults to 1.0. + window : str or tuple or array_like, optional + Desired window to use. If `window` is a string or tuple, it is + passed to `get_window` to generate the window values, which are + DFT-even by default. See `get_window` for a list of windows and + required parameters. If `window` is array_like it will be used + directly as the window and its length must be nperseg. Defaults + to 'boxcar'. + nfft : int, optional + Length of the FFT used. If `None` the length of `x` will be + used. + detrend : str or function or `False`, optional + Specifies how to detrend each segment. If `detrend` is a + string, it is passed as the `type` argument to the `detrend` + function. If it is a function, it takes a segment and returns a + detrended segment. If `detrend` is `False`, no detrending is + done. Defaults to 'constant'. + return_onesided : bool, optional + If `True`, return a one-sided spectrum for real data. If + `False` return a two-sided spectrum. Defaults to `True`, but for + complex data, a two-sided spectrum is always returned. + scaling : { 'density', 'spectrum' }, optional + Selects between computing the power spectral density ('density') + where `Pxx` has units of V**2/Hz and computing the power + spectrum ('spectrum') where `Pxx` has units of V**2, if `x` + is measured in V and `fs` is measured in Hz. Defaults to + 'density' + axis : int, optional + Axis along which the periodogram is computed; the default is + over the last axis (i.e. ``axis=-1``). -Parameters ----------- -x : array_like - Time series of measurement values -fs : float, optional - Sampling frequency of the `x` time series. Defaults to 1.0. -window : str or tuple or array_like, optional - Desired window to use. If `window` is a string or tuple, it is - passed to `get_window` to generate the window values, which are - DFT-even by default. See `get_window` for a list of windows and - required parameters. If `window` is array_like it will be used - directly as the window and its length must be nperseg. Defaults - to 'boxcar'. -nfft : int, optional - Length of the FFT used. If `None` the length of `x` will be - used. -detrend : str or function or `False`, optional - Specifies how to detrend each segment. If `detrend` is a - string, it is passed as the `type` argument to the `detrend` - function. If it is a function, it takes a segment and returns a - detrended segment. If `detrend` is `False`, no detrending is - done. Defaults to 'constant'. -return_onesided : bool, optional - If `True`, return a one-sided spectrum for real data. If - `False` return a two-sided spectrum. Defaults to `True`, but for - complex data, a two-sided spectrum is always returned. -scaling : { 'density', 'spectrum' }, optional - Selects between computing the power spectral density ('density') - where `Pxx` has units of V**2/Hz and computing the power - spectrum ('spectrum') where `Pxx` has units of V**2, if `x` - is measured in V and `fs` is measured in Hz. Defaults to - 'density' -axis : int, optional - Axis along which the periodogram is computed; the default is - over the last axis (i.e. ``axis=-1``). + Returns + ---------- + DataContainer: + type 'ordered pair', 'scalar', or 'matrix' diff --git a/docs/nodes/SCIPY/SIGNAL/PERIODOGRAM/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/SIGNAL/PERIODOGRAM/a1-[autogen]/python_code.txt index 36c27a47e8..549b6647df 100644 --- a/docs/nodes/SCIPY/SIGNAL/PERIODOGRAM/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/SIGNAL/PERIODOGRAM/a1-[autogen]/python_code.txt @@ -1,24 +1,53 @@ -from flojoy import DataContainer, flojoy +from flojoy import OrderedPair, flojoy, Matrix, Scalar +import numpy as np +from collections import namedtuple +from typing import Literal + import scipy.signal -@flojoy -def PERIODOGRAM(dc, params): +@flojoy(node_type="default") +def PERIODOGRAM( + default: OrderedPair | Matrix, + fs: float = 1.0, + window: str = "boxcar", + nfft: int = 2, + detrend: str = "constant", + return_onesided: bool = True, + scaling: str = "density", + axis: int = -1, + select_return: Literal["f", "Pxx"] = "f", +) -> OrderedPair | Matrix | Scalar: - return DataContainer( - x=dc[0].y, - y=scipy.signal.periodogram( - x=dc[0].y, - fs=(float(params["fs"]) if params["fs"] != "" else None), - window=(str(params["window"]) if params["window"] != "" else None), - nfft=(int(params["nfft"]) if params["nfft"] != "" else None), - detrend=(str(params["detrend"]) if params["detrend"] != "" else None), - return_onesided=( - bool(params["return_onesided"]) - if params["return_onesided"] != "" - else None - ), - scaling=(str(params["scaling"]) if params["scaling"] != "" else None), - axis=(int(params["axis"]) if params["axis"] != "" else None), - ), + + result = scipy.signal.periodogram( + x=default.y, + fs=fs, + window=window, + nfft=nfft, + detrend=detrend, + return_onesided=return_onesided, + scaling=scaling, + axis=axis, ) + + return_list = ["f", "Pxx"] + if isinstance(result, tuple): + res_dict = {} + num = min(len(result), len(return_list)) + for i in range(num): + res_dict[return_list[i]] = result[i] + result = res_dict[select_return] + else: + result = result._asdict() + result = result[select_return] + + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + + return result diff --git a/docs/nodes/SCIPY/SIGNAL/QUADRATIC/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/SIGNAL/QUADRATIC/a1-[autogen]/python_code.txt index 03f23417a5..5844f8aa8c 100644 --- a/docs/nodes/SCIPY/SIGNAL/QUADRATIC/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/SIGNAL/QUADRATIC/a1-[autogen]/python_code.txt @@ -6,17 +6,22 @@ from typing import Literal import scipy.signal -@flojoy(node_type="default") +@flojoy def QUADRATIC( default: OrderedPair | Matrix, ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.signal.quadratic( - x=default.y, - ), + result = scipy.signal.quadratic( + x=default.y, ) + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/SIGNAL/SAVGOL_FILTER/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/SIGNAL/SAVGOL_FILTER/a1-[autogen]/python_code.txt index 232e9220e4..a4a62c8009 100644 --- a/docs/nodes/SCIPY/SIGNAL/SAVGOL_FILTER/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/SIGNAL/SAVGOL_FILTER/a1-[autogen]/python_code.txt @@ -6,11 +6,11 @@ from typing import Literal import scipy.signal -@flojoy(node_type="default") +@flojoy def SAVGOL_FILTER( default: OrderedPair | Matrix, - window_length: int, - polyorder: int, + window_length: int = 2, + polyorder: int = 1, deriv: int = 0, delta: float = 1.0, axis: int = -1, @@ -19,18 +19,23 @@ def SAVGOL_FILTER( ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.signal.savgol_filter( - x=default.y, - window_length=window_length, - polyorder=polyorder, - deriv=deriv, - delta=delta, - axis=axis, - mode=mode, - cval=cval, - ), + result = scipy.signal.savgol_filter( + x=default.y, + window_length=window_length, + polyorder=polyorder, + deriv=deriv, + delta=delta, + axis=axis, + mode=mode, + cval=cval, ) + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/SIGNAL/STFT/a1-[autogen]/docstring.txt b/docs/nodes/SCIPY/SIGNAL/STFT/a1-[autogen]/docstring.txt index f9cc88c12b..1e2a19d9bc 100644 --- a/docs/nodes/SCIPY/SIGNAL/STFT/a1-[autogen]/docstring.txt +++ b/docs/nodes/SCIPY/SIGNAL/STFT/a1-[autogen]/docstring.txt @@ -1,68 +1,74 @@ +The STFT node is based on a numpy or scipy function. + The description of that function is as follows: - Compute the Short Time Fourier Transform (STFT). + Compute the Short Time Fourier Transform (STFT). - STFTs can be used as a way of quantifying the change of a - nonstationary signal's frequency and phase content over time. + STFTs can be used as a way of quantifying the change of a + nonstationary signal's frequency and phase content over time. --.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. -The parameters of the function in this Flojoy wrapper are given below. --.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. + Parameters + ---------- + select_return : This function has returns multiple objects: + ['f', 't', 'Zxx']. Select the desired one to return. + See the respective function docs for descriptors. + x : array_like + Time series of measurement values + fs : float, optional + Sampling frequency of the `x` time series. Defaults to 1.0. + window : str or tuple or array_like, optional + Desired window to use. If `window` is a string or tuple, it is + passed to `get_window` to generate the window values, which are + DFT-even by default. See `get_window` for a list of windows and + required parameters. If `window` is array_like it will be used + directly as the window and its length must be nperseg. Defaults + to a Hann window. + nperseg : int, optional + Length of each segment. Defaults to 256. + noverlap : int, optional + Number of points to overlap between segments. If `None`, + ``noverlap = nperseg // 2``. Defaults to `None`. When + specified, the COLA constraint must be met (see Notes below). + nfft : int, optional + Length of the FFT used, if a zero padded FFT is desired. If + `None`, the FFT length is `nperseg`. Defaults to `None`. + detrend : str or function or `False`, optional + Specifies how to detrend each segment. If `detrend` is a + string, it is passed as the `type` argument to the `detrend` + function. If it is a function, it takes a segment and returns a + detrended segment. If `detrend` is `False`, no detrending is + done. Defaults to `False`. + return_onesided : bool, optional + If `True`, return a one-sided spectrum for real data. If + `False` return a two-sided spectrum. Defaults to `True`, but for + complex data, a two-sided spectrum is always returned. + boundary : str or None, optional + Specifies whether the input signal is extended at both ends, and + how to generate the new values, in order to center the first + windowed segment on the first input point. This has the benefit + of enabling reconstruction of the first input point when the + employed window function starts at zero. Valid options are + ``['even', 'odd', 'constant', 'zeros', None]``. Defaults to + 'zeros', for zero padding extension. I.e. ``[1, 2, 3, 4]`` is + extended to ``[0, 1, 2, 3, 4, 0]`` for ``nperseg=3``. + padded : bool, optional + Specifies whether the input signal is zero-padded at the end to + make the signal fit exactly into an integer number of window + segments, so that all of the signal is included in the output. + Defaults to `True`. Padding occurs after boundary extension, if + `boundary` is not `None`, and `padded` is `True`, as is the + default. + axis : int, optional + Axis along which the STFT is computed; the default is over the + last axis (i.e. ``axis=-1``). + scaling: {'spectrum', 'psd'} + The default 'spectrum' scaling allows each frequency line of `Zxx` to + be interpreted as a magnitude spectrum. The 'psd' option scales each + line to a power spectral density - it allows to calculate the signal's + energy by numerically integrating over ``abs(Zxx)**2``. -Parameters ----------- -x : array_like - Time series of measurement values -fs : float, optional - Sampling frequency of the `x` time series. Defaults to 1.0. -window : str or tuple or array_like, optional - Desired window to use. If `window` is a string or tuple, it is - passed to `get_window` to generate the window values, which are - DFT-even by default. See `get_window` for a list of windows and - required parameters. If `window` is array_like it will be used - directly as the window and its length must be nperseg. Defaults - to a Hann window. -nperseg : int, optional - Length of each segment. Defaults to 256. -noverlap : int, optional - Number of points to overlap between segments. If `None`, - ``noverlap = nperseg // 2``. Defaults to `None`. When - specified, the COLA constraint must be met (see Notes below). -nfft : int, optional - Length of the FFT used, if a zero padded FFT is desired. If - `None`, the FFT length is `nperseg`. Defaults to `None`. -detrend : str or function or `False`, optional - Specifies how to detrend each segment. If `detrend` is a - string, it is passed as the `type` argument to the `detrend` - function. If it is a function, it takes a segment and returns a - detrended segment. If `detrend` is `False`, no detrending is - done. Defaults to `False`. -return_onesided : bool, optional - If `True`, return a one-sided spectrum for real data. If - `False` return a two-sided spectrum. Defaults to `True`, but for - complex data, a two-sided spectrum is always returned. -boundary : str or None, optional - Specifies whether the input signal is extended at both ends, and - how to generate the new values, in order to center the first - windowed segment on the first input point. This has the benefit - of enabling reconstruction of the first input point when the - employed window function starts at zero. Valid options are - ``['even', 'odd', 'constant', 'zeros', None]``. Defaults to - 'zeros', for zero padding extension. I.e. ``[1, 2, 3, 4]`` is - extended to ``[0, 1, 2, 3, 4, 0]`` for ``nperseg=3``. -padded : bool, optional - Specifies whether the input signal is zero-padded at the end to - make the signal fit exactly into an integer number of window - segments, so that all of the signal is included in the output. - Defaults to `True`. Padding occurs after boundary extension, if - `boundary` is not `None`, and `padded` is `True`, as is the - default. -axis : int, optional - Axis along which the STFT is computed; the default is over the - last axis (i.e. ``axis=-1``). -scaling: {'spectrum', 'psd'} - The default 'spectrum' scaling allows each frequency line of `Zxx` to - be interpreted as a magnitude spectrum. The 'psd' option scales each - line to a power spectral density - it allows to calculate the signal's - energy by numerically integrating over ``abs(Zxx)**2``. + .. versionadded:: 1.9.0 -.. versionadded:: 1.9.0 + Returns + ---------- + DataContainer: + type 'ordered pair', 'scalar', or 'matrix' diff --git a/docs/nodes/SCIPY/SIGNAL/STFT/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/SIGNAL/STFT/a1-[autogen]/python_code.txt index cfda81024b..aa946727f5 100644 --- a/docs/nodes/SCIPY/SIGNAL/STFT/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/SIGNAL/STFT/a1-[autogen]/python_code.txt @@ -1,28 +1,61 @@ -from flojoy import DataContainer, flojoy +from flojoy import OrderedPair, flojoy, Matrix, Scalar +import numpy as np +from collections import namedtuple +from typing import Literal + import scipy.signal -@flojoy -def STFT(dc, params): +@flojoy(node_type="default") +def STFT( + default: OrderedPair | Matrix, + fs: float = 1.0, + window: str = "hann", + nperseg: int = 2, + noverlap: int = 1, + nfft: int = 2, + detrend: bool = False, + return_onesided: bool = True, + boundary: str = "zeros", + padded: bool = True, + axis: int = -1, + scaling: str = "spectrum", + select_return: Literal["f", "t", "Zxx"] = "f", +) -> OrderedPair | Matrix | Scalar: - return DataContainer( - x=dc[0].y, - y=scipy.signal.stft( - x=dc[0].y, - fs=(float(params["fs"]) if params["fs"] != "" else None), - window=(str(params["window"]) if params["window"] != "" else None), - nperseg=(int(params["nperseg"]) if params["nperseg"] != "" else None), - noverlap=(int(params["noverlap"]) if params["noverlap"] != "" else None), - nfft=(int(params["nfft"]) if params["nfft"] != "" else None), - detrend=(bool(params["detrend"]) if params["detrend"] != "" else None), - return_onesided=( - bool(params["return_onesided"]) - if params["return_onesided"] != "" - else None - ), - boundary=(str(params["boundary"]) if params["boundary"] != "" else None), - padded=(bool(params["padded"]) if params["padded"] != "" else None), - axis=(int(params["axis"]) if params["axis"] != "" else None), - scaling=(str(params["scaling"]) if params["scaling"] != "" else None), - ), + + result = scipy.signal.stft( + x=default.y, + fs=fs, + window=window, + nperseg=nperseg, + noverlap=noverlap, + nfft=nfft, + detrend=detrend, + return_onesided=return_onesided, + boundary=boundary, + padded=padded, + axis=axis, + scaling=scaling, ) + + return_list = ["f", "t", "Zxx"] + if isinstance(result, tuple): + res_dict = {} + num = min(len(result), len(return_list)) + for i in range(num): + res_dict[return_list[i]] = result[i] + result = res_dict[select_return] + else: + result = result._asdict() + result = result[select_return] + + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + + return result diff --git a/docs/nodes/SCIPY/SIGNAL/WELCH/a1-[autogen]/docstring.txt b/docs/nodes/SCIPY/SIGNAL/WELCH/a1-[autogen]/docstring.txt index 97f1a012c5..11f3c47d4a 100644 --- a/docs/nodes/SCIPY/SIGNAL/WELCH/a1-[autogen]/docstring.txt +++ b/docs/nodes/SCIPY/SIGNAL/WELCH/a1-[autogen]/docstring.txt @@ -1,59 +1,65 @@ +The WELCH node is based on a numpy or scipy function. + The description of that function is as follows: - Estimate power spectral density using Welch's method. + Estimate power spectral density using Welch's method. - Welch's method [1]_ computes an estimate of the power spectral - density by dividing the data into overlapping segments, computing a - modified periodogram for each segment and averaging the - periodograms. + Welch's method [1]_ computes an estimate of the power spectral + density by dividing the data into overlapping segments, computing a + modified periodogram for each segment and averaging the + periodograms. --.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. -The parameters of the function in this Flojoy wrapper are given below. --.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. + Parameters + ---------- + select_return : This function has returns multiple objects: + ['f', 'Pxx']. Select the desired one to return. + See the respective function docs for descriptors. + x : array_like + Time series of measurement values + fs : float, optional + Sampling frequency of the `x` time series. Defaults to 1.0. + window : str or tuple or array_like, optional + Desired window to use. If `window` is a string or tuple, it is + passed to `get_window` to generate the window values, which are + DFT-even by default. See `get_window` for a list of windows and + required parameters. If `window` is array_like it will be used + directly as the window and its length must be nperseg. Defaults + to a Hann window. + nperseg : int, optional + Length of each segment. Defaults to None, but if window is str or + tuple, is set to 256, and if window is array_like, is set to the + length of the window. + noverlap : int, optional + Number of points to overlap between segments. If `None`, + ``noverlap = nperseg // 2``. Defaults to `None`. + nfft : int, optional + Length of the FFT used, if a zero padded FFT is desired. If + `None`, the FFT length is `nperseg`. Defaults to `None`. + detrend : str or function or `False`, optional + Specifies how to detrend each segment. If `detrend` is a + string, it is passed as the `type` argument to the `detrend` + function. If it is a function, it takes a segment and returns a + detrended segment. If `detrend` is `False`, no detrending is + done. Defaults to 'constant'. + return_onesided : bool, optional + If `True`, return a one-sided spectrum for real data. If + `False` return a two-sided spectrum. Defaults to `True`, but for + complex data, a two-sided spectrum is always returned. + scaling : { 'density', 'spectrum' }, optional + Selects between computing the power spectral density ('density') + where `Pxx` has units of V**2/Hz and computing the power + spectrum ('spectrum') where `Pxx` has units of V**2, if `x` + is measured in V and `fs` is measured in Hz. Defaults to + 'density' + axis : int, optional + Axis along which the periodogram is computed; the default is + over the last axis (i.e. ``axis=-1``). + average : { 'mean', 'median' }, optional + Method to use when averaging periodograms. Defaults to 'mean'. -Parameters ----------- -x : array_like - Time series of measurement values -fs : float, optional - Sampling frequency of the `x` time series. Defaults to 1.0. -window : str or tuple or array_like, optional - Desired window to use. If `window` is a string or tuple, it is - passed to `get_window` to generate the window values, which are - DFT-even by default. See `get_window` for a list of windows and - required parameters. If `window` is array_like it will be used - directly as the window and its length must be nperseg. Defaults - to a Hann window. -nperseg : int, optional - Length of each segment. Defaults to None, but if window is str or - tuple, is set to 256, and if window is array_like, is set to the - length of the window. -noverlap : int, optional - Number of points to overlap between segments. If `None`, - ``noverlap = nperseg // 2``. Defaults to `None`. -nfft : int, optional - Length of the FFT used, if a zero padded FFT is desired. If - `None`, the FFT length is `nperseg`. Defaults to `None`. -detrend : str or function or `False`, optional - Specifies how to detrend each segment. If `detrend` is a - string, it is passed as the `type` argument to the `detrend` - function. If it is a function, it takes a segment and returns a - detrended segment. If `detrend` is `False`, no detrending is - done. Defaults to 'constant'. -return_onesided : bool, optional - If `True`, return a one-sided spectrum for real data. If - `False` return a two-sided spectrum. Defaults to `True`, but for - complex data, a two-sided spectrum is always returned. -scaling : { 'density', 'spectrum' }, optional - Selects between computing the power spectral density ('density') - where `Pxx` has units of V**2/Hz and computing the power - spectrum ('spectrum') where `Pxx` has units of V**2, if `x` - is measured in V and `fs` is measured in Hz. Defaults to - 'density' -axis : int, optional - Axis along which the periodogram is computed; the default is - over the last axis (i.e. ``axis=-1``). -average : { 'mean', 'median' }, optional - Method to use when averaging periodograms. Defaults to 'mean'. + .. versionadded:: 1.2.0 -.. versionadded:: 1.2.0 + Returns + ---------- + DataContainer: + type 'ordered pair', 'scalar', or 'matrix' diff --git a/docs/nodes/SCIPY/SIGNAL/WELCH/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/SIGNAL/WELCH/a1-[autogen]/python_code.txt index 78378b4af3..6ed0e3cdc0 100644 --- a/docs/nodes/SCIPY/SIGNAL/WELCH/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/SIGNAL/WELCH/a1-[autogen]/python_code.txt @@ -1,27 +1,59 @@ -from flojoy import DataContainer, flojoy +from flojoy import OrderedPair, flojoy, Matrix, Scalar +import numpy as np +from collections import namedtuple +from typing import Literal + import scipy.signal -@flojoy -def WELCH(dc, params): +@flojoy(node_type="default") +def WELCH( + default: OrderedPair | Matrix, + fs: float = 1.0, + window: str = "hann", + nperseg: int = 2, + noverlap: int = 1, + nfft: int = 2, + detrend: str = "constant", + return_onesided: bool = True, + scaling: str = "density", + axis: int = -1, + average: str = "mean", + select_return: Literal["f", "Pxx"] = "f", +) -> OrderedPair | Matrix | Scalar: - return DataContainer( - x=dc[0].y, - y=scipy.signal.welch( - x=dc[0].y, - fs=(float(params["fs"]) if params["fs"] != "" else None), - window=(str(params["window"]) if params["window"] != "" else None), - nperseg=(int(params["nperseg"]) if params["nperseg"] != "" else None), - noverlap=(int(params["noverlap"]) if params["noverlap"] != "" else None), - nfft=(int(params["nfft"]) if params["nfft"] != "" else None), - detrend=(str(params["detrend"]) if params["detrend"] != "" else None), - return_onesided=( - bool(params["return_onesided"]) - if params["return_onesided"] != "" - else None - ), - scaling=(str(params["scaling"]) if params["scaling"] != "" else None), - axis=(int(params["axis"]) if params["axis"] != "" else None), - average=(str(params["average"]) if params["average"] != "" else None), - ), + + result = scipy.signal.welch( + x=default.y, + fs=fs, + window=window, + nperseg=nperseg, + noverlap=noverlap, + nfft=nfft, + detrend=detrend, + return_onesided=return_onesided, + scaling=scaling, + axis=axis, + average=average, ) + + return_list = ["f", "Pxx"] + if isinstance(result, tuple): + res_dict = {} + num = min(len(result), len(return_list)) + for i in range(num): + res_dict[return_list[i]] = result[i] + result = res_dict[select_return] + else: + result = result._asdict() + result = result[select_return] + + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + + return result diff --git a/docs/nodes/SCIPY/STATS/ANDERSON/a1-[autogen]/docstring.txt b/docs/nodes/SCIPY/STATS/ANDERSON/a1-[autogen]/docstring.txt index 782c1a6b82..0ac058bc4f 100644 --- a/docs/nodes/SCIPY/STATS/ANDERSON/a1-[autogen]/docstring.txt +++ b/docs/nodes/SCIPY/STATS/ANDERSON/a1-[autogen]/docstring.txt @@ -12,7 +12,7 @@ The ANDERSON node is based on a numpy or scipy function. Parameters ---------- - select_return : This function has returns multiple Objects: + select_return : This function has returns multiple objects: ['statistic', 'critical_values', 'significance_level']. Select the desired one to return. See the respective function docs for descriptors. x : array_like diff --git a/docs/nodes/SCIPY/STATS/ANDERSON/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/ANDERSON/a1-[autogen]/python_code.txt index 27cf5a11e5..1214038aba 100644 --- a/docs/nodes/SCIPY/STATS/ANDERSON/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/ANDERSON/a1-[autogen]/python_code.txt @@ -6,7 +6,7 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def ANDERSON( default: OrderedPair | Matrix, dist: str = "norm", @@ -16,12 +16,28 @@ def ANDERSON( ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.stats.anderson( - x=default.y, - dist=dist, - ), + result = scipy.stats.anderson( + x=default.y, + dist=dist, ) + return_list = ["statistic", "critical_values", "significance_level"] + if isinstance(result, tuple): + res_dict = {} + num = min(len(result), len(return_list)) + for i in range(num): + res_dict[return_list[i]] = result[i] + result = res_dict[select_return] + else: + result = result._asdict() + result = result[select_return] + + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/STATS/BAYES_MVS/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/BAYES_MVS/a1-[autogen]/python_code.txt index 57c4984355..74f4ed1d0e 100644 --- a/docs/nodes/SCIPY/STATS/BAYES_MVS/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/BAYES_MVS/a1-[autogen]/python_code.txt @@ -6,7 +6,7 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def BAYES_MVS( default: OrderedPair | Matrix, alpha: float = 0.9, diff --git a/docs/nodes/SCIPY/STATS/BINOM_TEST/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/BINOM_TEST/a1-[autogen]/python_code.txt index 6bb33f6f25..1f72699c36 100644 --- a/docs/nodes/SCIPY/STATS/BINOM_TEST/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/BINOM_TEST/a1-[autogen]/python_code.txt @@ -6,23 +6,28 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def BINOM_TEST( default: OrderedPair | Matrix, - n: int, + n: int = 2, p: float = 0.5, alternative: str = "two-sided", ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.stats.binom_test( - x=default.y, - n=n, - p=p, - alternative=alternative, - ), + result = scipy.stats.binom_test( + x=default.y, + n=n, + p=p, + alternative=alternative, ) + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/STATS/DESCRIBE/a1-[autogen]/docstring.txt b/docs/nodes/SCIPY/STATS/DESCRIBE/a1-[autogen]/docstring.txt index 37f5656aa7..8cd2d74dfa 100644 --- a/docs/nodes/SCIPY/STATS/DESCRIBE/a1-[autogen]/docstring.txt +++ b/docs/nodes/SCIPY/STATS/DESCRIBE/a1-[autogen]/docstring.txt @@ -5,7 +5,7 @@ The DESCRIBE node is based on a numpy or scipy function. Parameters ---------- - select_return : This function has returns multiple Objects: + select_return : This function has returns multiple objects: ['nobs', 'mean', 'variance', 'skewness', 'kurtosis']. Select the desired one to return. See the respective function docs for descriptors. a : array_like diff --git a/docs/nodes/SCIPY/STATS/DESCRIBE/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/DESCRIBE/a1-[autogen]/python_code.txt index 5618462d77..08aa841886 100644 --- a/docs/nodes/SCIPY/STATS/DESCRIBE/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/DESCRIBE/a1-[autogen]/python_code.txt @@ -6,7 +6,7 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def DESCRIBE( default: OrderedPair | Matrix, axis: int = 0, @@ -17,15 +17,31 @@ def DESCRIBE( ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.stats.describe( - a=default.y, - axis=axis, - ddof=ddof, - bias=bias, - nan_policy=nan_policy, - ), + result = scipy.stats.describe( + a=default.y, + axis=axis, + ddof=ddof, + bias=bias, + nan_policy=nan_policy, ) + return_list = ["nobs", "mean", "variance", "skewness", "kurtosis"] + if isinstance(result, tuple): + res_dict = {} + num = min(len(result), len(return_list)) + for i in range(num): + res_dict[return_list[i]] = result[i] + result = res_dict[select_return] + else: + result = result._asdict() + result = result[select_return] + + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/STATS/GSTD/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/GSTD/a1-[autogen]/python_code.txt index 1d24cdc941..9319395be0 100644 --- a/docs/nodes/SCIPY/STATS/GSTD/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/GSTD/a1-[autogen]/python_code.txt @@ -6,7 +6,7 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def GSTD( default: OrderedPair | Matrix, axis: int = 0, @@ -14,13 +14,18 @@ def GSTD( ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.stats.gstd( - a=default.y, - axis=axis, - ddof=ddof, - ), + result = scipy.stats.gstd( + a=default.y, + axis=axis, + ddof=ddof, ) + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/STATS/GZSCORE/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/GZSCORE/a1-[autogen]/python_code.txt index 7c3a7e6d9e..8129c5085f 100644 --- a/docs/nodes/SCIPY/STATS/GZSCORE/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/GZSCORE/a1-[autogen]/python_code.txt @@ -6,7 +6,7 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def GZSCORE( default: OrderedPair | Matrix, axis: int = 0, @@ -15,14 +15,19 @@ def GZSCORE( ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.stats.gzscore( - a=default.y, - axis=axis, - ddof=ddof, - nan_policy=nan_policy, - ), + result = scipy.stats.gzscore( + a=default.y, + axis=axis, + ddof=ddof, + nan_policy=nan_policy, ) + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/STATS/JARQUE_BERA/a1-[autogen]/docstring.txt b/docs/nodes/SCIPY/STATS/JARQUE_BERA/a1-[autogen]/docstring.txt index 72f3de4693..f5e3875a9c 100644 --- a/docs/nodes/SCIPY/STATS/JARQUE_BERA/a1-[autogen]/docstring.txt +++ b/docs/nodes/SCIPY/STATS/JARQUE_BERA/a1-[autogen]/docstring.txt @@ -12,7 +12,7 @@ The JARQUE_BERA node is based on a numpy or scipy function. Parameters ---------- - select_return : This function has returns multiple Objects: + select_return : This function has returns multiple objects: ['jb_value', 'p']. Select the desired one to return. See the respective function docs for descriptors. x : array_like diff --git a/docs/nodes/SCIPY/STATS/JARQUE_BERA/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/JARQUE_BERA/a1-[autogen]/python_code.txt index 2f4deb7b87..d095b76ca2 100644 --- a/docs/nodes/SCIPY/STATS/JARQUE_BERA/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/JARQUE_BERA/a1-[autogen]/python_code.txt @@ -6,18 +6,34 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def JARQUE_BERA( default: OrderedPair | Matrix, select_return: Literal["jb_value", "p"] = "jb_value", ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.stats.jarque_bera( - x=default.y, - ), + result = scipy.stats.jarque_bera( + x=default.y, ) + return_list = ["jb_value", "p"] + if isinstance(result, tuple): + res_dict = {} + num = min(len(result), len(return_list)) + for i in range(num): + res_dict[return_list[i]] = result[i] + result = res_dict[select_return] + else: + result = result._asdict() + result = result[select_return] + + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/STATS/KURTOSIS/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/KURTOSIS/a1-[autogen]/python_code.txt index e704c39eba..f3f6f3b099 100644 --- a/docs/nodes/SCIPY/STATS/KURTOSIS/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/KURTOSIS/a1-[autogen]/python_code.txt @@ -6,7 +6,7 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def KURTOSIS( default: OrderedPair | Matrix, axis: int = 0, @@ -17,16 +17,21 @@ def KURTOSIS( ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.stats.kurtosis( - a=default.y, - axis=axis, - fisher=fisher, - bias=bias, - nan_policy=nan_policy, - keepdims=keepdims, - ), + result = scipy.stats.kurtosis( + a=default.y, + axis=axis, + fisher=fisher, + bias=bias, + nan_policy=nan_policy, + keepdims=keepdims, ) + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/STATS/KURTOSISTEST/a1-[autogen]/docstring.txt b/docs/nodes/SCIPY/STATS/KURTOSISTEST/a1-[autogen]/docstring.txt index bec0b5e332..42ac1182c0 100644 --- a/docs/nodes/SCIPY/STATS/KURTOSISTEST/a1-[autogen]/docstring.txt +++ b/docs/nodes/SCIPY/STATS/KURTOSISTEST/a1-[autogen]/docstring.txt @@ -9,7 +9,7 @@ The KURTOSISTEST node is based on a numpy or scipy function. Parameters ---------- - select_return : This function has returns multiple Objects: + select_return : This function has returns multiple objects: ['statistic', 'pvalue']. Select the desired one to return. See the respective function docs for descriptors. a : array diff --git a/docs/nodes/SCIPY/STATS/KURTOSISTEST/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/KURTOSISTEST/a1-[autogen]/python_code.txt index e36fc6ec4b..4166ff1ba6 100644 --- a/docs/nodes/SCIPY/STATS/KURTOSISTEST/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/KURTOSISTEST/a1-[autogen]/python_code.txt @@ -6,7 +6,7 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def KURTOSISTEST( default: OrderedPair | Matrix, axis: int = 0, @@ -16,14 +16,30 @@ def KURTOSISTEST( ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.stats.kurtosistest( - a=default.y, - axis=axis, - nan_policy=nan_policy, - alternative=alternative, - ), + result = scipy.stats.kurtosistest( + a=default.y, + axis=axis, + nan_policy=nan_policy, + alternative=alternative, ) + return_list = ["statistic", "pvalue"] + if isinstance(result, tuple): + res_dict = {} + num = min(len(result), len(return_list)) + for i in range(num): + res_dict[return_list[i]] = result[i] + result = res_dict[select_return] + else: + result = result._asdict() + result = result[select_return] + + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/STATS/MOMENT/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/MOMENT/a1-[autogen]/python_code.txt index 5367655e6f..33b6fdaaf8 100644 --- a/docs/nodes/SCIPY/STATS/MOMENT/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/MOMENT/a1-[autogen]/python_code.txt @@ -6,7 +6,7 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def MOMENT( default: OrderedPair | Matrix, moment: int = 1, @@ -16,15 +16,20 @@ def MOMENT( ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.stats.moment( - a=default.y, - moment=moment, - axis=axis, - nan_policy=nan_policy, - keepdims=keepdims, - ), + result = scipy.stats.moment( + a=default.y, + moment=moment, + axis=axis, + nan_policy=nan_policy, + keepdims=keepdims, ) + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/STATS/MVSDIST/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/MVSDIST/a1-[autogen]/python_code.txt index 08828bc072..85c65cab51 100644 --- a/docs/nodes/SCIPY/STATS/MVSDIST/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/MVSDIST/a1-[autogen]/python_code.txt @@ -6,7 +6,7 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def MVSDIST( default: OrderedPair | Matrix, select_return: Literal["mdist", "vdist", "sdist"] = "mdist", diff --git a/docs/nodes/SCIPY/STATS/NORMALTEST/a1-[autogen]/docstring.txt b/docs/nodes/SCIPY/STATS/NORMALTEST/a1-[autogen]/docstring.txt index 0334155be1..54050f63f7 100644 --- a/docs/nodes/SCIPY/STATS/NORMALTEST/a1-[autogen]/docstring.txt +++ b/docs/nodes/SCIPY/STATS/NORMALTEST/a1-[autogen]/docstring.txt @@ -10,7 +10,7 @@ The NORMALTEST node is based on a numpy or scipy function. Parameters ---------- - select_return : This function has returns multiple Objects: + select_return : This function has returns multiple objects: ['statistic', 'pvalue']. Select the desired one to return. See the respective function docs for descriptors. a : array_like diff --git a/docs/nodes/SCIPY/STATS/NORMALTEST/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/NORMALTEST/a1-[autogen]/python_code.txt index ccd61e5480..ec439c6c43 100644 --- a/docs/nodes/SCIPY/STATS/NORMALTEST/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/NORMALTEST/a1-[autogen]/python_code.txt @@ -6,7 +6,7 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def NORMALTEST( default: OrderedPair | Matrix, axis: int = 0, @@ -15,13 +15,29 @@ def NORMALTEST( ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.stats.normaltest( - a=default.y, - axis=axis, - nan_policy=nan_policy, - ), + result = scipy.stats.normaltest( + a=default.y, + axis=axis, + nan_policy=nan_policy, ) + return_list = ["statistic", "pvalue"] + if isinstance(result, tuple): + res_dict = {} + num = min(len(result), len(return_list)) + for i in range(num): + res_dict[return_list[i]] = result[i] + result = res_dict[select_return] + else: + result = result._asdict() + result = result[select_return] + + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/STATS/SEM/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/SEM/a1-[autogen]/python_code.txt index 93402c1229..0f9e0be433 100644 --- a/docs/nodes/SCIPY/STATS/SEM/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/SEM/a1-[autogen]/python_code.txt @@ -6,7 +6,7 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def SEM( default: OrderedPair | Matrix, axis: int = 0, @@ -15,14 +15,19 @@ def SEM( ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.stats.sem( - a=default.y, - axis=axis, - ddof=ddof, - nan_policy=nan_policy, - ), + result = scipy.stats.sem( + a=default.y, + axis=axis, + ddof=ddof, + nan_policy=nan_policy, ) + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/STATS/SHAPIRO/a1-[autogen]/docstring.txt b/docs/nodes/SCIPY/STATS/SHAPIRO/a1-[autogen]/docstring.txt index dda6cbca57..9af4f50c23 100644 --- a/docs/nodes/SCIPY/STATS/SHAPIRO/a1-[autogen]/docstring.txt +++ b/docs/nodes/SCIPY/STATS/SHAPIRO/a1-[autogen]/docstring.txt @@ -8,7 +8,7 @@ The SHAPIRO node is based on a numpy or scipy function. Parameters ---------- - select_return : This function has returns multiple Objects: + select_return : This function has returns multiple objects: ['statistic', 'p-value']. Select the desired one to return. See the respective function docs for descriptors. x : array_like diff --git a/docs/nodes/SCIPY/STATS/SHAPIRO/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/SHAPIRO/a1-[autogen]/python_code.txt index 27d1b77fe0..04068fae84 100644 --- a/docs/nodes/SCIPY/STATS/SHAPIRO/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/SHAPIRO/a1-[autogen]/python_code.txt @@ -6,18 +6,34 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def SHAPIRO( default: OrderedPair | Matrix, select_return: Literal["statistic", "p-value"] = "statistic", ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.stats.shapiro( - x=default.y, - ), + result = scipy.stats.shapiro( + x=default.y, ) + return_list = ["statistic", "p-value"] + if isinstance(result, tuple): + res_dict = {} + num = min(len(result), len(return_list)) + for i in range(num): + res_dict[return_list[i]] = result[i] + result = res_dict[select_return] + else: + result = result._asdict() + result = result[select_return] + + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/STATS/SIGMACLIP/a1-[autogen]/docstring.txt b/docs/nodes/SCIPY/STATS/SIGMACLIP/a1-[autogen]/docstring.txt index 2d8df6c7d3..613f1d9f5b 100644 --- a/docs/nodes/SCIPY/STATS/SIGMACLIP/a1-[autogen]/docstring.txt +++ b/docs/nodes/SCIPY/STATS/SIGMACLIP/a1-[autogen]/docstring.txt @@ -15,7 +15,7 @@ The SIGMACLIP node is based on a numpy or scipy function. Parameters ---------- - select_return : This function has returns multiple Objects: + select_return : This function has returns multiple objects: ['clipped', 'lower', 'upper']. Select the desired one to return. See the respective function docs for descriptors. a : array_like diff --git a/docs/nodes/SCIPY/STATS/SIGMACLIP/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/SIGMACLIP/a1-[autogen]/python_code.txt index 0dff3c777e..dbe9db8032 100644 --- a/docs/nodes/SCIPY/STATS/SIGMACLIP/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/SIGMACLIP/a1-[autogen]/python_code.txt @@ -6,7 +6,7 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def SIGMACLIP( default: OrderedPair | Matrix, low: float = 4.0, @@ -15,13 +15,29 @@ def SIGMACLIP( ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.stats.sigmaclip( - a=default.y, - low=low, - high=high, - ), + result = scipy.stats.sigmaclip( + a=default.y, + low=low, + high=high, ) + return_list = ["clipped", "lower", "upper"] + if isinstance(result, tuple): + res_dict = {} + num = min(len(result), len(return_list)) + for i in range(num): + res_dict[return_list[i]] = result[i] + result = res_dict[select_return] + else: + result = result._asdict() + result = result[select_return] + + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/STATS/SKEW/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/SKEW/a1-[autogen]/python_code.txt index 5243aca130..dffae74355 100644 --- a/docs/nodes/SCIPY/STATS/SKEW/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/SKEW/a1-[autogen]/python_code.txt @@ -6,7 +6,7 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def SKEW( default: OrderedPair | Matrix, axis: int = 0, @@ -16,15 +16,20 @@ def SKEW( ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.stats.skew( - a=default.y, - axis=axis, - bias=bias, - nan_policy=nan_policy, - keepdims=keepdims, - ), + result = scipy.stats.skew( + a=default.y, + axis=axis, + bias=bias, + nan_policy=nan_policy, + keepdims=keepdims, ) + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/STATS/SKEWTEST/a1-[autogen]/docstring.txt b/docs/nodes/SCIPY/STATS/SKEWTEST/a1-[autogen]/docstring.txt index ad93b48fa9..97500364fe 100644 --- a/docs/nodes/SCIPY/STATS/SKEWTEST/a1-[autogen]/docstring.txt +++ b/docs/nodes/SCIPY/STATS/SKEWTEST/a1-[autogen]/docstring.txt @@ -9,7 +9,7 @@ The SKEWTEST node is based on a numpy or scipy function. Parameters ---------- - select_return : This function has returns multiple Objects: + select_return : This function has returns multiple objects: ['statistic', 'pvalue']. Select the desired one to return. See the respective function docs for descriptors. a : array diff --git a/docs/nodes/SCIPY/STATS/SKEWTEST/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/SKEWTEST/a1-[autogen]/python_code.txt index c21047769a..468284f09d 100644 --- a/docs/nodes/SCIPY/STATS/SKEWTEST/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/SKEWTEST/a1-[autogen]/python_code.txt @@ -6,7 +6,7 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def SKEWTEST( default: OrderedPair | Matrix, axis: int = 0, @@ -16,14 +16,30 @@ def SKEWTEST( ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.stats.skewtest( - a=default.y, - axis=axis, - nan_policy=nan_policy, - alternative=alternative, - ), + result = scipy.stats.skewtest( + a=default.y, + axis=axis, + nan_policy=nan_policy, + alternative=alternative, ) + return_list = ["statistic", "pvalue"] + if isinstance(result, tuple): + res_dict = {} + num = min(len(result), len(return_list)) + for i in range(num): + res_dict[return_list[i]] = result[i] + result = res_dict[select_return] + else: + result = result._asdict() + result = result[select_return] + + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/STATS/TMAX/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/TMAX/a1-[autogen]/python_code.txt index 00cfc836a3..89afee2fbd 100644 --- a/docs/nodes/SCIPY/STATS/TMAX/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/TMAX/a1-[autogen]/python_code.txt @@ -6,25 +6,30 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def TMAX( default: OrderedPair | Matrix, - upperlimit: None or float, + upperlimit: float = 0.1, axis: int = 0, inclusive: bool = True, nan_policy: str = "propagate", ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.stats.tmax( - a=default.y, - upperlimit=upperlimit, - axis=axis, - inclusive=inclusive, - nan_policy=nan_policy, - ), + result = scipy.stats.tmax( + a=default.y, + upperlimit=upperlimit, + axis=axis, + inclusive=inclusive, + nan_policy=nan_policy, ) + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/STATS/TMIN/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/TMIN/a1-[autogen]/python_code.txt index d15275a1bf..f284f419e5 100644 --- a/docs/nodes/SCIPY/STATS/TMIN/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/TMIN/a1-[autogen]/python_code.txt @@ -6,25 +6,30 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def TMIN( default: OrderedPair | Matrix, - lowerlimit: None or float, + lowerlimit: float = 0.1, axis: int = 0, inclusive: bool = True, nan_policy: str = "propagate", ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.stats.tmin( - a=default.y, - lowerlimit=lowerlimit, - axis=axis, - inclusive=inclusive, - nan_policy=nan_policy, - ), + result = scipy.stats.tmin( + a=default.y, + lowerlimit=lowerlimit, + axis=axis, + inclusive=inclusive, + nan_policy=nan_policy, ) + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/STATS/TRIM1/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/TRIM1/a1-[autogen]/python_code.txt index 39ec110db5..be35b1b52d 100644 --- a/docs/nodes/SCIPY/STATS/TRIM1/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/TRIM1/a1-[autogen]/python_code.txt @@ -6,23 +6,28 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def TRIM1( default: OrderedPair | Matrix, - proportiontocut: float, + proportiontocut: float = 0.1, tail: str = "right", axis: int = 0, ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.stats.trim1( - a=default.y, - proportiontocut=proportiontocut, - tail=tail, - axis=axis, - ), + result = scipy.stats.trim1( + a=default.y, + proportiontocut=proportiontocut, + tail=tail, + axis=axis, ) + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/STATS/TRIMBOTH/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/TRIMBOTH/a1-[autogen]/python_code.txt index 9e524617bc..9e153b2daa 100644 --- a/docs/nodes/SCIPY/STATS/TRIMBOTH/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/TRIMBOTH/a1-[autogen]/python_code.txt @@ -6,21 +6,26 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def TRIMBOTH( default: OrderedPair | Matrix, - proportiontocut: float, + proportiontocut: float = 0.1, axis: int = 0, ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.stats.trimboth( - a=default.y, - proportiontocut=proportiontocut, - axis=axis, - ), + result = scipy.stats.trimboth( + a=default.y, + proportiontocut=proportiontocut, + axis=axis, ) + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/STATS/TRIM_MEAN/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/TRIM_MEAN/a1-[autogen]/python_code.txt index 8dc8865a84..34393f34ce 100644 --- a/docs/nodes/SCIPY/STATS/TRIM_MEAN/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/TRIM_MEAN/a1-[autogen]/python_code.txt @@ -6,21 +6,26 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def TRIM_MEAN( default: OrderedPair | Matrix, - proportiontocut: float, + proportiontocut: float = 0.1, axis: int = 0, ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.stats.trim_mean( - a=default.y, - proportiontocut=proportiontocut, - axis=axis, - ), + result = scipy.stats.trim_mean( + a=default.y, + proportiontocut=proportiontocut, + axis=axis, ) + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/STATS/TTEST_1SAMP/a1-[autogen]/docstring.txt b/docs/nodes/SCIPY/STATS/TTEST_1SAMP/a1-[autogen]/docstring.txt index b9b55de02c..c9f58152c8 100644 --- a/docs/nodes/SCIPY/STATS/TTEST_1SAMP/a1-[autogen]/docstring.txt +++ b/docs/nodes/SCIPY/STATS/TTEST_1SAMP/a1-[autogen]/docstring.txt @@ -9,7 +9,7 @@ The TTEST_1SAMP node is based on a numpy or scipy function. Parameters ---------- - select_return : This function has returns multiple Objects: + select_return : This function has returns multiple objects: ['statistic', 'pvalue']. Select the desired one to return. See the respective function docs for descriptors. a : array_like diff --git a/docs/nodes/SCIPY/STATS/TTEST_1SAMP/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/TTEST_1SAMP/a1-[autogen]/python_code.txt index 87040c6502..a8de56e52c 100644 --- a/docs/nodes/SCIPY/STATS/TTEST_1SAMP/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/TTEST_1SAMP/a1-[autogen]/python_code.txt @@ -6,10 +6,10 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def TTEST_1SAMP( default: OrderedPair | Matrix, - popmean: float or array_like, + popmean: float = 0.1, axis: int = 0, nan_policy: str = "propagate", alternative: str = "two-sided", @@ -17,15 +17,31 @@ def TTEST_1SAMP( ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.stats.ttest_1samp( - a=default.y, - popmean=popmean, - axis=axis, - nan_policy=nan_policy, - alternative=alternative, - ), + result = scipy.stats.ttest_1samp( + a=default.y, + popmean=popmean, + axis=axis, + nan_policy=nan_policy, + alternative=alternative, ) + return_list = ["statistic", "pvalue"] + if isinstance(result, tuple): + res_dict = {} + num = min(len(result), len(return_list)) + for i in range(num): + res_dict[return_list[i]] = result[i] + result = res_dict[select_return] + else: + result = result._asdict() + result = result[select_return] + + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/STATS/VARIATION/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/VARIATION/a1-[autogen]/python_code.txt index 9b201fd8a1..79c23d4f5d 100644 --- a/docs/nodes/SCIPY/STATS/VARIATION/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/VARIATION/a1-[autogen]/python_code.txt @@ -6,7 +6,7 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def VARIATION( default: OrderedPair | Matrix, axis: int = 0, @@ -16,15 +16,20 @@ def VARIATION( ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.stats.variation( - a=default.y, - axis=axis, - nan_policy=nan_policy, - ddof=ddof, - keepdims=keepdims, - ), + result = scipy.stats.variation( + a=default.y, + axis=axis, + nan_policy=nan_policy, + ddof=ddof, + keepdims=keepdims, ) + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/STATS/YEOJOHNSON/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/YEOJOHNSON/a1-[autogen]/python_code.txt index 0377cbea11..2abc84e34e 100644 --- a/docs/nodes/SCIPY/STATS/YEOJOHNSON/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/YEOJOHNSON/a1-[autogen]/python_code.txt @@ -6,19 +6,24 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def YEOJOHNSON( default: OrderedPair | Matrix, - lmbda: float, + lmbda: float = 0.1, ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.stats.yeojohnson( - x=default.y, - lmbda=lmbda, - ), + result = scipy.stats.yeojohnson( + x=default.y, + lmbda=lmbda, ) + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/SCIPY/STATS/ZSCORE/a1-[autogen]/python_code.txt b/docs/nodes/SCIPY/STATS/ZSCORE/a1-[autogen]/python_code.txt index d56fd04c1d..354780f558 100644 --- a/docs/nodes/SCIPY/STATS/ZSCORE/a1-[autogen]/python_code.txt +++ b/docs/nodes/SCIPY/STATS/ZSCORE/a1-[autogen]/python_code.txt @@ -6,7 +6,7 @@ from typing import Literal import scipy.stats -@flojoy(node_type="default") +@flojoy def ZSCORE( default: OrderedPair | Matrix, axis: int = 0, @@ -15,14 +15,19 @@ def ZSCORE( ) -> OrderedPair | Matrix | Scalar: - result = OrderedPair( - x=default.x, - y=scipy.stats.zscore( - a=default.y, - axis=axis, - ddof=ddof, - nan_policy=nan_policy, - ), + result = scipy.stats.zscore( + a=default.y, + axis=axis, + ddof=ddof, + nan_policy=nan_policy, ) + if isinstance(result, np.ndarray): + result = OrderedPair(x=default.x, y=result) + else: + assert isinstance( + result, np.number | float | int + ), f"Expected np.number, float or int for result, got {type(result)}" + result = Scalar(c=float(result)) + return result diff --git a/docs/nodes/TRANSFORMERS/ARITHMETIC/ABS/examples/EX1/app.txt b/docs/nodes/TRANSFORMERS/ARITHMETIC/ABS/examples/EX1/app.txt index 9bf3a52c6a..e6da45d1ea 100644 --- a/docs/nodes/TRANSFORMERS/ARITHMETIC/ABS/examples/EX1/app.txt +++ b/docs/nodes/TRANSFORMERS/ARITHMETIC/ABS/examples/EX1/app.txt @@ -95,49 +95,16 @@ }, "dragging": true }, - { - "width": 210, - "height": 130, - "id": "END-e6194b0d-ff9a-4f31-815a-2ebf1b034655", - "type": "TERMINATORS", - "data": { - "id": "END-e6194b0d-ff9a-4f31-815a-2ebf1b034655", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": true - }, - "position": { - "x": 1085.4832229508454, - "y": 191.99797353258577 - }, - "selected": true, - "positionAbsolute": { - "x": 1085.4832229508454, - "y": 191.99797353258577 - }, - "dragging": true - }, { "width": 225, "height": 226, "id": "SCATTER-cf6d079b-1d2a-4e7f-b3eb-b1eb391237a9", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "SCATTER-cf6d079b-1d2a-4e7f-b3eb-b1eb391237a9", "label": "SCATTER", "func": "SCATTER", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -183,13 +150,6 @@ "target": "SCATTER-cf6d079b-1d2a-4e7f-b3eb-b1eb391237a9", "targetHandle": "default", "id": "reactflow__edge-ABS-ad25f309-790f-41e6-961e-66a8d31804ebdefault-SCATTER-cf6d079b-1d2a-4e7f-b3eb-b1eb391237a9default" - }, - { - "source": "SCATTER-cf6d079b-1d2a-4e7f-b3eb-b1eb391237a9", - "sourceHandle": "default", - "target": "END-e6194b0d-ff9a-4f31-815a-2ebf1b034655", - "targetHandle": "default", - "id": "reactflow__edge-SCATTER-cf6d079b-1d2a-4e7f-b3eb-b1eb391237a9default-END-e6194b0d-ff9a-4f31-815a-2ebf1b034655default" } ], "viewport": { diff --git a/docs/nodes/TRANSFORMERS/ARITHMETIC/ADD/examples/EX1/app.txt b/docs/nodes/TRANSFORMERS/ARITHMETIC/ADD/examples/EX1/app.txt index 437a60257d..7d299bae5e 100644 --- a/docs/nodes/TRANSFORMERS/ARITHMETIC/ADD/examples/EX1/app.txt +++ b/docs/nodes/TRANSFORMERS/ARITHMETIC/ADD/examples/EX1/app.txt @@ -59,12 +59,12 @@ "width": 130, "height": 130, "id": "SINE-990ddb8d-e21a-4365-b291-67758709e0fe", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "SINE-990ddb8d-e21a-4365-b291-67758709e0fe", "label": "SINE", "func": "SINE", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "amplitude": { "type": "float", @@ -141,12 +141,12 @@ "width": 130, "height": 130, "id": "SINE-d52400c2-b5b4-49f1-a558-d0e6dd4ab509", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "SINE-d52400c2-b5b4-49f1-a558-d0e6dd4ab509", "label": "SINE 1", "func": "SINE", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "amplitude": { "type": "float", @@ -269,12 +269,12 @@ "width": 225, "height": 226, "id": "SCATTER-60ebf12f-24b1-4b81-81a2-320252811811", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "SCATTER-60ebf12f-24b1-4b81-81a2-320252811811", "label": "SCATTER", "func": "SCATTER", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -305,49 +305,16 @@ }, "dragging": true }, - { - "width": 210, - "height": 130, - "id": "END-22c7b27a-10c5-4298-9245-0db822745833", - "type": "TERMINATORS", - "data": { - "id": "END-22c7b27a-10c5-4298-9245-0db822745833", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": true - }, - "position": { - "x": 1145.8986427121345, - "y": 245.50882721801798 - }, - "selected": true, - "positionAbsolute": { - "x": 1145.8986427121345, - "y": 245.50882721801798 - }, - "dragging": true - }, { "width": 130, "height": 130, "id": "SINE-70c5c7c4-e2dc-4a9f-abd1-2ce8208eb2ff", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "SINE-70c5c7c4-e2dc-4a9f-abd1-2ce8208eb2ff", "label": "SINE 2", "func": "SINE", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "amplitude": { "type": "float", @@ -458,13 +425,6 @@ "targetHandle": "default", "id": "reactflow__edge-ADD-6913967c-6486-478d-91ec-e9db7d795e39default-SCATTER-60ebf12f-24b1-4b81-81a2-320252811811default" }, - { - "source": "SCATTER-60ebf12f-24b1-4b81-81a2-320252811811", - "sourceHandle": "default", - "target": "END-22c7b27a-10c5-4298-9245-0db822745833", - "targetHandle": "default", - "id": "reactflow__edge-SCATTER-60ebf12f-24b1-4b81-81a2-320252811811default-END-22c7b27a-10c5-4298-9245-0db822745833default" - }, { "source": "SINE-70c5c7c4-e2dc-4a9f-abd1-2ce8208eb2ff", "sourceHandle": "default", diff --git a/docs/nodes/TRANSFORMERS/ARITHMETIC/DIVIDE/examples/EX1/app.txt b/docs/nodes/TRANSFORMERS/ARITHMETIC/DIVIDE/examples/EX1/app.txt index c7e8b4f9da..c72222cb01 100644 --- a/docs/nodes/TRANSFORMERS/ARITHMETIC/DIVIDE/examples/EX1/app.txt +++ b/docs/nodes/TRANSFORMERS/ARITHMETIC/DIVIDE/examples/EX1/app.txt @@ -113,12 +113,12 @@ "width": 130, "height": 130, "id": "SINE-0c1b9fec-3f11-46b6-87de-4d9d4bd25878", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "SINE-0c1b9fec-3f11-46b6-87de-4d9d4bd25878", "label": "SINE", "func": "SINE", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "amplitude": { "type": "float", @@ -191,49 +191,16 @@ }, "dragging": true }, - { - "width": 210, - "height": 130, - "id": "END-2209463f-bfeb-4787-b0cd-0c585a316cb3", - "type": "TERMINATORS", - "data": { - "id": "END-2209463f-bfeb-4787-b0cd-0c585a316cb3", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", - "selected": true - }, - "position": { - "x": 1998.209346880817, - "y": 230.22128020755002 - }, - "selected": true, - "positionAbsolute": { - "x": 1998.209346880817, - "y": 230.22128020755002 - }, - "dragging": true - }, { "width": 225, "height": 226, "id": "SCATTER-21704aae-9020-418b-af35-0ff9aa08e52d", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "SCATTER-21704aae-9020-418b-af35-0ff9aa08e52d", "label": "SCATTER", "func": "SCATTER", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -314,12 +281,12 @@ "width": 130, "height": 130, "id": "SINE-9d81de2f-d788-4df9-86b0-70a1d9bebe40", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "SINE-9d81de2f-d788-4df9-86b0-70a1d9bebe40", "label": "SINE 1", "func": "SINE", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "amplitude": { "type": "float", @@ -401,13 +368,6 @@ "targetHandle": "default", "id": "reactflow__edge-LINSPACE-3c8676a0-d750-4ffb-9383-744e93cdc059default-SINE-0c1b9fec-3f11-46b6-87de-4d9d4bd25878default" }, - { - "source": "SCATTER-21704aae-9020-418b-af35-0ff9aa08e52d", - "sourceHandle": "default", - "target": "END-2209463f-bfeb-4787-b0cd-0c585a316cb3", - "targetHandle": "default", - "id": "reactflow__edge-SCATTER-21704aae-9020-418b-af35-0ff9aa08e52ddefault-END-2209463f-bfeb-4787-b0cd-0c585a316cb3default" - }, { "source": "SINE-0c1b9fec-3f11-46b6-87de-4d9d4bd25878", "sourceHandle": "default", diff --git a/docs/nodes/TRANSFORMERS/ARITHMETIC/MULTIPLY/examples/EX1/app.txt b/docs/nodes/TRANSFORMERS/ARITHMETIC/MULTIPLY/examples/EX1/app.txt index 57f92059bc..d394bed390 100644 --- a/docs/nodes/TRANSFORMERS/ARITHMETIC/MULTIPLY/examples/EX1/app.txt +++ b/docs/nodes/TRANSFORMERS/ARITHMETIC/MULTIPLY/examples/EX1/app.txt @@ -1,49 +1,16 @@ { "rfInstance": { "nodes": [ - { - "width": 210, - "height": 130, - "id": "END-1910d95d-6f10-4677-83b2-c5b78d23b2c4", - "type": "TERMINATORS", - "data": { - "id": "END-1910d95d-6f10-4677-83b2-c5b78d23b2c4", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", - "selected": false - }, - "position": { - "x": 2252.804064088793, - "y": 461.05027356353594 - }, - "selected": false, - "positionAbsolute": { - "x": 2252.804064088793, - "y": 461.05027356353594 - }, - "dragging": true - }, { "width": 130, "height": 130, "id": "SINE-2cc933b2-9d01-45bb-96a3-a8dceee7a15d", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "SINE-2cc933b2-9d01-45bb-96a3-a8dceee7a15d", "label": "SINE", "func": "SINE", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "amplitude": { "type": "float", @@ -120,12 +87,12 @@ "width": 225, "height": 226, "id": "SCATTER-9927419b-29bb-4d10-bf5a-79ea28add9a9", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "SCATTER-9927419b-29bb-4d10-bf5a-79ea28add9a9", "label": "SCATTER", "func": "SCATTER", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -206,12 +173,12 @@ "width": 130, "height": 130, "id": "CONSTANT-352d5c77-f4c3-4b53-93b9-bdc31d39ad9c", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "CONSTANT-352d5c77-f4c3-4b53-93b9-bdc31d39ad9c", "label": "2.0", "func": "CONSTANT", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "constant": { "type": "float", @@ -291,13 +258,13 @@ } ], "path": "PYTHON/nodes/GENERATORS/SIMULATIONS/LINSPACE/LINSPACE.py", - "selected": true + "selected": false }, "position": { "x": 970.118927622176, "y": 474.2206729930675 }, - "selected": true, + "selected": false, "positionAbsolute": { "x": 970.118927622176, "y": 474.2206729930675 @@ -306,13 +273,6 @@ } ], "edges": [ - { - "source": "SCATTER-9927419b-29bb-4d10-bf5a-79ea28add9a9", - "sourceHandle": "default", - "target": "END-1910d95d-6f10-4677-83b2-c5b78d23b2c4", - "targetHandle": "default", - "id": "reactflow__edge-SCATTER-9927419b-29bb-4d10-bf5a-79ea28add9a9default-END-1910d95d-6f10-4677-83b2-c5b78d23b2c4default" - }, { "source": "SINE-2cc933b2-9d01-45bb-96a3-a8dceee7a15d", "sourceHandle": "default", diff --git a/docs/nodes/TRANSFORMERS/ARITHMETIC/SUBTRACT/examples/EX1/app.txt b/docs/nodes/TRANSFORMERS/ARITHMETIC/SUBTRACT/examples/EX1/app.txt index 2e8bd3c135..52fb7218e3 100644 --- a/docs/nodes/TRANSFORMERS/ARITHMETIC/SUBTRACT/examples/EX1/app.txt +++ b/docs/nodes/TRANSFORMERS/ARITHMETIC/SUBTRACT/examples/EX1/app.txt @@ -59,12 +59,12 @@ "width": 130, "height": 130, "id": "SINE-990ddb8d-e21a-4365-b291-67758709e0fe", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "SINE-990ddb8d-e21a-4365-b291-67758709e0fe", "label": "SINE", "func": "SINE", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "amplitude": { "type": "float", @@ -141,12 +141,12 @@ "width": 130, "height": 130, "id": "SINE-d52400c2-b5b4-49f1-a558-d0e6dd4ab509", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "SINE-d52400c2-b5b4-49f1-a558-d0e6dd4ab509", "label": "SINE 1", "func": "SINE", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "amplitude": { "type": "float", @@ -223,12 +223,12 @@ "width": 225, "height": 226, "id": "SCATTER-60ebf12f-24b1-4b81-81a2-320252811811", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "SCATTER-60ebf12f-24b1-4b81-81a2-320252811811", "label": "SCATTER", "func": "SCATTER", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -259,49 +259,16 @@ }, "dragging": true }, - { - "width": 210, - "height": 130, - "id": "END-22c7b27a-10c5-4298-9245-0db822745833", - "type": "TERMINATORS", - "data": { - "id": "END-22c7b27a-10c5-4298-9245-0db822745833", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": true - }, - "position": { - "x": 1179.3722517033862, - "y": 263.4347427690019 - }, - "selected": true, - "positionAbsolute": { - "x": 1179.3722517033862, - "y": 263.4347427690019 - }, - "dragging": true - }, { "width": 130, "height": 130, "id": "SINE-70c5c7c4-e2dc-4a9f-abd1-2ce8208eb2ff", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "SINE-70c5c7c4-e2dc-4a9f-abd1-2ce8208eb2ff", "label": "SINE 2", "func": "SINE", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "amplitude": { "type": "float", @@ -436,13 +403,6 @@ "targetHandle": "default", "id": "reactflow__edge-LINSPACE-5141f39e-1fea-4266-9396-4663f566a676default-SINE-d52400c2-b5b4-49f1-a558-d0e6dd4ab509default" }, - { - "source": "SCATTER-60ebf12f-24b1-4b81-81a2-320252811811", - "sourceHandle": "default", - "target": "END-22c7b27a-10c5-4298-9245-0db822745833", - "targetHandle": "default", - "id": "reactflow__edge-SCATTER-60ebf12f-24b1-4b81-81a2-320252811811default-END-22c7b27a-10c5-4298-9245-0db822745833default" - }, { "source": "LINSPACE-5141f39e-1fea-4266-9396-4663f566a676", "sourceHandle": "default", diff --git a/docs/nodes/TRANSFORMERS/CALCULUS/DIFFERENTIATE/a1-[autogen]/python_code.txt b/docs/nodes/TRANSFORMERS/CALCULUS/DIFFERENTIATE/a1-[autogen]/python_code.txt index 94a20715e2..ec8e23f41e 100644 --- a/docs/nodes/TRANSFORMERS/CALCULUS/DIFFERENTIATE/a1-[autogen]/python_code.txt +++ b/docs/nodes/TRANSFORMERS/CALCULUS/DIFFERENTIATE/a1-[autogen]/python_code.txt @@ -1,16 +1,29 @@ -from flojoy import flojoy, OrderedPair +from flojoy import flojoy, OrderedPair, Vector import numpy as np @flojoy -def DIFFERENTIATE(default: OrderedPair) -> OrderedPair: +def DIFFERENTIATE(default: OrderedPair | Vector) -> OrderedPair: - input_x = default.x - input_y = default.y - if len(input_x) != len(input_y): - raise ValueError(f"Invalid inputs, x:{input_x} y:{input_y}") + match default: + case OrderedPair(): + input_x = default.x + input_y = default.y - differentiate = np.diff(input_y) / np.diff(input_x) + if len(input_x) != len(input_y): + raise ValueError( + f" X and Y keys must have the same length, got x of length {len(input_x)} and y {len(input_y)}" + ) - return OrderedPair(x=input_x, y=differentiate) + differentiate = np.diff(input_y) / np.diff(input_x) + + return OrderedPair(x=input_x, y=differentiate) + case Vector(): + input_x = np.arange((len(default.v) - 1)) + differentiate = np.zeros_like(input_x) + + for i in range(0, len(input_x)): + differentiate[i] = default.v[i + 1] - default.v[i] + + return OrderedPair(x=input_x, y=differentiate) diff --git a/docs/nodes/TRANSFORMERS/CALCULUS/DIFFERENTIATE/examples/EX1/app.txt b/docs/nodes/TRANSFORMERS/CALCULUS/DIFFERENTIATE/examples/EX1/app.txt index a256fbdfc0..00c7304f04 100644 --- a/docs/nodes/TRANSFORMERS/CALCULUS/DIFFERENTIATE/examples/EX1/app.txt +++ b/docs/nodes/TRANSFORMERS/CALCULUS/DIFFERENTIATE/examples/EX1/app.txt @@ -24,7 +24,7 @@ "default": 0, "functionName": "LINSPACE", "param": "end", - "value": "10" + "value": "100" }, "step": { "type": "int", @@ -38,7 +38,7 @@ { "name": "default", "id": "default", - "type": "OrderedPair" + "type": "Vector" } ], "path": "PYTHON/nodes/GENERATORS/SIMULATIONS/LINSPACE/LINSPACE.py", @@ -59,18 +59,18 @@ "width": 150, "height": 150, "id": "DIFFERENTIATE-9fae03db-8157-4b96-9b18-9b52084d102e", - "type": "CALCULUS", + "type": "TRANSFORMERS", "data": { "id": "DIFFERENTIATE-9fae03db-8157-4b96-9b18-9b52084d102e", "label": "DIFFERENTIATE", "func": "DIFFERENTIATE", - "type": "CALCULUS", + "type": "TRANSFORMERS", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", - "type": "OrderedPair", + "type": "OrderedPair|Vector", "multiple": false } ], @@ -95,55 +95,22 @@ }, "dragging": true }, - { - "width": 210, - "height": 130, - "id": "END-ae92e33e-dac3-4229-973f-e5f6e3d7825d", - "type": "TERMINATORS", - "data": { - "id": "END-ae92e33e-dac3-4229-973f-e5f6e3d7825d", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 753.1549869331587, - "y": 122.21573288647164 - }, - "selected": false, - "positionAbsolute": { - "x": 753.1549869331587, - "y": 122.21573288647164 - }, - "dragging": true - }, { "width": 225, "height": 226, "id": "LINE-400a651b-783c-464e-966b-4b80afde8479", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-400a651b-783c-464e-966b-4b80afde8479", "label": "LINE", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", - "type": "OrderedPair|DataFrame|Matrix", + "type": "OrderedPair|DataFrame|Matrix|Vector", "multiple": false } ], @@ -172,18 +139,18 @@ "width": 225, "height": 226, "id": "LINE-61d1c07f-3488-4e60-8516-590e91a676f8", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-61d1c07f-3488-4e60-8516-590e91a676f8", "label": "LINE 1", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", - "type": "OrderedPair|DataFrame|Matrix", + "type": "OrderedPair|DataFrame|Matrix|Vector", "multiple": false } ], @@ -230,20 +197,6 @@ "target": "LINE-61d1c07f-3488-4e60-8516-590e91a676f8", "targetHandle": "default", "id": "reactflow__edge-DIFFERENTIATE-9fae03db-8157-4b96-9b18-9b52084d102edefault-LINE-61d1c07f-3488-4e60-8516-590e91a676f8default" - }, - { - "source": "LINE-61d1c07f-3488-4e60-8516-590e91a676f8", - "sourceHandle": "default", - "target": "END-ae92e33e-dac3-4229-973f-e5f6e3d7825d", - "targetHandle": "default", - "id": "reactflow__edge-LINE-61d1c07f-3488-4e60-8516-590e91a676f8default-END-ae92e33e-dac3-4229-973f-e5f6e3d7825ddefault" - }, - { - "source": "LINE-400a651b-783c-464e-966b-4b80afde8479", - "sourceHandle": "default", - "target": "END-ae92e33e-dac3-4229-973f-e5f6e3d7825d", - "targetHandle": "default", - "id": "reactflow__edge-LINE-400a651b-783c-464e-966b-4b80afde8479default-END-ae92e33e-dac3-4229-973f-e5f6e3d7825ddefault" } ], "viewport": { @@ -271,4 +224,4 @@ } } ] -} \ No newline at end of file +} diff --git a/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_DEFINITE_INTEGRAL/a1-[autogen]/python_code.txt b/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_DEFINITE_INTEGRAL/a1-[autogen]/python_code.txt index 22e3142937..92929b897d 100644 --- a/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_DEFINITE_INTEGRAL/a1-[autogen]/python_code.txt +++ b/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_DEFINITE_INTEGRAL/a1-[autogen]/python_code.txt @@ -3,7 +3,7 @@ from scipy import integrate from sympy import parse_expr, lambdify -@flojoy +@flojoy(deps={"sympy": "1.12"}) def DOUBLE_DEFINITE_INTEGRAL( function: str = "", upper_bound_x: float = 0.0, diff --git a/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_DEFINITE_INTEGRAL/examples/EX1/app.txt b/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_DEFINITE_INTEGRAL/examples/EX1/app.txt index 66b54e2767..c74a4651bb 100644 --- a/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_DEFINITE_INTEGRAL/examples/EX1/app.txt +++ b/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_DEFINITE_INTEGRAL/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 150, "height": 150, "id": "DOUBLE_DEFINITE_INTEGRAL-c215aaac-b66e-4117-b317-1533b8e94265", - "type": "CALCULUS", + "type": "TRANSFORMERS", "data": { "id": "DOUBLE_DEFINITE_INTEGRAL-c215aaac-b66e-4117-b317-1533b8e94265", "label": "DOUBLE DEFINITE INTEGRAL", "func": "DOUBLE_DEFINITE_INTEGRAL", - "type": "CALCULUS", + "type": "TRANSFORMERS", "ctrls": { "function": { "type": "str", @@ -73,12 +73,12 @@ "width": 130, "height": 130, "id": "SINE-808a8ccb-a21c-4f1c-8777-69d0ffde8435", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "SINE-808a8ccb-a21c-4f1c-8777-69d0ffde8435", "label": "SINE", "func": "SINE", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "amplitude": { "type": "float", @@ -126,7 +126,7 @@ { "name": "default", "id": "default", - "type": "OrderedPair", + "type": "OrderedPair|Vector", "multiple": false } ], @@ -188,7 +188,7 @@ { "name": "default", "id": "default", - "type": "OrderedPair" + "type": "Vector" } ], "path": "PYTHON/nodes/GENERATORS/SIMULATIONS/LINSPACE/LINSPACE.py", @@ -220,13 +220,13 @@ { "name": "a", "id": "a", - "type": "OrderedPair|Scalar", + "type": "OrderedPair|Scalar|Vector", "multiple": false }, { "name": "b", "id": "b", - "type": "OrderedPair|Scalar", + "type": "OrderedPair|Scalar|Vector", "multiple": true } ], @@ -234,7 +234,7 @@ { "name": "default", "id": "default", - "type": "OrderedPair|Scalar" + "type": "OrderedPair|Scalar|Vector" } ], "path": "PYTHON/nodes/TRANSFORMERS/ARITHMETIC/ADD/ADD.py", @@ -255,12 +255,12 @@ "width": 225, "height": 226, "id": "SCATTER-d11db416-92b7-4511-a6c2-0bcdcb8064c1", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "SCATTER-d11db416-92b7-4511-a6c2-0bcdcb8064c1", "label": "SCATTER", "func": "SCATTER", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -295,12 +295,12 @@ "width": 225, "height": 226, "id": "SCATTER-b69cc4b7-5314-4bdc-a841-e546ee999921", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "SCATTER-b69cc4b7-5314-4bdc-a841-e546ee999921", "label": "SCATTER 1", "func": "SCATTER", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -330,39 +330,6 @@ "y": -53.68983399612759 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-fb60c910-1418-4259-938b-5bd861118271", - "type": "TERMINATORS", - "data": { - "id": "END-fb60c910-1418-4259-938b-5bd861118271", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 762.666676632996, - "y": 128.24667347585165 - }, - "selected": false, - "positionAbsolute": { - "x": 762.666676632996, - "y": 128.24667347585165 - }, - "dragging": true } ], "edges": [ @@ -400,20 +367,6 @@ "target": "SCATTER-d11db416-92b7-4511-a6c2-0bcdcb8064c1", "targetHandle": "default", "id": "reactflow__edge-ADD-a5baa9e5-24f1-4272-a9cf-3ad9efdf8983default-SCATTER-d11db416-92b7-4511-a6c2-0bcdcb8064c1default" - }, - { - "source": "SCATTER-b69cc4b7-5314-4bdc-a841-e546ee999921", - "sourceHandle": "default", - "target": "END-fb60c910-1418-4259-938b-5bd861118271", - "targetHandle": "default", - "id": "reactflow__edge-SCATTER-b69cc4b7-5314-4bdc-a841-e546ee999921default-END-fb60c910-1418-4259-938b-5bd861118271default" - }, - { - "source": "SCATTER-d11db416-92b7-4511-a6c2-0bcdcb8064c1", - "sourceHandle": "default", - "target": "END-fb60c910-1418-4259-938b-5bd861118271", - "targetHandle": "default", - "id": "reactflow__edge-SCATTER-d11db416-92b7-4511-a6c2-0bcdcb8064c1default-END-fb60c910-1418-4259-938b-5bd861118271default" } ], "viewport": { @@ -441,4 +394,4 @@ } } ] -} \ No newline at end of file +} diff --git a/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_INDEFINITE_INTEGRAL/DOUBLE_INDEFINITE_INTEGRAL.md b/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_INDEFINITE_INTEGRAL/DOUBLE_INDEFINITE_INTEGRAL.md index 746b47f0a0..3ce2a5143c 100644 --- a/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_INDEFINITE_INTEGRAL/DOUBLE_INDEFINITE_INTEGRAL.md +++ b/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_INDEFINITE_INTEGRAL/DOUBLE_INDEFINITE_INTEGRAL.md @@ -3,7 +3,6 @@ import DocString from '@site/src/components/DocString'; import PythonCode from '@site/src/components/PythonCode'; - import AppDisplay from '@site/src/components/AppDisplay'; import SectionBreak from '@site/src/components/SectionBreak'; import AppendixSection from '@site/src/components/AppendixSection'; @@ -13,11 +12,9 @@ import AppendixSection from '@site/src/components/AppendixSection'; import DocstringSource from '!!raw-loader!./a1-[autogen]/docstring.txt'; import PythonSource from '!!raw-loader!./a1-[autogen]/python_code.txt'; - {DocstringSource} {PythonSource} - @@ -26,13 +23,23 @@ import PythonSource from '!!raw-loader!./a1-[autogen]/python_code.txt'; ## Examples +import Example1 from './examples/EX1/example.md'; +import App1 from '!!raw-loader!./examples/EX1/app.txt'; +import appImg from './examples/EX1/app.jpeg' + + + nodeLabel='DOUBLE_INDEFINITE_INTEGRAL' + appImg={appImg} + outputImg={''} + > + {App1} - + + + [//]: # (Appendix) diff --git a/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_INDEFINITE_INTEGRAL/a1-[autogen]/docstring.txt b/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_INDEFINITE_INTEGRAL/a1-[autogen]/docstring.txt index d33e548228..c3eab51f6f 100644 --- a/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_INDEFINITE_INTEGRAL/a1-[autogen]/docstring.txt +++ b/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_INDEFINITE_INTEGRAL/a1-[autogen]/docstring.txt @@ -1,12 +1,17 @@ -The INDEFINITE_INTEGRAL node takes three matrices and computes double integral. -It returns a matrix where each cell represents volumn up to the given point. +The DOUBLE_INDEFINITE_INTEGRAL node takes an OrderedTriple (x,y,z) and have the width and height parameter. +The width and height respectively represent the number of columns and rows that the x, y and z reshape matrices will have. +Here it's important to note that the length of x, y and z is the same and that the width times the height need to be equal to the length of x, y and z. +It computes the double integral approximation according to the matrices dimensions given and it returns a matrix where each cell represents volume up to the given point. Parameters ---------- -None +width: int + Number of columns of the 3 matrices generate by reshaping the x, y and z columns of the OrderedTriple. +height: int + Number of rows of the 3 matrices generate by reshaping the x, y and z columns of the OrderedTriple. Returns ------- -DataContainer: - type 'matrix', m +m: Matrix + matrix containing in each cell the volume up to that point. diff --git a/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_INDEFINITE_INTEGRAL/a1-[autogen]/python_code.txt b/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_INDEFINITE_INTEGRAL/a1-[autogen]/python_code.txt index e8a81336b8..48eb2e0b99 100644 --- a/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_INDEFINITE_INTEGRAL/a1-[autogen]/python_code.txt +++ b/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_INDEFINITE_INTEGRAL/a1-[autogen]/python_code.txt @@ -3,16 +3,40 @@ import numpy as np @flojoy -def DOUBLE_INDEFINITE_INTEGRAL(default: OrderedTriple) -> Matrix: +def DOUBLE_INDEFINITE_INTEGRAL( + default: OrderedTriple, width: int = 3, height: int = 3 +) -> Matrix: - input_x = default.x - input_y = default.y - input_z = default.z + + def contains_only_numbers(column): + return all(isinstance(value, (np.int_, np.float_)) for value in column) + + if np.divide(len(default.x), width) == height: + if not contains_only_numbers(default.x): + raise ValueError( + "There is some values that are not of type int or float. The OrderedTriple need to contain only int or float values." + ) + elif not contains_only_numbers(default.y): + raise ValueError( + "There is some values that are not of type int or float. The OrderedTriple need to contain only int or float values." + ) + elif not contains_only_numbers(default.z): + raise ValueError( + "There is some values that are not of type int or float. The OrderedTriple need to contain only int or float values." + ) + + input_x = np.reshape(default.x, (height, width)) + input_y = np.reshape(default.y, (height, width)) + input_z = np.reshape(default.z, (height, width)) + else: + raise ArithmeticError( + f"Cannot reshape size {len(default.x)} in a matrix of {width} by {height}. Please enter appropriate width and height." + ) integrate = np.zeros_like(input_x) for i in range(1, len(input_x)): - for j in range(1, len(input_y)): + for j in range(1, width): cal = ( (input_x[i][j] - input_x[i][j - 1]) * (input_y[i][j] - input_y[i - 1][j]) @@ -28,9 +52,9 @@ def DOUBLE_INDEFINITE_INTEGRAL(default: OrderedTriple) -> Matrix: result = np.copy(integrate) - for i in range(len(integrate)): - for j in range(1, len(integrate)): - if i == 0: + for i in range(1, len(integrate)): + for j in range(1, width): + if i == 1: result[i][j] = result[i][j - 1] + result[i][j] elif j == 1: result[i][j] = result[i - 1][j] + result[i][j] diff --git a/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_INDEFINITE_INTEGRAL/examples/EX1/app.jpeg b/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_INDEFINITE_INTEGRAL/examples/EX1/app.jpeg new file mode 100644 index 0000000000..284981ff7b Binary files /dev/null and b/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_INDEFINITE_INTEGRAL/examples/EX1/app.jpeg differ diff --git a/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_INDEFINITE_INTEGRAL/examples/EX1/app.txt b/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_INDEFINITE_INTEGRAL/examples/EX1/app.txt new file mode 100644 index 0000000000..096268ad65 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_INDEFINITE_INTEGRAL/examples/EX1/app.txt @@ -0,0 +1,450 @@ +{ + "rfInstance": { + "nodes": [ + { + "width": 208, + "height": 100, + "id": "R_DATASET-765242a4-5a30-430b-b93f-c5028c656c47", + "type": "GENERATORS", + "data": { + "id": "R_DATASET-765242a4-5a30-430b-b93f-c5028c656c47", + "label": "R DATASET", + "func": "R_DATASET", + "type": "GENERATORS", + "ctrls": { + "dataset_key": { + "type": "select", + "default": "iris", + "options": [ + "ability.cov", + "airmiles", + "AirPassengers", + "airquality", + "anscombe", + "attenu", + "attitude", + "austres", + "BJsales", + "BOD", + "cars", + "ChickWeight", + "chickwts", + "co2", + "crimtab", + "discoveries", + "DNase", + "esoph", + "euro", + "EuStockMarkets", + "faithful", + "Formaldehyde", + "freeny", + "HairEyeColor", + "Harman23", + "Harman74", + "Indometh", + "infert", + "InsectSprays", + "iris", + "iris3", + "islands", + "JohnsonJohnson", + "LakeHuron", + "LifeCycleSavings", + "Loblolly", + "longley", + "lynx", + "morley", + "mtcars", + "nhtemp", + "Nile", + "nottem", + "npk", + "occupationalStatus", + "Orange", + "OrchardSprays", + "PlantGrowth", + "precip", + "presidents", + "pressure", + "Puromycin", + "quakes", + "randu", + "rivers", + "rock", + "Seatbelts", + "sleep", + "stackloss", + "sunspot.month", + "sunspot.year", + "sunspots", + "swiss", + "Theoph", + "Titanic", + "ToothGrowth", + "treering", + "trees", + "UCBAdmissions", + "UKDriverDeaths", + "UKgas", + "USAccDeaths", + "USArrests", + "USJudgeRatings", + "USPersonalExpenditure", + "VADeaths", + "volcano", + "warpbreaks", + "women", + "WorldPhones", + "WWWusage" + ], + "desc": null, + "functionName": "R_DATASET", + "param": "dataset_key", + "value": "DNase" + } + }, + "outputs": [ + { + "name": "default", + "id": "default", + "type": "DataFrame", + "desc": null + } + ], + "pip_dependencies": [ + { + "name": "rdatasets", + "v": "0.1.0" + } + ], + "path": "PYTHON/nodes/GENERATORS/SAMPLE_DATASETS/R_DATASET/R_DATASET.py", + "selected": false + }, + "position": { + "x": -649.3917309301298, + "y": -87.83251170127132 + }, + "selected": false, + "positionAbsolute": { + "x": -649.3917309301298, + "y": -87.83251170127132 + }, + "dragging": true + }, + { + "width": 225, + "height": 226, + "id": "MATRIX_VIEW-1e7dd8e1-ed29-4384-9b3d-f26a98ee445e", + "type": "VISUALIZERS", + "data": { + "id": "MATRIX_VIEW-1e7dd8e1-ed29-4384-9b3d-f26a98ee445e", + "label": "MATRIX VIEW", + "func": "MATRIX_VIEW", + "type": "VISUALIZERS", + "ctrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair|Matrix", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": "Visualization of the input data in matrix format" + } + ], + "path": "PYTHON/nodes/VISUALIZERS/DATA_STRUCTURE/MATRIX_VIEW/MATRIX_VIEW.py", + "selected": false + }, + "position": { + "x": 132.6017818830103, + "y": 47.683889408180164 + }, + "selected": false, + "positionAbsolute": { + "x": 132.6017818830103, + "y": 47.683889408180164 + }, + "dragging": true + }, + { + "width": 225, + "height": 226, + "id": "TABLE-1c55efb8-332b-4e75-b2b4-4c3dcc13270f", + "type": "VISUALIZERS", + "data": { + "id": "TABLE-1c55efb8-332b-4e75-b2b4-4c3dcc13270f", + "label": "TABLE", + "func": "TABLE", + "type": "VISUALIZERS", + "ctrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedTriple|OrderedPair|DataFrame|Matrix|Vector", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": null + } + ], + "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/TABLE/TABLE.py", + "selected": false + }, + "position": { + "x": -223.93703570099424, + "y": 56.329623054485296 + }, + "selected": false, + "positionAbsolute": { + "x": -223.93703570099424, + "y": 56.329623054485296 + }, + "dragging": true + }, + { + "width": 225, + "height": 226, + "id": "SURFACE3D-ed5b8670-7142-4e9f-a310-c03971aab038", + "type": "VISUALIZERS", + "data": { + "id": "SURFACE3D-ed5b8670-7142-4e9f-a310-c03971aab038", + "label": "SURFACE3D", + "func": "SURFACE3D", + "type": "VISUALIZERS", + "ctrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedTriple|DataFrame|Surface|Matrix", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": null + } + ], + "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/SURFACE3D/SURFACE3D.py", + "selected": false + }, + "position": { + "x": 25.570084175839924, + "y": -225.35029458418097 + }, + "selected": false, + "positionAbsolute": { + "x": 25.570084175839924, + "y": -225.35029458418097 + }, + "dragging": true + }, + { + "width": 160, + "height": 160, + "id": "DOUBLE_INDEFINITE_INTEGRAL-6768afa8-84dd-4177-9030-3a022299e6fc", + "type": "TRANSFORMERS", + "data": { + "id": "DOUBLE_INDEFINITE_INTEGRAL-6768afa8-84dd-4177-9030-3a022299e6fc", + "label": "DOUBLE INDEFINITE INTEGRAL", + "func": "DOUBLE_INDEFINITE_INTEGRAL", + "type": "TRANSFORMERS", + "ctrls": { + "width": { + "type": "int", + "default": 3, + "desc": "Number of columns of the 3 matrices generate by reshaping the x, y and z columns of the OrderedTriple.", + "functionName": "DOUBLE_INDEFINITE_INTEGRAL", + "param": "width", + "value": "16" + }, + "height": { + "type": "int", + "default": 3, + "desc": "Number of rows of the 3 matrices generate by reshaping the x, y and z columns of the OrderedTriple.", + "functionName": "DOUBLE_INDEFINITE_INTEGRAL", + "param": "height", + "value": "11" + } + }, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedTriple", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Matrix", + "desc": "matrix containing in each cell the volume up to that point." + } + ], + "path": "PYTHON/nodes/TRANSFORMERS/CALCULUS/DOUBLE_INDEFINITE_INTEGRAL/DOUBLE_INDEFINITE_INTEGRAL.py", + "selected": false + }, + "position": { + "x": -203.9669414896327, + "y": -154.5368353023664 + }, + "selected": false, + "positionAbsolute": { + "x": -203.9669414896327, + "y": -154.5368353023664 + }, + "dragging": true + }, + { + "width": 160, + "height": 160, + "id": "DF_2_ORDEREDTRIPLE-3b7e2e81-69c4-4437-bef4-b86bcbb5fac7", + "type": "TRANSFORMERS", + "data": { + "id": "DF_2_ORDEREDTRIPLE-3b7e2e81-69c4-4437-bef4-b86bcbb5fac7", + "label": "DF 2 ORDEREDTRIPLE", + "func": "DF_2_ORDEREDTRIPLE", + "type": "TRANSFORMERS", + "ctrls": { + "x": { + "type": "int", + "default": 0, + "desc": null, + "functionName": "DF_2_ORDEREDTRIPLE", + "param": "x", + "value": "1" + }, + "y": { + "type": "int", + "default": 1, + "desc": null, + "functionName": "DF_2_ORDEREDTRIPLE", + "param": "y", + "value": "0" + }, + "z": { + "type": "int", + "default": 2, + "desc": null, + "functionName": "DF_2_ORDEREDTRIPLE", + "param": "z", + "value": 2 + } + }, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "DataFrame", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedTriple", + "desc": null + } + ], + "path": "PYTHON/nodes/TRANSFORMERS/TYPE_CASTING/DF_2_ORDEREDTRIPLE/DF_2_ORDEREDTRIPLE.py", + "selected": false + }, + "position": { + "x": -411.4905384836551, + "y": -120.60998425014084 + }, + "selected": false, + "positionAbsolute": { + "x": -411.4905384836551, + "y": -120.60998425014084 + }, + "dragging": true + } + ], + "edges": [ + { + "source": "R_DATASET-765242a4-5a30-430b-b93f-c5028c656c47", + "sourceHandle": "default", + "target": "DF_2_ORDEREDTRIPLE-3b7e2e81-69c4-4437-bef4-b86bcbb5fac7", + "targetHandle": "default", + "id": "reactflow__edge-R_DATASET-765242a4-5a30-430b-b93f-c5028c656c47default-DF_2_ORDEREDTRIPLE-3b7e2e81-69c4-4437-bef4-b86bcbb5fac7default" + }, + { + "source": "DF_2_ORDEREDTRIPLE-3b7e2e81-69c4-4437-bef4-b86bcbb5fac7", + "sourceHandle": "default", + "target": "DOUBLE_INDEFINITE_INTEGRAL-6768afa8-84dd-4177-9030-3a022299e6fc", + "targetHandle": "default", + "id": "reactflow__edge-DF_2_ORDEREDTRIPLE-3b7e2e81-69c4-4437-bef4-b86bcbb5fac7default-DOUBLE_INDEFINITE_INTEGRAL-6768afa8-84dd-4177-9030-3a022299e6fcdefault" + }, + { + "source": "DF_2_ORDEREDTRIPLE-3b7e2e81-69c4-4437-bef4-b86bcbb5fac7", + "sourceHandle": "default", + "target": "TABLE-1c55efb8-332b-4e75-b2b4-4c3dcc13270f", + "targetHandle": "default", + "id": "reactflow__edge-DF_2_ORDEREDTRIPLE-3b7e2e81-69c4-4437-bef4-b86bcbb5fac7default-TABLE-1c55efb8-332b-4e75-b2b4-4c3dcc13270fdefault" + }, + { + "source": "DOUBLE_INDEFINITE_INTEGRAL-6768afa8-84dd-4177-9030-3a022299e6fc", + "sourceHandle": "default", + "target": "SURFACE3D-ed5b8670-7142-4e9f-a310-c03971aab038", + "targetHandle": "default", + "id": "reactflow__edge-DOUBLE_INDEFINITE_INTEGRAL-6768afa8-84dd-4177-9030-3a022299e6fcdefault-SURFACE3D-ed5b8670-7142-4e9f-a310-c03971aab038default" + }, + { + "source": "DOUBLE_INDEFINITE_INTEGRAL-6768afa8-84dd-4177-9030-3a022299e6fc", + "sourceHandle": "default", + "target": "MATRIX_VIEW-1e7dd8e1-ed29-4384-9b3d-f26a98ee445e", + "targetHandle": "default", + "id": "reactflow__edge-DOUBLE_INDEFINITE_INTEGRAL-6768afa8-84dd-4177-9030-3a022299e6fcdefault-MATRIX_VIEW-1e7dd8e1-ed29-4384-9b3d-f26a98ee445edefault" + } + ], + "viewport": { + "x": 722.5478564221319, + "y": 307.5775746454569, + "zoom": 1.204238868134965 + } + }, + "ctrlsManifest": [ + { + "type": "input", + "name": "Slider", + "id": "INPUT_PLACEHOLDER", + "hidden": false, + "minHeight": 1, + "minWidth": 2, + "layout": { + "x": 0, + "y": 0, + "h": 2, + "w": 2, + "minH": 1, + "minW": 2, + "i": "INPUT_PLACEHOLDER" + } + } + ] +} \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_INDEFINITE_INTEGRAL/examples/EX1/example.md b/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_INDEFINITE_INTEGRAL/examples/EX1/example.md new file mode 100644 index 0000000000..7bbd160127 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/CALCULUS/DOUBLE_INDEFINITE_INTEGRAL/examples/EX1/example.md @@ -0,0 +1,7 @@ +In this example we use the `R_DATASET` node with the parameter DNase, the `DF_2_ORDEREDTRIPLE` node with parameters x=1, y=0, z=2 and we also set the parameters of the `DOUBLE_INDEFINITE_INTEGRAL` node to width=16 and height=11. + +The random dataset DNase is a good set for this example since it's columns (as an OrderedTriple) have length 176 which is 16 times 11 and we can see in the table of this OrderedTriple that we have the same 16 x values used on each 11 different y values. Then we decide for the width to be 16 and the height to be 11 reshape the matrices. + +Then the `DOUBLE_INDEFINITE_INTEGRAL` node will reshape the 3 columns in matrices and use them to output a matrix of the same dimension then the 3 reshape matrices. In this matrix we have computes in each cell the volume up to that given point. + +We can observe it here in the `SURFACE3D` node that indeed the volume goes higher and higher as the x and y values increase which is as expected since in the initial table of values for x, y and z we could see that they are also increasing. We can also see it with the values of the `MATRIX_VIEW` node which are also increasing as they go further. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/CALCULUS/INTEGRATE/a1-[autogen]/python_code.txt b/docs/nodes/TRANSFORMERS/CALCULUS/INTEGRATE/a1-[autogen]/python_code.txt index 5efc78232d..beb9cd7ae3 100644 --- a/docs/nodes/TRANSFORMERS/CALCULUS/INTEGRATE/a1-[autogen]/python_code.txt +++ b/docs/nodes/TRANSFORMERS/CALCULUS/INTEGRATE/a1-[autogen]/python_code.txt @@ -1,8 +1,8 @@ -from flojoy import flojoy, OrderedPair +from flojoy import flojoy, OrderedPair, Vector import numpy as np -def trapz(x, y): +def trapz(x: np.ndarray, y: np.ndarray): m = [0] * len(x) trapezium = (1 / 2) * (x[1] - x[0]) * (y[1] + y[0]) m[1] = trapezium @@ -15,17 +15,24 @@ def trapz(x, y): @flojoy -def INTEGRATE(default: OrderedPair) -> OrderedPair: +def INTEGRATE(default: OrderedPair | Vector) -> OrderedPair: - input_x = default.x - input_y = default.y + match default: + case OrderedPair(): + input_x = default.x + input_y = default.y + case Vector(): + input_x = np.arange(len(default.v)) + input_y = default.v if type(input_x) != np.ndarray: raise ValueError(f"Invalid type for x:{type(input_x)}") elif type(input_y) != np.ndarray: raise ValueError(f"Invalid type for y:{type(input_y)}") elif len(input_x) != len(input_y): - raise ValueError(f"Invalid inputs, x:{input_x} y:{input_y}") + raise ValueError( + f"X and Y keys must have the same length got, x:{len(input_x)} y:{len(input_y)}" + ) integrate = trapz(input_x, input_y) diff --git a/docs/nodes/TRANSFORMERS/CALCULUS/INTEGRATE/examples/EX1/app.txt b/docs/nodes/TRANSFORMERS/CALCULUS/INTEGRATE/examples/EX1/app.txt index 588ca8b17f..b7a8abceca 100644 --- a/docs/nodes/TRANSFORMERS/CALCULUS/INTEGRATE/examples/EX1/app.txt +++ b/docs/nodes/TRANSFORMERS/CALCULUS/INTEGRATE/examples/EX1/app.txt @@ -38,7 +38,7 @@ { "name": "default", "id": "default", - "type": "OrderedPair" + "type": "Vector" } ], "path": "PYTHON/nodes/GENERATORS/SIMULATIONS/LINSPACE/LINSPACE.py", @@ -59,18 +59,18 @@ "width": 225, "height": 226, "id": "LINE-cd291686-3929-4601-bb11-65d38032b31f", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-cd291686-3929-4601-bb11-65d38032b31f", "label": "LINE", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", - "type": "OrderedPair|DataFrame|Matrix", + "type": "OrderedPair|DataFrame|Matrix|Vector", "multiple": false } ], @@ -99,18 +99,18 @@ "width": 225, "height": 226, "id": "LINE-cc98b9c2-cfce-4698-810a-feeebc123bda", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-cc98b9c2-cfce-4698-810a-feeebc123bda", "label": "LINE 1", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", - "type": "OrderedPair|DataFrame|Matrix", + "type": "OrderedPair|DataFrame|Matrix|Vector", "multiple": false } ], @@ -139,18 +139,18 @@ "width": 150, "height": 150, "id": "INTEGRATE-4e2112c5-6291-4685-aca8-1cc763f7a330", - "type": "CALCULUS", + "type": "TRANSFORMERS", "data": { "id": "INTEGRATE-4e2112c5-6291-4685-aca8-1cc763f7a330", "label": "INTEGRATE", "func": "INTEGRATE", - "type": "CALCULUS", + "type": "TRANSFORMERS", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", - "type": "OrderedPair", + "type": "OrderedPair|Vector", "multiple": false } ], @@ -174,39 +174,6 @@ "y": 175.4343276959062 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-99c73f89-dcf9-4a42-ac4d-2d61724b5ac8", - "type": "TERMINATORS", - "data": { - "id": "END-99c73f89-dcf9-4a42-ac4d-2d61724b5ac8", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 1048.3660641814356, - "y": 312.43076479307507 - }, - "selected": false, - "positionAbsolute": { - "x": 1048.3660641814356, - "y": 312.43076479307507 - }, - "dragging": true } ], "edges": [ @@ -224,20 +191,6 @@ "targetHandle": "default", "id": "reactflow__edge-INTEGRATE-4e2112c5-6291-4685-aca8-1cc763f7a330default-LINE-cd291686-3929-4601-bb11-65d38032b31fdefault" }, - { - "source": "LINE-cd291686-3929-4601-bb11-65d38032b31f", - "sourceHandle": "default", - "target": "END-99c73f89-dcf9-4a42-ac4d-2d61724b5ac8", - "targetHandle": "default", - "id": "reactflow__edge-LINE-cd291686-3929-4601-bb11-65d38032b31fdefault-END-99c73f89-dcf9-4a42-ac4d-2d61724b5ac8default" - }, - { - "source": "LINE-cc98b9c2-cfce-4698-810a-feeebc123bda", - "sourceHandle": "default", - "target": "END-99c73f89-dcf9-4a42-ac4d-2d61724b5ac8", - "targetHandle": "default", - "id": "reactflow__edge-LINE-cc98b9c2-cfce-4698-810a-feeebc123bdadefault-END-99c73f89-dcf9-4a42-ac4d-2d61724b5ac8default" - }, { "source": "LINSPACE-513ce5a5-8ad9-47cf-b0bb-aa8ac2b8ca3e", "sourceHandle": "default", @@ -271,4 +224,4 @@ } } ] -} \ No newline at end of file +} diff --git a/docs/nodes/TRANSFORMERS/IMAGE_PROCESSING/EDGE_DETECTION/examples/EX1/app.txt b/docs/nodes/TRANSFORMERS/IMAGE_PROCESSING/EDGE_DETECTION/examples/EX1/app.txt index 2463941f02..9733399779 100644 --- a/docs/nodes/TRANSFORMERS/IMAGE_PROCESSING/EDGE_DETECTION/examples/EX1/app.txt +++ b/docs/nodes/TRANSFORMERS/IMAGE_PROCESSING/EDGE_DETECTION/examples/EX1/app.txt @@ -1,56 +1,23 @@ { "rfInstance": { "nodes": [ - { - "width": 210, - "height": 130, - "id": "END-c6aafeb2-8a19-461d-bb71-83b8f8b7fc80", - "type": "TERMINATORS", - "data": { - "id": "END-c6aafeb2-8a19-461d-bb71-83b8f8b7fc80", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": true - }, - "position": { - "x": 1280.0865928617056, - "y": 638.2033147738593 - }, - "selected": true, - "positionAbsolute": { - "x": 1280.0865928617056, - "y": 638.2033147738593 - }, - "dragging": true - }, { "width": 150, "height": 150, "id": "LOCAL_FILE-745d91c9-0bcf-4ab4-a265-210f2506f20c", - "type": "LOCAL_FILE_SYSTEM", + "type": "LOADERS", "data": { "id": "LOCAL_FILE-745d91c9-0bcf-4ab4-a265-210f2506f20c", "label": "LOCAL FILE", "func": "LOCAL_FILE", - "type": "LOCAL_FILE_SYSTEM", + "type": "LOADERS", "ctrls": { "file_path": { "type": "str", "default": null, "functionName": "LOCAL_FILE", "param": "file_path", - "value": "/Users/jinwonlee/Desktop/test.png" + "value": "" }, "file_type": { "type": "select", @@ -102,12 +69,12 @@ "width": 150, "height": 150, "id": "EDGE_DETECTION-1f01cece-bbff-47d7-b217-5b311f88d9ba", - "type": "IMAGE_PROCESSING", + "type": "TRANSFORMERS", "data": { "id": "EDGE_DETECTION-1f01cece-bbff-47d7-b217-5b311f88d9ba", "label": "EDGE DETECTION", "func": "EDGE_DETECTION", - "type": "IMAGE_PROCESSING", + "type": "TRANSFORMERS", "ctrls": {}, "inputs": [ { @@ -142,12 +109,12 @@ "width": 225, "height": 226, "id": "IMAGE-285335dd-85c9-48b9-88f6-2a3dd5680804", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "IMAGE-285335dd-85c9-48b9-88f6-2a3dd5680804", "label": "IMAGE", "func": "IMAGE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -182,12 +149,12 @@ "width": 225, "height": 226, "id": "IMAGE-6cd5c97a-781e-4c8f-a926-e7d295cfa402", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "IMAGE-6cd5c97a-781e-4c8f-a926-e7d295cfa402", "label": "IMAGE 1", "func": "IMAGE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -234,26 +201,12 @@ "targetHandle": "default", "id": "reactflow__edge-EDGE_DETECTION-1f01cece-bbff-47d7-b217-5b311f88d9badefault-IMAGE-285335dd-85c9-48b9-88f6-2a3dd5680804default" }, - { - "source": "IMAGE-285335dd-85c9-48b9-88f6-2a3dd5680804", - "sourceHandle": "default", - "target": "END-c6aafeb2-8a19-461d-bb71-83b8f8b7fc80", - "targetHandle": "default", - "id": "reactflow__edge-IMAGE-285335dd-85c9-48b9-88f6-2a3dd5680804default-END-c6aafeb2-8a19-461d-bb71-83b8f8b7fc80default" - }, { "source": "LOCAL_FILE-745d91c9-0bcf-4ab4-a265-210f2506f20c", "sourceHandle": "default", "target": "IMAGE-6cd5c97a-781e-4c8f-a926-e7d295cfa402", "targetHandle": "default", "id": "reactflow__edge-LOCAL_FILE-745d91c9-0bcf-4ab4-a265-210f2506f20cdefault-IMAGE-6cd5c97a-781e-4c8f-a926-e7d295cfa402default" - }, - { - "source": "IMAGE-6cd5c97a-781e-4c8f-a926-e7d295cfa402", - "sourceHandle": "default", - "target": "END-c6aafeb2-8a19-461d-bb71-83b8f8b7fc80", - "targetHandle": "default", - "id": "reactflow__edge-IMAGE-6cd5c97a-781e-4c8f-a926-e7d295cfa402default-END-c6aafeb2-8a19-461d-bb71-83b8f8b7fc80default" } ], "viewport": { @@ -281,4 +234,4 @@ } } ] -} \ No newline at end of file +} diff --git a/docs/nodes/TRANSFORMERS/IMAGE_PROCESSING/EDGE_DETECTION/examples/EX1/example.md b/docs/nodes/TRANSFORMERS/IMAGE_PROCESSING/EDGE_DETECTION/examples/EX1/example.md index 3fed86f232..c1ea759010 100644 --- a/docs/nodes/TRANSFORMERS/IMAGE_PROCESSING/EDGE_DETECTION/examples/EX1/example.md +++ b/docs/nodes/TRANSFORMERS/IMAGE_PROCESSING/EDGE_DETECTION/examples/EX1/example.md @@ -1 +1 @@ -ITS AN EDGE DETECTION APP WHICH USES AN EDGE DETECTION FILTER NODE TO DETECT EDGES ON AN IMAGE. \ No newline at end of file +It's an edge detection app which uses an edge detection filter node to detect edges on an image. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/IMAGE_PROCESSING/IMAGE_SMOOTHING/a1-[autogen]/python_code.txt b/docs/nodes/TRANSFORMERS/IMAGE_PROCESSING/IMAGE_SMOOTHING/a1-[autogen]/python_code.txt index 9fcad5af61..f3ef5fe7cf 100644 --- a/docs/nodes/TRANSFORMERS/IMAGE_PROCESSING/IMAGE_SMOOTHING/a1-[autogen]/python_code.txt +++ b/docs/nodes/TRANSFORMERS/IMAGE_PROCESSING/IMAGE_SMOOTHING/a1-[autogen]/python_code.txt @@ -26,8 +26,10 @@ def IMAGE_SMOOTHING( case "average": image = cv2.blur(rgba_image, (kernel, kernel)) case "gaussian": + assert kernel & 1, "Kernel must be odd for 'gaussian' smoothing." image = cv2.GaussianBlur(rgba_image, (kernel, kernel), 0) case "median": + assert kernel & 1, "Kernel must be odd for 'median' smoothing." image = cv2.medianBlur(rgba_image, kernel) case "bilateral": rgba_image = cv2.cvtColor(rgba_image, cv2.COLOR_BGRA2BGR) diff --git a/docs/nodes/TRANSFORMERS/IMAGE_PROCESSING/IMAGE_SMOOTHING/examples/EX1/app.txt b/docs/nodes/TRANSFORMERS/IMAGE_PROCESSING/IMAGE_SMOOTHING/examples/EX1/app.txt index 82137f56f9..5f5b2b3085 100644 --- a/docs/nodes/TRANSFORMERS/IMAGE_PROCESSING/IMAGE_SMOOTHING/examples/EX1/app.txt +++ b/docs/nodes/TRANSFORMERS/IMAGE_PROCESSING/IMAGE_SMOOTHING/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 150, "height": 150, "id": "IMAGE_SMOOTHING-271ab3fc-7780-4b0d-a394-9d6935b20736", - "type": "IMAGE_PROCESSING", + "type": "TRANSFORMERS", "data": { "id": "IMAGE_SMOOTHING-271ab3fc-7780-4b0d-a394-9d6935b20736", "label": "IMAGE SMOOTHING", "func": "IMAGE_SMOOTHING", - "type": "IMAGE_PROCESSING", + "type": "TRANSFORMERS", "ctrls": { "kernel": { "type": "int", @@ -49,13 +49,13 @@ } ], "path": "PYTHON/nodes/TRANSFORMERS/IMAGE_PROCESSING/IMAGE_SMOOTHING/IMAGE_SMOOTHING.py", - "selected": true + "selected": false }, "position": { "x": 727.3487305553774, "y": 155.3525852303302 }, - "selected": true, + "selected": false, "positionAbsolute": { "x": 727.3487305553774, "y": 155.3525852303302 @@ -66,19 +66,19 @@ "width": 150, "height": 150, "id": "LOCAL_FILE-e185ad0f-12d9-47ee-ab02-28b06f85f497", - "type": "LOCAL_FILE_SYSTEM", + "type": "LOADERS", "data": { "id": "LOCAL_FILE-e185ad0f-12d9-47ee-ab02-28b06f85f497", "label": "LOCAL FILE", "func": "LOCAL_FILE", - "type": "LOCAL_FILE_SYSTEM", + "type": "LOADERS", "ctrls": { "file_path": { "type": "str", "default": null, "functionName": "LOCAL_FILE", "param": "file_path", - "value": "/Users/jinwonlee/Desktop/test.png" + "value": "" }, "file_type": { "type": "select", @@ -126,49 +126,16 @@ }, "dragging": true }, - { - "width": 210, - "height": 130, - "id": "END-3ed99c64-452e-4a7b-a439-3aab3140483a", - "type": "TERMINATORS", - "data": { - "id": "END-3ed99c64-452e-4a7b-a439-3aab3140483a", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 1285.440862145957, - "y": 550.5450019826343 - }, - "selected": false, - "positionAbsolute": { - "x": 1285.440862145957, - "y": 550.5450019826343 - }, - "dragging": true - }, { "width": 225, "height": 226, "id": "IMAGE-7aacbaca-2652-4c99-babe-5779ba0ce181", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "IMAGE-7aacbaca-2652-4c99-babe-5779ba0ce181", "label": "IMAGE", "func": "IMAGE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -203,12 +170,12 @@ "width": 225, "height": 226, "id": "IMAGE-0b7bb803-8dba-43eb-a9bf-4073b3fda94c", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "IMAGE-0b7bb803-8dba-43eb-a9bf-4073b3fda94c", "label": "IMAGE 1", "func": "IMAGE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -255,26 +222,12 @@ "targetHandle": "default", "id": "reactflow__edge-IMAGE_SMOOTHING-271ab3fc-7780-4b0d-a394-9d6935b20736default-IMAGE-7aacbaca-2652-4c99-babe-5779ba0ce181default" }, - { - "source": "IMAGE-7aacbaca-2652-4c99-babe-5779ba0ce181", - "sourceHandle": "default", - "target": "END-3ed99c64-452e-4a7b-a439-3aab3140483a", - "targetHandle": "default", - "id": "reactflow__edge-IMAGE-7aacbaca-2652-4c99-babe-5779ba0ce181default-END-3ed99c64-452e-4a7b-a439-3aab3140483adefault" - }, { "source": "LOCAL_FILE-e185ad0f-12d9-47ee-ab02-28b06f85f497", "sourceHandle": "default", "target": "IMAGE-0b7bb803-8dba-43eb-a9bf-4073b3fda94c", "targetHandle": "default", "id": "reactflow__edge-LOCAL_FILE-e185ad0f-12d9-47ee-ab02-28b06f85f497default-IMAGE-0b7bb803-8dba-43eb-a9bf-4073b3fda94cdefault" - }, - { - "source": "IMAGE-0b7bb803-8dba-43eb-a9bf-4073b3fda94c", - "sourceHandle": "default", - "target": "END-3ed99c64-452e-4a7b-a439-3aab3140483a", - "targetHandle": "default", - "id": "reactflow__edge-IMAGE-0b7bb803-8dba-43eb-a9bf-4073b3fda94cdefault-END-3ed99c64-452e-4a7b-a439-3aab3140483adefault" } ], "viewport": { @@ -302,4 +255,4 @@ } } ] -} \ No newline at end of file +} diff --git a/docs/nodes/TRANSFORMERS/MATRIX_MANIPULATION/INVERT/examples/EX1/app.txt b/docs/nodes/TRANSFORMERS/MATRIX_MANIPULATION/INVERT/examples/EX1/app.txt index cc1258e83d..05068d9ee1 100644 --- a/docs/nodes/TRANSFORMERS/MATRIX_MANIPULATION/INVERT/examples/EX1/app.txt +++ b/docs/nodes/TRANSFORMERS/MATRIX_MANIPULATION/INVERT/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 130, "height": 130, "id": "MATRIX-6406eff9-325a-4857-856c-3815dc85b99f", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "MATRIX-6406eff9-325a-4857-856c-3815dc85b99f", "label": "MATRIX", "func": "MATRIX", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "row": { "type": "int", @@ -52,12 +52,12 @@ "width": 225, "height": 226, "id": "MATRIX_VIEW-2dd75395-9aa9-49c3-94a7-8e1376a6922c", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "MATRIX_VIEW-2dd75395-9aa9-49c3-94a7-8e1376a6922c", "label": "MATRIX VIEW", "func": "MATRIX_VIEW", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -92,12 +92,12 @@ "width": 150, "height": 150, "id": "INVERT-bc37a258-fb80-4bc9-a205-2cd02345375c", - "type": "MATRIX_MANIPULATION", + "type": "TRANSFORMERS", "data": { "id": "INVERT-bc37a258-fb80-4bc9-a205-2cd02345375c", "label": "INVERT", "func": "INVERT", - "type": "MATRIX_MANIPULATION", + "type": "TRANSFORMERS", "ctrls": { "rcond": { "type": "float", @@ -140,12 +140,12 @@ "width": 225, "height": 226, "id": "MATRIX_VIEW-e0662088-8688-4898-9967-b09f5194a447", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "MATRIX_VIEW-e0662088-8688-4898-9967-b09f5194a447", "label": "MATRIX VIEW 1", "func": "MATRIX_VIEW", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -176,49 +176,16 @@ }, "dragging": true }, - { - "width": 210, - "height": 130, - "id": "END-e1e5850d-0cee-49eb-b3b4-f06010058a3b", - "type": "TERMINATORS", - "data": { - "id": "END-e1e5850d-0cee-49eb-b3b4-f06010058a3b", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": true - }, - "position": { - "x": 1588.2358217622398, - "y": 402.8520198918377 - }, - "selected": true, - "positionAbsolute": { - "x": 1588.2358217622398, - "y": 402.8520198918377 - }, - "dragging": true - }, { "width": 150, "height": 150, "id": "MATMUL-f2b3e25b-f613-4454-b941-cc8e93496770", - "type": "MATRIX_MANIPULATION", + "type": "TRANSFORMERS", "data": { "id": "MATMUL-f2b3e25b-f613-4454-b941-cc8e93496770", "label": "MATMUL", "func": "MATMUL", - "type": "MATRIX_MANIPULATION", + "type": "TRANSFORMERS", "ctrls": {}, "inputs": [ { @@ -259,12 +226,12 @@ "width": 225, "height": 226, "id": "MATRIX_VIEW-3fa65156-275b-46b1-a831-386267350ee7", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "MATRIX_VIEW-3fa65156-275b-46b1-a831-386267350ee7", "label": "MATRIX VIEW 2", "func": "MATRIX_VIEW", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -318,20 +285,6 @@ "targetHandle": "default", "id": "reactflow__edge-INVERT-bc37a258-fb80-4bc9-a205-2cd02345375cdefault-MATRIX_VIEW-e0662088-8688-4898-9967-b09f5194a447default" }, - { - "source": "MATRIX_VIEW-e0662088-8688-4898-9967-b09f5194a447", - "sourceHandle": "default", - "target": "END-e1e5850d-0cee-49eb-b3b4-f06010058a3b", - "targetHandle": "default", - "id": "reactflow__edge-MATRIX_VIEW-e0662088-8688-4898-9967-b09f5194a447default-END-e1e5850d-0cee-49eb-b3b4-f06010058a3bdefault" - }, - { - "source": "MATRIX_VIEW-2dd75395-9aa9-49c3-94a7-8e1376a6922c", - "sourceHandle": "default", - "target": "END-e1e5850d-0cee-49eb-b3b4-f06010058a3b", - "targetHandle": "default", - "id": "reactflow__edge-MATRIX_VIEW-2dd75395-9aa9-49c3-94a7-8e1376a6922cdefault-END-e1e5850d-0cee-49eb-b3b4-f06010058a3bdefault" - }, { "source": "MATRIX-6406eff9-325a-4857-856c-3815dc85b99f", "sourceHandle": "default", @@ -352,13 +305,6 @@ "target": "MATRIX_VIEW-3fa65156-275b-46b1-a831-386267350ee7", "targetHandle": "default", "id": "reactflow__edge-MATMUL-f2b3e25b-f613-4454-b941-cc8e93496770default-MATRIX_VIEW-3fa65156-275b-46b1-a831-386267350ee7default" - }, - { - "source": "MATRIX_VIEW-3fa65156-275b-46b1-a831-386267350ee7", - "sourceHandle": "default", - "target": "END-e1e5850d-0cee-49eb-b3b4-f06010058a3b", - "targetHandle": "default", - "id": "reactflow__edge-MATRIX_VIEW-3fa65156-275b-46b1-a831-386267350ee7default-END-e1e5850d-0cee-49eb-b3b4-f06010058a3bdefault" } ], "viewport": { diff --git a/docs/nodes/TRANSFORMERS/MATRIX_MANIPULATION/MATMUL/examples/EX1/app.txt b/docs/nodes/TRANSFORMERS/MATRIX_MANIPULATION/MATMUL/examples/EX1/app.txt index 3d81b936a1..f3e6c5deb7 100644 --- a/docs/nodes/TRANSFORMERS/MATRIX_MANIPULATION/MATMUL/examples/EX1/app.txt +++ b/docs/nodes/TRANSFORMERS/MATRIX_MANIPULATION/MATMUL/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 130, "height": 130, "id": "MATRIX-633000ac-6a8c-4597-a77f-a5b009c84dbe", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "MATRIX-633000ac-6a8c-4597-a77f-a5b009c84dbe", "label": "MATRIX", "func": "MATRIX", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "row": { "type": "int", @@ -52,12 +52,12 @@ "width": 130, "height": 130, "id": "MATRIX-c0889eba-3ebb-4218-ac0e-65bda9c17c66", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "MATRIX-c0889eba-3ebb-4218-ac0e-65bda9c17c66", "label": "MATRIX 1", "func": "MATRIX", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "row": { "type": "int", @@ -82,13 +82,13 @@ } ], "path": "PYTHON/nodes/GENERATORS/SIMULATIONS/MATRIX/MATRIX.py", - "selected": true + "selected": false }, "position": { "x": 236.02277015172265, "y": 579.6972875067837 }, - "selected": true, + "selected": false, "positionAbsolute": { "x": 236.02277015172265, "y": 579.6972875067837 @@ -99,12 +99,12 @@ "width": 150, "height": 150, "id": "MATMUL-38d30041-5f6f-4bb6-b50b-3bbddc32d60a", - "type": "MATRIX_MANIPULATION", + "type": "TRANSFORMERS", "data": { "id": "MATMUL-38d30041-5f6f-4bb6-b50b-3bbddc32d60a", "label": "MATMUL", "func": "MATMUL", - "type": "MATRIX_MANIPULATION", + "type": "TRANSFORMERS", "ctrls": {}, "inputs": [ { @@ -145,12 +145,12 @@ "width": 225, "height": 226, "id": "MATRIX_VIEW-4839a447-fd78-4c23-87c9-de5259c26472", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "MATRIX_VIEW-4839a447-fd78-4c23-87c9-de5259c26472", "label": "MATRIX VIEW 2", "func": "MATRIX_VIEW", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -181,49 +181,16 @@ }, "dragging": true }, - { - "width": 210, - "height": 130, - "id": "END-d1c65d5f-6e88-4910-8052-aa688ee7f56c", - "type": "TERMINATORS", - "data": { - "id": "END-d1c65d5f-6e88-4910-8052-aa688ee7f56c", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 1532.6747052039093, - "y": 499.7207009792231 - }, - "selected": false, - "positionAbsolute": { - "x": 1532.6747052039093, - "y": 499.7207009792231 - }, - "dragging": true - }, { "width": 225, "height": 226, "id": "MATRIX_VIEW-b76ba08c-ba34-481c-bd26-74db60851d49", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "MATRIX_VIEW-b76ba08c-ba34-481c-bd26-74db60851d49", "label": "MATRIX VIEW 1", "func": "MATRIX_VIEW", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -258,12 +225,12 @@ "width": 225, "height": 226, "id": "MATRIX_VIEW-fa80c51a-9545-4e71-9122-62d441c6698d", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "MATRIX_VIEW-fa80c51a-9545-4e71-9122-62d441c6698d", "label": "MATRIX VIEW 2", "func": "MATRIX_VIEW", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -317,13 +284,6 @@ "targetHandle": "default", "id": "reactflow__edge-MATMUL-38d30041-5f6f-4bb6-b50b-3bbddc32d60adefault-MATRIX_VIEW-4839a447-fd78-4c23-87c9-de5259c26472default" }, - { - "source": "MATRIX_VIEW-4839a447-fd78-4c23-87c9-de5259c26472", - "sourceHandle": "default", - "target": "END-d1c65d5f-6e88-4910-8052-aa688ee7f56c", - "targetHandle": "default", - "id": "reactflow__edge-MATRIX_VIEW-4839a447-fd78-4c23-87c9-de5259c26472default-END-d1c65d5f-6e88-4910-8052-aa688ee7f56cdefault" - }, { "source": "MATRIX-633000ac-6a8c-4597-a77f-a5b009c84dbe", "sourceHandle": "default", @@ -337,20 +297,6 @@ "target": "MATRIX_VIEW-b76ba08c-ba34-481c-bd26-74db60851d49", "targetHandle": "default", "id": "reactflow__edge-MATRIX-c0889eba-3ebb-4218-ac0e-65bda9c17c66default-MATRIX_VIEW-b76ba08c-ba34-481c-bd26-74db60851d49default" - }, - { - "source": "MATRIX_VIEW-fa80c51a-9545-4e71-9122-62d441c6698d", - "sourceHandle": "default", - "target": "END-d1c65d5f-6e88-4910-8052-aa688ee7f56c", - "targetHandle": "default", - "id": "reactflow__edge-MATRIX_VIEW-fa80c51a-9545-4e71-9122-62d441c6698ddefault-END-d1c65d5f-6e88-4910-8052-aa688ee7f56cdefault" - }, - { - "source": "MATRIX_VIEW-b76ba08c-ba34-481c-bd26-74db60851d49", - "sourceHandle": "default", - "target": "END-d1c65d5f-6e88-4910-8052-aa688ee7f56c", - "targetHandle": "default", - "id": "reactflow__edge-MATRIX_VIEW-b76ba08c-ba34-481c-bd26-74db60851d49default-END-d1c65d5f-6e88-4910-8052-aa688ee7f56cdefault" } ], "viewport": { diff --git a/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/BUTTER/examples/EX1/app.txt b/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/BUTTER/examples/EX1/app.txt index 90defb288d..5ef0b79aed 100644 --- a/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/BUTTER/examples/EX1/app.txt +++ b/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/BUTTER/examples/EX1/app.txt @@ -93,12 +93,12 @@ "width": 150, "height": 150, "id": "FFT-e97ea8b8-ce90-4c6a-aa27-ee0e5f82c9bf", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "data": { "id": "FFT-e97ea8b8-ce90-4c6a-aa27-ee0e5f82c9bf", "label": "FFT", "func": "FFT", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "ctrls": { "window": { "type": "select", @@ -164,13 +164,13 @@ } ], "path": "PYTHON/nodes/TRANSFORMERS/SIGNAL_PROCESSING/FFT/FFT.py", - "selected": true + "selected": false }, "position": { "x": 719.0985280702616, "y": 254.0429925314706 }, - "selected": true, + "selected": false, "positionAbsolute": { "x": 719.0985280702616, "y": 254.0429925314706 @@ -181,12 +181,12 @@ "width": 150, "height": 150, "id": "BUTTER-b2ffdf87-8ec3-42d1-973d-56d705301470", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "data": { "id": "BUTTER-b2ffdf87-8ec3-42d1-973d-56d705301470", "label": "BUTTER", "func": "BUTTER", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "ctrls": { "filter_order": { "type": "int", @@ -256,12 +256,12 @@ "width": 150, "height": 150, "id": "FFT-da75bb73-a829-499f-a419-50ee2aeed4dd", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "data": { "id": "FFT-da75bb73-a829-499f-a419-50ee2aeed4dd", "label": "FFT 1", "func": "FFT", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "ctrls": { "window": { "type": "select", @@ -344,12 +344,12 @@ "width": 380, "height": 293, "id": "LINE-c662104c-36e6-4b54-8f5f-ff7588218c5b", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-c662104c-36e6-4b54-8f5f-ff7588218c5b", "label": "LINE", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -384,12 +384,12 @@ "width": 380, "height": 293, "id": "LINE-1615d876-d703-4009-970b-a157b5d7af5f", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-1615d876-d703-4009-970b-a157b5d7af5f", "label": "LINE 1", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -419,39 +419,6 @@ "y": 473.9320198431452 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-34d1da0e-0f17-4392-9603-a4a3211540b4", - "type": "TERMINATORS", - "data": { - "id": "END-34d1da0e-0f17-4392-9603-a4a3211540b4", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 2031.958028669431, - "y": 286.88394679022656 - }, - "selected": false, - "positionAbsolute": { - "x": 2031.958028669431, - "y": 286.88394679022656 - }, - "dragging": true } ], "edges": [ @@ -489,20 +456,6 @@ "target": "LINE-1615d876-d703-4009-970b-a157b5d7af5f", "targetHandle": "default", "id": "reactflow__edge-FFT-da75bb73-a829-499f-a419-50ee2aeed4dddefault-LINE-1615d876-d703-4009-970b-a157b5d7af5fdefault" - }, - { - "source": "LINE-c662104c-36e6-4b54-8f5f-ff7588218c5b", - "sourceHandle": "default", - "target": "END-34d1da0e-0f17-4392-9603-a4a3211540b4", - "targetHandle": "default", - "id": "reactflow__edge-LINE-c662104c-36e6-4b54-8f5f-ff7588218c5bdefault-END-34d1da0e-0f17-4392-9603-a4a3211540b4default" - }, - { - "source": "LINE-1615d876-d703-4009-970b-a157b5d7af5f", - "sourceHandle": "default", - "target": "END-34d1da0e-0f17-4392-9603-a4a3211540b4", - "targetHandle": "default", - "id": "reactflow__edge-LINE-1615d876-d703-4009-970b-a157b5d7af5fdefault-END-34d1da0e-0f17-4392-9603-a4a3211540b4default" } ], "viewport": { diff --git a/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/FFT/a1-[autogen]/python_code.txt b/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/FFT/a1-[autogen]/python_code.txt index 9b6e92dbfd..5f5e19dddb 100644 --- a/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/FFT/a1-[autogen]/python_code.txt +++ b/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/FFT/a1-[autogen]/python_code.txt @@ -9,6 +9,7 @@ from pandas import DataFrame as df def FFT( default: OrderedPair, window: Literal[ + "none", "boxcar", "triang", "blackman", diff --git a/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/FFT/examples/EX1/app.txt b/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/FFT/examples/EX1/app.txt index c145fad436..ed2a727dda 100644 --- a/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/FFT/examples/EX1/app.txt +++ b/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/FFT/examples/EX1/app.txt @@ -59,12 +59,12 @@ "width": 130, "height": 130, "id": "SINE-684e15cc-d2f7-4d09-83a2-fdddd6cefd2f", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "SINE-684e15cc-d2f7-4d09-83a2-fdddd6cefd2f", "label": "SINE", "func": "SINE", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "amplitude": { "type": "float", @@ -141,12 +141,12 @@ "width": 130, "height": 130, "id": "SINE-15e699fe-e9e0-452d-9206-8313c657c051", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "SINE-15e699fe-e9e0-452d-9206-8313c657c051", "label": "SINE 1", "func": "SINE", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "amplitude": { "type": "float", @@ -269,12 +269,12 @@ "width": 150, "height": 150, "id": "FFT-ae307ae3-517d-4103-a787-02fe288d2e97", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "data": { "id": "FFT-ae307ae3-517d-4103-a787-02fe288d2e97", "label": "FFT", "func": "FFT", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "ctrls": { "window": { "type": "select", @@ -357,12 +357,12 @@ "width": 380, "height": 293, "id": "LINE-2bb3fc2d-9616-4d6f-957d-b3321530afa0", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-2bb3fc2d-9616-4d6f-957d-b3321530afa0", "label": "LINE", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -392,39 +392,6 @@ "y": 297.1407554549438 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-77220101-3068-486e-986b-e7b1f0a2bf68", - "type": "TERMINATORS", - "data": { - "id": "END-77220101-3068-486e-986b-e7b1f0a2bf68", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 1960.3692537016036, - "y": 343.02346241971634 - }, - "selected": false, - "positionAbsolute": { - "x": 1960.3692537016036, - "y": 343.02346241971634 - }, - "dragging": true } ], "edges": [ @@ -469,13 +436,6 @@ "target": "LINE-2bb3fc2d-9616-4d6f-957d-b3321530afa0", "targetHandle": "default", "id": "reactflow__edge-FFT-ae307ae3-517d-4103-a787-02fe288d2e97default-LINE-2bb3fc2d-9616-4d6f-957d-b3321530afa0default" - }, - { - "source": "LINE-2bb3fc2d-9616-4d6f-957d-b3321530afa0", - "sourceHandle": "default", - "target": "END-77220101-3068-486e-986b-e7b1f0a2bf68", - "targetHandle": "default", - "id": "reactflow__edge-LINE-2bb3fc2d-9616-4d6f-957d-b3321530afa0default-END-77220101-3068-486e-986b-e7b1f0a2bf68default" } ], "viewport": { diff --git a/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/FIR/examples/EX1/app.txt b/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/FIR/examples/EX1/app.txt index e05046f3e3..b78a7cb215 100644 --- a/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/FIR/examples/EX1/app.txt +++ b/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/FIR/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 150, "height": 150, "id": "FIR-e4741c3f-334d-4e53-8a1a-db5549123ee0", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "data": { "id": "FIR-e4741c3f-334d-4e53-8a1a-db5549123ee0", "label": "FIR", "func": "FIR", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "ctrls": { "sample_rate": { "type": "int", @@ -595,49 +595,16 @@ }, "dragging": true }, - { - "width": 210, - "height": 130, - "id": "END-9335c6e8-cab9-4475-846a-1466085dfa16", - "type": "TERMINATORS", - "data": { - "id": "END-9335c6e8-cab9-4475-846a-1466085dfa16", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 3033.4264297751756, - "y": 390.3687522788513 - }, - "selected": false, - "positionAbsolute": { - "x": 3033.4264297751756, - "y": 390.3687522788513 - }, - "dragging": true - }, { "width": 150, "height": 150, "id": "FFT-1ee5f7c7-d72f-4d75-9804-ea9f6201edf2", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "data": { "id": "FFT-1ee5f7c7-d72f-4d75-9804-ea9f6201edf2", "label": "FFT 1", "func": "FFT", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "ctrls": { "window": { "type": "select", @@ -720,12 +687,12 @@ "width": 150, "height": 150, "id": "FFT-a220559c-365a-4562-aee4-10461c688970", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "data": { "id": "FFT-a220559c-365a-4562-aee4-10461c688970", "label": "FFT 2", "func": "FFT", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "ctrls": { "window": { "type": "select", @@ -808,12 +775,12 @@ "width": 380, "height": 293, "id": "LINE-26ea5c67-c2cc-4329-8e31-67da38886cfa", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-26ea5c67-c2cc-4329-8e31-67da38886cfa", "label": "LINE 1", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -848,12 +815,12 @@ "width": 380, "height": 293, "id": "LINE-c3f1781a-b6e6-4657-9898-c88b3432f0f3", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-c3f1781a-b6e6-4657-9898-c88b3432f0f3", "label": "LINE 2", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -888,12 +855,12 @@ "width": 380, "height": 293, "id": "LINE-7367f167-c5f4-4a30-a554-0ba37c959ebd", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-7367f167-c5f4-4a30-a554-0ba37c959ebd", "label": "LINE 3", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -928,12 +895,12 @@ "width": 380, "height": 293, "id": "LINE-9b2bacf0-8051-4dc2-939c-fbe7c2639b08", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-9b2bacf0-8051-4dc2-939c-fbe7c2639b08", "label": "LINE 3", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -968,12 +935,12 @@ "width": 380, "height": 293, "id": "LINE-b545e47b-fb97-427e-8f00-5c2a5e08ba39", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-b545e47b-fb97-427e-8f00-5c2a5e08ba39", "label": "LINE 4", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -1048,13 +1015,6 @@ "targetHandle": "default", "id": "reactflow__edge-ADD-15b2356b-8f79-4f9b-802c-1821c0924fcedefault-FIR-e4741c3f-334d-4e53-8a1a-db5549123ee0default" }, - { - "source": "FIR-e4741c3f-334d-4e53-8a1a-db5549123ee0", - "sourceHandle": "default", - "target": "END-9335c6e8-cab9-4475-846a-1466085dfa16", - "targetHandle": "default", - "id": "reactflow__edge-FIR-e4741c3f-334d-4e53-8a1a-db5549123ee0default-END-9335c6e8-cab9-4475-846a-1466085dfa16default" - }, { "source": "ADD-15b2356b-8f79-4f9b-802c-1821c0924fce", "sourceHandle": "default", @@ -1069,13 +1029,6 @@ "targetHandle": "default", "id": "reactflow__edge-FIR-e4741c3f-334d-4e53-8a1a-db5549123ee0default-FFT-a220559c-365a-4562-aee4-10461c688970default" }, - { - "source": "FFT-a220559c-365a-4562-aee4-10461c688970", - "sourceHandle": "default", - "target": "END-9335c6e8-cab9-4475-846a-1466085dfa16", - "targetHandle": "default", - "id": "reactflow__edge-FFT-a220559c-365a-4562-aee4-10461c688970default-END-9335c6e8-cab9-4475-846a-1466085dfa16default" - }, { "source": "FFT-1ee5f7c7-d72f-4d75-9804-ea9f6201edf2", "sourceHandle": "default", @@ -1090,13 +1043,6 @@ "targetHandle": "default", "id": "reactflow__edge-FFT-a220559c-365a-4562-aee4-10461c688970default-LINE-c3f1781a-b6e6-4657-9898-c88b3432f0f3default" }, - { - "source": "LINE-c3f1781a-b6e6-4657-9898-c88b3432f0f3", - "sourceHandle": "default", - "target": "END-9335c6e8-cab9-4475-846a-1466085dfa16", - "targetHandle": "default", - "id": "reactflow__edge-LINE-c3f1781a-b6e6-4657-9898-c88b3432f0f3default-END-9335c6e8-cab9-4475-846a-1466085dfa16default" - }, { "source": "FIR-e4741c3f-334d-4e53-8a1a-db5549123ee0", "sourceHandle": "default", diff --git a/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/IFFT/examples/EX1/app.txt b/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/IFFT/examples/EX1/app.txt index f47bbdbd11..1135651832 100644 --- a/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/IFFT/examples/EX1/app.txt +++ b/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/IFFT/examples/EX1/app.txt @@ -59,12 +59,12 @@ "width": 130, "height": 130, "id": "SINE-12238ccc-90fc-47f9-a679-50e628d4f156", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "SINE-12238ccc-90fc-47f9-a679-50e628d4f156", "label": "SINE", "func": "SINE", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "amplitude": { "type": "float", @@ -141,12 +141,12 @@ "width": 130, "height": 130, "id": "SINE-5569968e-4541-4ce2-88ad-ab72600b2f97", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "SINE-5569968e-4541-4ce2-88ad-ab72600b2f97", "label": "SINE 1", "func": "SINE", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "amplitude": { "type": "float", @@ -269,12 +269,12 @@ "width": 150, "height": 150, "id": "IFFT-d72d7f91-82ce-4591-991b-fe72f96c6cb4", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "data": { "id": "IFFT-d72d7f91-82ce-4591-991b-fe72f96c6cb4", "label": "IFFT", "func": "IFFT", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "ctrls": { "real_signal": { "type": "bool", @@ -317,12 +317,12 @@ "width": 150, "height": 150, "id": "FFT-44f7c803-706f-469a-8c6f-bab3b3dea659", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "data": { "id": "FFT-44f7c803-706f-469a-8c6f-bab3b3dea659", "label": "FFT", "func": "FFT", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "ctrls": { "window": { "type": "select", @@ -401,49 +401,16 @@ }, "dragging": true }, - { - "width": 210, - "height": 130, - "id": "END-4698a238-a7fb-40fa-adc6-dfeeb7e67437", - "type": "TERMINATORS", - "data": { - "id": "END-4698a238-a7fb-40fa-adc6-dfeeb7e67437", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 2581.552495946156, - "y": 263.6558957860222 - }, - "selected": false, - "positionAbsolute": { - "x": 2581.552495946156, - "y": 263.6558957860222 - }, - "dragging": true - }, { "width": 150, "height": 150, "id": "FFT-db612181-529c-4e66-924e-fa820d90f450", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "data": { "id": "FFT-db612181-529c-4e66-924e-fa820d90f450", "label": "FFT 1", "func": "FFT", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "ctrls": { "window": { "type": "select", @@ -526,12 +493,12 @@ "width": 225, "height": 226, "id": "LINE-eff15f6c-5cae-4dc5-afcf-595347396018", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-eff15f6c-5cae-4dc5-afcf-595347396018", "label": "LINE", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -566,12 +533,12 @@ "width": 225, "height": 226, "id": "LINE-e08d8338-6374-4f4d-8477-775f633ebe6d", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-e08d8338-6374-4f4d-8477-775f633ebe6d", "label": "LINE 1", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -606,12 +573,12 @@ "width": 225, "height": 226, "id": "LINE-bcc4b83a-9f6e-4444-ab14-b993716503ed", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-bcc4b83a-9f6e-4444-ab14-b993716503ed", "label": "LINE 2", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -629,13 +596,13 @@ } ], "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/LINE/LINE.py", - "selected": true + "selected": false }, "position": { "x": 2112.172067313177, "y": 474.1261265472838 }, - "selected": true, + "selected": false, "positionAbsolute": { "x": 2112.172067313177, "y": 474.1261265472838 @@ -686,13 +653,6 @@ "targetHandle": "default", "id": "reactflow__edge-FFT-44f7c803-706f-469a-8c6f-bab3b3dea659default-IFFT-d72d7f91-82ce-4591-991b-fe72f96c6cb4default" }, - { - "source": "IFFT-d72d7f91-82ce-4591-991b-fe72f96c6cb4", - "sourceHandle": "default", - "target": "END-4698a238-a7fb-40fa-adc6-dfeeb7e67437", - "targetHandle": "default", - "id": "reactflow__edge-IFFT-d72d7f91-82ce-4591-991b-fe72f96c6cb4default-END-4698a238-a7fb-40fa-adc6-dfeeb7e67437default" - }, { "source": "ADD-82417b86-8493-4cdc-867b-21e962e7ad69", "sourceHandle": "default", @@ -720,20 +680,6 @@ "target": "LINE-eff15f6c-5cae-4dc5-afcf-595347396018", "targetHandle": "default", "id": "reactflow__edge-ADD-82417b86-8493-4cdc-867b-21e962e7ad69default-LINE-eff15f6c-5cae-4dc5-afcf-595347396018default" - }, - { - "source": "LINE-bcc4b83a-9f6e-4444-ab14-b993716503ed", - "sourceHandle": "default", - "target": "END-4698a238-a7fb-40fa-adc6-dfeeb7e67437", - "targetHandle": "default", - "id": "reactflow__edge-LINE-bcc4b83a-9f6e-4444-ab14-b993716503eddefault-END-4698a238-a7fb-40fa-adc6-dfeeb7e67437default" - }, - { - "source": "LINE-e08d8338-6374-4f4d-8477-775f633ebe6d", - "sourceHandle": "default", - "target": "END-4698a238-a7fb-40fa-adc6-dfeeb7e67437", - "targetHandle": "default", - "id": "reactflow__edge-LINE-e08d8338-6374-4f4d-8477-775f633ebe6ddefault-END-4698a238-a7fb-40fa-adc6-dfeeb7e67437default" } ], "viewport": { diff --git a/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/PID/a1-[autogen]/python_code.txt b/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/PID/a1-[autogen]/python_code.txt index b86a8cb786..86d2f5ea5f 100644 --- a/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/PID/a1-[autogen]/python_code.txt +++ b/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/PID/a1-[autogen]/python_code.txt @@ -36,7 +36,7 @@ def PID( integral: float = integral + 0.5 * Ki * ( regulation_error + regulation_error_primes[0] ) - output_signal = ( + output_signal = -1 * ( Kp * regulation_error + integral + 0.1667 @@ -47,9 +47,9 @@ def PID( + 3.0 * (regulation_error_primes[0] - regulation_error_primes[1]) ) ) - regulation_error_primes[2]: float = regulation_error_primes[1] - regulation_error_primes[1]: float = regulation_error_primes[0] - regulation_error_primes[0]: float = regulation_error + regulation_error_primes[2] = regulation_error_primes[1] + regulation_error_primes[1] = regulation_error_primes[0] + regulation_error_primes[0] = regulation_error # Now write to memory ... SmallMemory().write_to_memory( diff --git a/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/PID/examples/EX1/app.txt b/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/PID/examples/EX1/app.txt index 2d25aaeeff..c265ce643c 100644 --- a/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/PID/examples/EX1/app.txt +++ b/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/PID/examples/EX1/app.txt @@ -2,157 +2,15 @@ "rfInstance": { "nodes": [ { - "width": 150, - "height": 150, - "id": "LOOP-67e6ac26-cc23-4159-8659-ef0577421ee3", - "type": "LOOPS", - "data": { - "id": "LOOP-67e6ac26-cc23-4159-8659-ef0577421ee3", - "label": "LOOP", - "func": "LOOP", - "type": "LOOPS", - "ctrls": { - "num_loops": { - "type": "int", - "default": -1, - "functionName": "LOOP", - "param": "num_loops", - "value": "15" - } - }, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "outputs": [ - { - "name": "body", - "id": "body", - "type": "Any" - }, - { - "name": "end", - "id": "end", - "type": "Any" - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\LOOPS\\LOOP\\LOOP.py", - "selected": true - }, - "position": { - "x": -120.5168017191627, - "y": 215.79596215972782 - }, - "selected": true, - "positionAbsolute": { - "x": -120.5168017191627, - "y": 215.79596215972782 - }, - "dragging": true - }, - { - "width": 150, - "height": 150, - "id": "GOTO-077af2ac-636b-4abb-a574-33e669e64457", - "type": "LOOPS", - "data": { - "id": "GOTO-077af2ac-636b-4abb-a574-33e669e64457", - "label": "GOTO", - "func": "GOTO", - "type": "LOOPS", - "ctrls": { - "goto_node_id": { - "type": "NodeReference", - "default": null, - "functionName": "GOTO", - "param": "goto_node_id", - "value": "LOOP-67e6ac26-cc23-4159-8659-ef0577421ee3" - } - }, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\LOOPS\\GOTO\\GOTO.py", - "selected": false - }, - "position": { - "x": 1258.0674029322674, - "y": 80.81660196613069 - }, - "selected": false, - "positionAbsolute": { - "x": 1258.0674029322674, - "y": 80.81660196613069 - }, - "dragging": true - }, - { - "width": 130, - "height": 130, - "id": "CONSTANT-763b863d-7a28-4264-8f33-3e02c65f85d5", - "type": "SIMULATIONS", - "data": { - "id": "CONSTANT-763b863d-7a28-4264-8f33-3e02c65f85d5", - "label": "100", - "func": "CONSTANT", - "type": "SIMULATIONS", - "ctrls": { - "constant": { - "type": "float", - "default": 3, - "functionName": "CONSTANT", - "param": "constant", - "value": "100" - } - }, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "OrderedPair", - "multiple": false - } - ], - "outputs": [ - { - "name": "default", - "id": "default", - "type": "OrderedPair" - } - ], - "path": "PYTHON/nodes\\GENERATORS\\SIMULATIONS\\CONSTANT\\CONSTANT.py", - "selected": false - }, - "position": { - "x": 233.2840998939468, - "y": 257.4687143861847 - }, - "selected": false, - "positionAbsolute": { - "x": 233.2840998939468, - "y": 257.4687143861847 - }, - "dragging": true - }, - { - "width": 150, - "height": 150, + "width": 160, + "height": 160, "id": "PID-cee43c6b-237d-45f8-98d0-319f48acaebf", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "data": { "id": "PID-cee43c6b-237d-45f8-98d0-319f48acaebf", "label": "PID", "func": "PID", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "ctrls": { "Kp": { "type": "float", @@ -195,26 +53,26 @@ "selected": false }, "position": { - "x": 677.7645079422954, - "y": 81.60321798273725 + "x": 691.7222902734321, + "y": 96.72414884146878 }, "selected": false, "positionAbsolute": { - "x": 677.7645079422954, - "y": 81.60321798273725 + "x": 691.7222902734321, + "y": 96.72414884146878 }, "dragging": true }, { - "width": 130, - "height": 130, + "width": 208, + "height": 96, "id": "SECOND_ORDER_SYSTEM-f97650dd-54de-4204-be2d-a04451e4b622", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "SECOND_ORDER_SYSTEM-f97650dd-54de-4204-be2d-a04451e4b622", "label": "SECOND ORDER SYSTEM", "func": "SECOND_ORDER_SYSTEM", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "d1": { "type": "float", @@ -250,26 +108,26 @@ "selected": false }, "position": { - "x": 978.4912585306391, - "y": 87.6001248789845 + "x": 969.1860703098813, + "y": 130.6366203999895 }, "selected": false, "positionAbsolute": { - "x": 978.4912585306391, - "y": 87.6001248789845 + "x": 969.1860703098813, + "y": 130.6366203999895 }, "dragging": true }, { - "width": 130, - "height": 130, + "width": 208, + "height": 96, "id": "FEEDBACK-7dce3ba5-d2e2-4b60-8a2c-06218b5f718d", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "FEEDBACK-7dce3ba5-d2e2-4b60-8a2c-06218b5f718d", "label": "FEEDBACK", "func": "FEEDBACK", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "referred_node": { "type": "NodeReference", @@ -309,67 +167,69 @@ "dragging": true }, { - "width": 99, - "height": 130, - "id": "SUBTRACT-3a3c4ed2-1ec0-433a-b6d6-d9819a2a02c1", - "type": "ARITHMETIC", + "width": 380, + "height": 293, + "id": "LINE-ed3aba7c-7235-43dd-baeb-6ad9dbc763b9", + "type": "VISUALIZERS", "data": { - "id": "SUBTRACT-3a3c4ed2-1ec0-433a-b6d6-d9819a2a02c1", - "label": "SUBTRACT", - "func": "SUBTRACT", - "type": "ARITHMETIC", + "id": "LINE-ed3aba7c-7235-43dd-baeb-6ad9dbc763b9", + "label": "LINE", + "func": "LINE", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { - "name": "a", - "id": "a", - "type": "OrderedPair", + "name": "default", + "id": "default", + "type": "OrderedPair|DataFrame|Matrix", "multiple": false - }, - { - "name": "b", - "id": "b", - "type": "OrderedPair", - "multiple": true } ], "outputs": [ { "name": "default", "id": "default", - "type": "OrderedPair" + "type": "Plotly" } ], - "path": "PYTHON/nodes\\TRANSFORMERS\\ARITHMETIC\\SUBTRACT\\SUBTRACT.py", + "path": "PYTHON/nodes\\VISUALIZERS\\PLOTLY\\LINE\\LINE.py", "selected": false }, "position": { - "x": 462.9560157284769, - "y": 114.87540487187692 + "x": 646.7443796856828, + "y": 431.78879240282043 }, "selected": false, "positionAbsolute": { - "x": 462.9560157284769, - "y": 114.87540487187692 + "x": 646.7443796856828, + "y": 431.78879240282043 }, "dragging": true }, { - "width": 380, - "height": 293, - "id": "LINE-ed3aba7c-7235-43dd-baeb-6ad9dbc763b9", - "type": "PLOTLY", + "width": 160, + "height": 160, + "id": "DS_LOAD-1cfd0ec3-cbf0-4316-b2f0-2654e5a54e49", + "type": "LOADERS", "data": { - "id": "LINE-ed3aba7c-7235-43dd-baeb-6ad9dbc763b9", - "label": "LINE", - "func": "LINE", - "type": "PLOTLY", - "ctrls": {}, + "id": "DS_LOAD-1cfd0ec3-cbf0-4316-b2f0-2654e5a54e49", + "label": "DS LOAD", + "func": "DS_LOAD", + "type": "LOADERS", + "ctrls": { + "referred_node": { + "type": "NodeReference", + "default": null, + "functionName": "DS_LOAD", + "param": "referred_node", + "value": "SECOND_ORDER_SYSTEM-f97650dd-54de-4204-be2d-a04451e4b622" + } + }, "inputs": [ { "name": "default", "id": "default", - "type": "OrderedPair|DataFrame|Matrix", + "type": "OrderedPair", "multiple": false } ], @@ -377,181 +237,251 @@ { "name": "default", "id": "default", - "type": "Plotly" + "type": "OrderedPair" } ], - "path": "PYTHON/nodes\\VISUALIZERS\\PLOTLY\\LINE\\LINE.py", + "path": "", "selected": false }, "position": { - "x": 646.7443796856828, - "y": 431.78879240282043 + "x": 226.90231299211854, + "y": 460.341992432171 }, "selected": false, "positionAbsolute": { - "x": 646.7443796856828, - "y": 431.78879240282043 + "x": 226.90231299211854, + "y": 460.341992432171 }, "dragging": true }, { - "width": 210, - "height": 130, - "id": "END-c14d955a-8357-4341-8221-caf9f2832174", - "type": "TERMINATORS", + "width": 96, + "height": 96, + "id": "LOOP-ee157ec4-dc88-4f4e-be71-5db5e3bbe87c", + "type": "LOGIC_GATES", "data": { - "id": "END-c14d955a-8357-4341-8221-caf9f2832174", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, + "id": "LOOP-ee157ec4-dc88-4f4e-be71-5db5e3bbe87c", + "label": "LOOP", + "func": "LOOP", + "type": "LOGIC_GATES", + "ctrls": { + "num_loops": { + "type": "int", + "default": -1, + "desc": "number of times to iterate through body nodes default is `-1` meaning infinity.", + "functionName": "LOOP", + "param": "num_loops", + "value": "15" + } + }, "inputs": [ { "name": "default", "id": "default", "type": "Any", - "multiple": false + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "body", + "id": "body", + "type": "Any", + "desc": null + }, + { + "name": "end", + "id": "end", + "type": "Any", + "desc": null } ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", + "path": "PYTHON/nodes\\LOGIC_GATES\\LOOPS\\LOOP\\LOOP.py", "selected": false }, "position": { - "x": 1058.3707129617164, - "y": 465.2386207280347 + "x": -55.67628506838092, + "y": 265.6921237098219 }, "selected": false, "positionAbsolute": { - "x": 1058.3707129617164, - "y": 465.2386207280347 + "x": -55.67628506838092, + "y": 265.6921237098219 }, "dragging": true }, { - "width": 150, - "height": 150, - "id": "DS_LOAD-1cfd0ec3-cbf0-4316-b2f0-2654e5a54e49", - "type": "INTERNAL_MEMORY", + "width": 208, + "height": 96, + "id": "CONSTANT-f84cbbe2-6624-49c7-8a7a-a65b34b277db", + "type": "GENERATORS", "data": { - "id": "DS_LOAD-1cfd0ec3-cbf0-4316-b2f0-2654e5a54e49", - "label": "DS LOAD", - "func": "DS_LOAD", - "type": "INTERNAL_MEMORY", + "id": "CONSTANT-f84cbbe2-6624-49c7-8a7a-a65b34b277db", + "label": "100", + "func": "CONSTANT", + "type": "GENERATORS", "ctrls": { - "referred_node": { - "type": "NodeReference", - "default": null, - "functionName": "DS_LOAD", - "param": "referred_node", - "value": "SECOND_ORDER_SYSTEM-f97650dd-54de-4204-be2d-a04451e4b622" + "constant": { + "type": "float", + "default": 3, + "desc": null, + "functionName": "CONSTANT", + "param": "constant", + "value": "100" + }, + "step": { + "type": "int", + "default": 1000, + "desc": null, + "functionName": "CONSTANT", + "param": "step", + "value": 1000 } }, "inputs": [ + { + "name": "default", + "id": "default", + "type": "Vector|OrderedPair", + "multiple": false, + "desc": null + } + ], + "outputs": [ { "name": "default", "id": "default", "type": "OrderedPair", - "multiple": false + "desc": null + } + ], + "path": "PYTHON/nodes\\GENERATORS\\SIMULATIONS\\CONSTANT\\CONSTANT.py", + "selected": false + }, + "position": { + "x": 245.52016850960797, + "y": 232.96864047833014 + }, + "selected": false, + "positionAbsolute": { + "x": 245.52016850960797, + "y": 232.96864047833014 + }, + "dragging": true + }, + { + "width": 72, + "height": 72, + "id": "SUBTRACT-513db751-391e-4342-aee3-9f322a4c3118", + "type": "ARITHMETIC", + "data": { + "id": "SUBTRACT-513db751-391e-4342-aee3-9f322a4c3118", + "label": "SUBTRACT", + "func": "SUBTRACT", + "type": "ARITHMETIC", + "ctrls": {}, + "inputs": [ + { + "name": "a", + "id": "a", + "type": "OrderedPair|Scalar|Vector", + "multiple": false, + "desc": null + }, + { + "name": "b", + "id": "b", + "type": "OrderedPair|Scalar|Vector", + "multiple": true, + "desc": null } ], "outputs": [ { "name": "default", "id": "default", - "type": "OrderedPair" + "type": "OrderedPair|Scalar|Vector", + "desc": null } ], - "path": "", + "path": "PYTHON/nodes\\TRANSFORMERS\\ARITHMETIC\\SUBTRACT\\SUBTRACT.py", "selected": false }, "position": { - "x": 226.90231299211854, - "y": 460.341992432171 + "x": 539.5038389646794, + "y": 129.82546731386907 }, "selected": false, "positionAbsolute": { - "x": 226.90231299211854, - "y": 460.341992432171 + "x": 539.5038389646794, + "y": 129.82546731386907 }, "dragging": true } ], "edges": [ { - "source": "LOOP-67e6ac26-cc23-4159-8659-ef0577421ee3", - "sourceHandle": "body", - "target": "CONSTANT-763b863d-7a28-4264-8f33-3e02c65f85d5", - "targetHandle": "default", - "id": "reactflow__edge-LOOP-67e6ac26-cc23-4159-8659-ef0577421ee3body-CONSTANT-763b863d-7a28-4264-8f33-3e02c65f85d5default" - }, - { - "source": "LOOP-67e6ac26-cc23-4159-8659-ef0577421ee3", - "sourceHandle": "body", - "target": "FEEDBACK-7dce3ba5-d2e2-4b60-8a2c-06218b5f718d", + "source": "PID-cee43c6b-237d-45f8-98d0-319f48acaebf", + "sourceHandle": "default", + "target": "SECOND_ORDER_SYSTEM-f97650dd-54de-4204-be2d-a04451e4b622", "targetHandle": "default", - "id": "reactflow__edge-LOOP-67e6ac26-cc23-4159-8659-ef0577421ee3body-FEEDBACK-7dce3ba5-d2e2-4b60-8a2c-06218b5f718ddefault" + "id": "reactflow__edge-PID-cee43c6b-237d-45f8-98d0-319f48acaebfdefault-SECOND_ORDER_SYSTEM-f97650dd-54de-4204-be2d-a04451e4b622default" }, { - "source": "SUBTRACT-3a3c4ed2-1ec0-433a-b6d6-d9819a2a02c1", + "source": "DS_LOAD-1cfd0ec3-cbf0-4316-b2f0-2654e5a54e49", "sourceHandle": "default", - "target": "PID-cee43c6b-237d-45f8-98d0-319f48acaebf", + "target": "LINE-ed3aba7c-7235-43dd-baeb-6ad9dbc763b9", "targetHandle": "default", - "id": "reactflow__edge-SUBTRACT-3a3c4ed2-1ec0-433a-b6d6-d9819a2a02c1default-PID-cee43c6b-237d-45f8-98d0-319f48acaebfdefault" + "id": "reactflow__edge-DS_LOAD-1cfd0ec3-cbf0-4316-b2f0-2654e5a54e49default-LINE-ed3aba7c-7235-43dd-baeb-6ad9dbc763b9default" }, { - "source": "PID-cee43c6b-237d-45f8-98d0-319f48acaebf", - "sourceHandle": "default", - "target": "SECOND_ORDER_SYSTEM-f97650dd-54de-4204-be2d-a04451e4b622", + "source": "LOOP-ee157ec4-dc88-4f4e-be71-5db5e3bbe87c", + "sourceHandle": "body", + "target": "CONSTANT-f84cbbe2-6624-49c7-8a7a-a65b34b277db", "targetHandle": "default", - "id": "reactflow__edge-PID-cee43c6b-237d-45f8-98d0-319f48acaebfdefault-SECOND_ORDER_SYSTEM-f97650dd-54de-4204-be2d-a04451e4b622default" + "id": "reactflow__edge-LOOP-ee157ec4-dc88-4f4e-be71-5db5e3bbe87cbody-CONSTANT-f84cbbe2-6624-49c7-8a7a-a65b34b277dbdefault" }, { - "source": "SECOND_ORDER_SYSTEM-f97650dd-54de-4204-be2d-a04451e4b622", - "sourceHandle": "default", - "target": "GOTO-077af2ac-636b-4abb-a574-33e669e64457", + "source": "LOOP-ee157ec4-dc88-4f4e-be71-5db5e3bbe87c", + "sourceHandle": "body", + "target": "FEEDBACK-7dce3ba5-d2e2-4b60-8a2c-06218b5f718d", "targetHandle": "default", - "id": "reactflow__edge-SECOND_ORDER_SYSTEM-f97650dd-54de-4204-be2d-a04451e4b622default-GOTO-077af2ac-636b-4abb-a574-33e669e64457default" + "id": "reactflow__edge-LOOP-ee157ec4-dc88-4f4e-be71-5db5e3bbe87cbody-FEEDBACK-7dce3ba5-d2e2-4b60-8a2c-06218b5f718ddefault" }, { "source": "FEEDBACK-7dce3ba5-d2e2-4b60-8a2c-06218b5f718d", "sourceHandle": "default", - "target": "SUBTRACT-3a3c4ed2-1ec0-433a-b6d6-d9819a2a02c1", + "target": "SUBTRACT-513db751-391e-4342-aee3-9f322a4c3118", "targetHandle": "a", - "id": "reactflow__edge-FEEDBACK-7dce3ba5-d2e2-4b60-8a2c-06218b5f718ddefault-SUBTRACT-3a3c4ed2-1ec0-433a-b6d6-d9819a2a02c1a" + "id": "reactflow__edge-FEEDBACK-7dce3ba5-d2e2-4b60-8a2c-06218b5f718ddefault-SUBTRACT-513db751-391e-4342-aee3-9f322a4c3118a" }, { - "source": "CONSTANT-763b863d-7a28-4264-8f33-3e02c65f85d5", + "source": "CONSTANT-f84cbbe2-6624-49c7-8a7a-a65b34b277db", "sourceHandle": "default", - "target": "SUBTRACT-3a3c4ed2-1ec0-433a-b6d6-d9819a2a02c1", + "target": "SUBTRACT-513db751-391e-4342-aee3-9f322a4c3118", "targetHandle": "b", - "id": "reactflow__edge-CONSTANT-763b863d-7a28-4264-8f33-3e02c65f85d5default-SUBTRACT-3a3c4ed2-1ec0-433a-b6d6-d9819a2a02c1b" + "id": "reactflow__edge-CONSTANT-f84cbbe2-6624-49c7-8a7a-a65b34b277dbdefault-SUBTRACT-513db751-391e-4342-aee3-9f322a4c3118b" }, { - "source": "LINE-ed3aba7c-7235-43dd-baeb-6ad9dbc763b9", + "source": "SUBTRACT-513db751-391e-4342-aee3-9f322a4c3118", "sourceHandle": "default", - "target": "END-c14d955a-8357-4341-8221-caf9f2832174", + "target": "PID-cee43c6b-237d-45f8-98d0-319f48acaebf", "targetHandle": "default", - "id": "reactflow__edge-LINE-ed3aba7c-7235-43dd-baeb-6ad9dbc763b9default-END-c14d955a-8357-4341-8221-caf9f2832174default" + "id": "reactflow__edge-SUBTRACT-513db751-391e-4342-aee3-9f322a4c3118default-PID-cee43c6b-237d-45f8-98d0-319f48acaebfdefault" }, { - "source": "LOOP-67e6ac26-cc23-4159-8659-ef0577421ee3", + "source": "LOOP-ee157ec4-dc88-4f4e-be71-5db5e3bbe87c", "sourceHandle": "end", "target": "DS_LOAD-1cfd0ec3-cbf0-4316-b2f0-2654e5a54e49", "targetHandle": "default", - "id": "reactflow__edge-LOOP-67e6ac26-cc23-4159-8659-ef0577421ee3end-DS_LOAD-1cfd0ec3-cbf0-4316-b2f0-2654e5a54e49default" - }, - { - "source": "DS_LOAD-1cfd0ec3-cbf0-4316-b2f0-2654e5a54e49", - "sourceHandle": "default", - "target": "LINE-ed3aba7c-7235-43dd-baeb-6ad9dbc763b9", - "targetHandle": "default", - "id": "reactflow__edge-DS_LOAD-1cfd0ec3-cbf0-4316-b2f0-2654e5a54e49default-LINE-ed3aba7c-7235-43dd-baeb-6ad9dbc763b9default" + "id": "reactflow__edge-LOOP-ee157ec4-dc88-4f4e-be71-5db5e3bbe87cend-DS_LOAD-1cfd0ec3-cbf0-4316-b2f0-2654e5a54e49default" } ], "viewport": { - "x": -296.35399545928726, - "y": 66.8470830817738, - "zoom": 0.8744723800359967 + "x": 606.4472645567363, + "y": 234.63130388602087, + "zoom": 0.9186369849831518 } }, "ctrlsManifest": [ diff --git a/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/SAVGOL/examples/EX1/app.txt b/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/SAVGOL/examples/EX1/app.txt index a243273fb3..06fc6f8385 100644 --- a/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/SAVGOL/examples/EX1/app.txt +++ b/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/SAVGOL/examples/EX1/app.txt @@ -58,12 +58,12 @@ "width": 130, "height": 130, "id": "RAND-67823db5-2e2b-48d2-9fa2-59711d68d8b3", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "RAND-67823db5-2e2b-48d2-9fa2-59711d68d8b3", "label": "RAND", "func": "RAND", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "distribution": { "type": "select", @@ -234,12 +234,12 @@ "width": 150, "height": 150, "id": "SAVGOL-a8bd4f8a-63a4-4b06-bacd-4cf1289f022e", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "data": { "id": "SAVGOL-a8bd4f8a-63a4-4b06-bacd-4cf1289f022e", "label": "SAVGOL", "func": "SAVGOL", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "ctrls": { "window_length": { "type": "int", @@ -331,49 +331,16 @@ }, "dragging": true }, - { - "width": 210, - "height": 130, - "id": "END-5136c932-1e5b-4808-8235-f5ed6a4e1f6e", - "type": "TERMINATORS", - "data": { - "id": "END-5136c932-1e5b-4808-8235-f5ed6a4e1f6e", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 1839.9066244479338, - "y": 148.48176399658917 - }, - "selected": false, - "positionAbsolute": { - "x": 1839.9066244479338, - "y": 148.48176399658917 - }, - "dragging": true - }, { "width": 380, "height": 293, "id": "LINE-38ed0165-2ba5-418f-8603-e8592ae636c2", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-38ed0165-2ba5-418f-8603-e8592ae636c2", "label": "LINE", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -408,12 +375,12 @@ "width": 380, "height": 293, "id": "LINE-46272c52-999a-48c0-a2c4-9bf8e9f01631", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-46272c52-999a-48c0-a2c4-9bf8e9f01631", "label": "LINE 1", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -431,13 +398,13 @@ } ], "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/LINE/LINE.py", - "selected": true + "selected": false }, "position": { "x": 1489.3610618674375, "y": 384.82137397850096 }, - "selected": true, + "selected": false, "positionAbsolute": { "x": 1489.3610618674375, "y": 384.82137397850096 @@ -453,13 +420,6 @@ "targetHandle": "default", "id": "reactflow__edge-LINSPACE-79f540d0-bf01-44ee-a5cc-bd7c22c481fedefault-RAND-67823db5-2e2b-48d2-9fa2-59711d68d8b3default" }, - { - "source": "SAVGOL-a8bd4f8a-63a4-4b06-bacd-4cf1289f022e", - "sourceHandle": "default", - "target": "END-5136c932-1e5b-4808-8235-f5ed6a4e1f6e", - "targetHandle": "default", - "id": "reactflow__edge-SAVGOL-a8bd4f8a-63a4-4b06-bacd-4cf1289f022edefault-END-5136c932-1e5b-4808-8235-f5ed6a4e1f6edefault" - }, { "source": "ADD-b6b71026-3b39-41be-9230-276ce8d76e70", "sourceHandle": "default", @@ -494,13 +454,6 @@ "target": "LINE-46272c52-999a-48c0-a2c4-9bf8e9f01631", "targetHandle": "default", "id": "reactflow__edge-SAVGOL-a8bd4f8a-63a4-4b06-bacd-4cf1289f022edefault-LINE-46272c52-999a-48c0-a2c4-9bf8e9f01631default" - }, - { - "source": "LINE-46272c52-999a-48c0-a2c4-9bf8e9f01631", - "sourceHandle": "default", - "target": "END-5136c932-1e5b-4808-8235-f5ed6a4e1f6e", - "targetHandle": "default", - "id": "reactflow__edge-LINE-46272c52-999a-48c0-a2c4-9bf8e9f01631default-END-5136c932-1e5b-4808-8235-f5ed6a4e1f6edefault" } ], "viewport": { diff --git a/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/TWO_DIMENSIONAL_FFT/examples/EX1/app.txt b/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/TWO_DIMENSIONAL_FFT/examples/EX1/app.txt index cd25ebbc1f..f82f4a4d83 100644 --- a/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/TWO_DIMENSIONAL_FFT/examples/EX1/app.txt +++ b/docs/nodes/TRANSFORMERS/SIGNAL_PROCESSING/TWO_DIMENSIONAL_FFT/examples/EX1/app.txt @@ -1,134 +1,16 @@ { "rfInstance": { "nodes": [ - { - "width": 150, - "height": 150, - "id": "SKLEARNIMAGE-874fdd2b-fea5-4dc6-8898-2905d070aca8", - "type": "default", - "data": { - "id": "SKLEARNIMAGE-874fdd2b-fea5-4dc6-8898-2905d070aca8", - "label": "SKLEARNIMAGE", - "func": "SKLEARNIMAGE", - "type": "default", - "ctrls": { - "img_key": { - "type": "select", - "default": null, - "options": [ - "astronaut", - "binary_blobs", - "brain", - "brick", - "camera", - "cat", - "cell", - "cells3d", - "checkerboard", - "chelsea", - "clock", - "coffee", - "coins", - "colorwheel", - "create_image_fetcher", - "data_dir", - "download_all", - "eagle", - "file_hash", - "grass", - "gravel", - "horse", - "hubble_deep_field", - "human_mitosis", - "image_fetcher", - "immunohistochemistry", - "kidney", - "lbp_frontal_face_cascade_filename", - "lfw_subset", - "lily", - "logo", - "microaneurysms", - "moon", - "nickel_solidification", - "page", - "protein_transport", - "retina", - "rocket", - "shepp_logan_phantom", - "skin", - "stereo_motorcycle", - "text", - "vortex" - ], - "functionName": "SKLEARNIMAGE", - "param": "img_key", - "value": "astronaut" - } - }, - "outputs": [ - { - "name": "default", - "id": "default", - "type": "Image" - } - ], - "path": "PYTHON/nodes/GENERATORS/SAMPLE_IMAGES/SKLEARNIMAGE/SKLEARNIMAGE.py", - "selected": false - }, - "position": { - "x": 289.06340100673725, - "y": 31.048713013173256 - }, - "selected": false, - "positionAbsolute": { - "x": 289.06340100673725, - "y": 31.048713013173256 - }, - "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-8d20d677-c761-43cf-8b24-cde84bd667b9", - "type": "TERMINATORS", - "data": { - "id": "END-8d20d677-c761-43cf-8b24-cde84bd667b9", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 1532.8957187538622, - "y": 33.05596440245415 - }, - "selected": false, - "positionAbsolute": { - "x": 1532.8957187538622, - "y": 33.05596440245415 - }, - "dragging": true - }, { "width": 380, "height": 293, "id": "IMAGE-455a09f6-8f20-4087-ab60-9f01c1b2427c", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "IMAGE-455a09f6-8f20-4087-ab60-9f01c1b2427c", "label": "IMAGE", "func": "IMAGE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -149,13 +31,13 @@ "selected": false }, "position": { - "x": 1062.380266126793, - "y": 265.13327582038596 + "x": 1049.9664410476967, + "y": 7.753302513786252 }, "selected": false, "positionAbsolute": { - "x": 1062.380266126793, - "y": 265.13327582038596 + "x": 1049.9664410476967, + "y": 7.753302513786252 }, "dragging": true }, @@ -163,12 +45,12 @@ "width": 380, "height": 293, "id": "IMAGE-135a920b-87fa-4759-bfca-0b6ad739b406", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "IMAGE-135a920b-87fa-4759-bfca-0b6ad739b406", "label": "IMAGE 1", "func": "IMAGE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -189,26 +71,26 @@ "selected": false }, "position": { - "x": 463.2797046471253, - "y": 253.34979215719778 + "x": 680.10784936201, + "y": 259.1429105274428 }, "selected": false, "positionAbsolute": { - "x": 463.2797046471253, - "y": 253.34979215719778 + "x": 680.10784936201, + "y": 259.1429105274428 }, "dragging": true }, { - "width": 150, - "height": 150, + "width": 160, + "height": 160, "id": "TWO_DIMENSIONAL_FFT-373b4021-dbb6-4c59-8884-b146b6d2bb76", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "data": { "id": "TWO_DIMENSIONAL_FFT-373b4021-dbb6-4c59-8884-b146b6d2bb76", "label": "TWO DIMENSIONAL FFT", "func": "TWO_DIMENSIONAL_FFT", - "type": "SIGNAL_PROCESSING", + "type": "TRANSFORMERS", "ctrls": { "real_signal": { "type": "bool", @@ -247,61 +129,140 @@ } ], "path": "PYTHON/nodes/TRANSFORMERS/SIGNAL_PROCESSING/TWO_DIMENSIONAL_FFT/TWO_DIMENSIONAL_FFT.py", - "selected": true + "selected": false }, "position": { - "x": 814.407349374476, - "y": 21.664981920011172 + "x": 751.5106356403874, + "y": 35.73398367632049 }, - "selected": true, + "selected": false, "positionAbsolute": { - "x": 814.407349374476, - "y": 21.664981920011172 + "x": 751.5106356403874, + "y": 35.73398367632049 + }, + "dragging": true + }, + { + "width": 150, + "height": 180, + "id": "SKLEARNIMAGE-1fe5199d-c1cf-40c3-8a55-2445b6a2426c", + "type": "default", + "data": { + "id": "SKLEARNIMAGE-1fe5199d-c1cf-40c3-8a55-2445b6a2426c", + "label": "SKLEARNIMAGE", + "func": "SKLEARNIMAGE", + "type": "default", + "ctrls": { + "img_key": { + "type": "select", + "default": "astronaut", + "options": [ + "astronaut", + "binary_blobs", + "brain", + "brick", + "camera", + "cat", + "cell", + "cells3d", + "checkerboard", + "chelsea", + "clock", + "coffee", + "coins", + "colorwheel", + "create_image_fetcher", + "data_dir", + "download_all", + "eagle", + "file_hash", + "grass", + "gravel", + "horse", + "hubble_deep_field", + "human_mitosis", + "image_fetcher", + "immunohistochemistry", + "kidney", + "lbp_frontal_face_cascade_filename", + "lfw_subset", + "lily", + "logo", + "microaneurysms", + "moon", + "nickel_solidification", + "page", + "protein_transport", + "retina", + "rocket", + "shepp_logan_phantom", + "skin", + "stereo_motorcycle", + "text", + "vortex" + ], + "desc": null, + "functionName": "SKLEARNIMAGE", + "param": "img_key", + "value": "astronaut" + } + }, + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Image", + "desc": null + } + ], + "pip_dependencies": [ + { + "name": "scikit-image", + "v": "0.21.0" + } + ], + "path": "PYTHON/nodes\\GENERATORS\\SAMPLE_IMAGES\\SKLEARNIMAGE\\SKLEARNIMAGE.py", + "selected": false + }, + "position": { + "x": 417.41128879686454, + "y": 21.10713477860139 + }, + "selected": false, + "positionAbsolute": { + "x": 417.41128879686454, + "y": 21.10713477860139 }, "dragging": true } ], "edges": [ { - "source": "SKLEARNIMAGE-874fdd2b-fea5-4dc6-8898-2905d070aca8", - "sourceHandle": "default", - "target": "IMAGE-135a920b-87fa-4759-bfca-0b6ad739b406", - "targetHandle": "default", - "id": "reactflow__edge-SKLEARNIMAGE-874fdd2b-fea5-4dc6-8898-2905d070aca8default-IMAGE-135a920b-87fa-4759-bfca-0b6ad739b406default" - }, - { - "source": "IMAGE-455a09f6-8f20-4087-ab60-9f01c1b2427c", + "source": "TWO_DIMENSIONAL_FFT-373b4021-dbb6-4c59-8884-b146b6d2bb76", "sourceHandle": "default", - "target": "END-8d20d677-c761-43cf-8b24-cde84bd667b9", + "target": "IMAGE-455a09f6-8f20-4087-ab60-9f01c1b2427c", "targetHandle": "default", - "id": "reactflow__edge-IMAGE-455a09f6-8f20-4087-ab60-9f01c1b2427cdefault-END-8d20d677-c761-43cf-8b24-cde84bd667b9default" + "id": "reactflow__edge-TWO_DIMENSIONAL_FFT-373b4021-dbb6-4c59-8884-b146b6d2bb76default-IMAGE-455a09f6-8f20-4087-ab60-9f01c1b2427cdefault" }, { - "source": "SKLEARNIMAGE-874fdd2b-fea5-4dc6-8898-2905d070aca8", + "source": "SKLEARNIMAGE-1fe5199d-c1cf-40c3-8a55-2445b6a2426c", "sourceHandle": "default", "target": "TWO_DIMENSIONAL_FFT-373b4021-dbb6-4c59-8884-b146b6d2bb76", "targetHandle": "default", - "id": "reactflow__edge-SKLEARNIMAGE-874fdd2b-fea5-4dc6-8898-2905d070aca8default-TWO_DIMENSIONAL_FFT-373b4021-dbb6-4c59-8884-b146b6d2bb76default" - }, - { - "source": "TWO_DIMENSIONAL_FFT-373b4021-dbb6-4c59-8884-b146b6d2bb76", - "sourceHandle": "default", - "target": "END-8d20d677-c761-43cf-8b24-cde84bd667b9", - "targetHandle": "default", - "id": "reactflow__edge-TWO_DIMENSIONAL_FFT-373b4021-dbb6-4c59-8884-b146b6d2bb76default-END-8d20d677-c761-43cf-8b24-cde84bd667b9default" + "id": "reactflow__edge-SKLEARNIMAGE-1fe5199d-c1cf-40c3-8a55-2445b6a2426cdefault-TWO_DIMENSIONAL_FFT-373b4021-dbb6-4c59-8884-b146b6d2bb76default" }, { - "source": "TWO_DIMENSIONAL_FFT-373b4021-dbb6-4c59-8884-b146b6d2bb76", + "source": "SKLEARNIMAGE-1fe5199d-c1cf-40c3-8a55-2445b6a2426c", "sourceHandle": "default", - "target": "IMAGE-455a09f6-8f20-4087-ab60-9f01c1b2427c", + "target": "IMAGE-135a920b-87fa-4759-bfca-0b6ad739b406", "targetHandle": "default", - "id": "reactflow__edge-TWO_DIMENSIONAL_FFT-373b4021-dbb6-4c59-8884-b146b6d2bb76default-IMAGE-455a09f6-8f20-4087-ab60-9f01c1b2427cdefault" + "id": "reactflow__edge-SKLEARNIMAGE-1fe5199d-c1cf-40c3-8a55-2445b6a2426cdefault-IMAGE-135a920b-87fa-4759-bfca-0b6ad739b406default" } ], "viewport": { - "x": -373.4542219202399, - "y": 120.20973884288571, - "zoom": 1.101977389476256 + "x": 606.4472645567363, + "y": 234.63130388602087, + "zoom": 0.9186369849831518 } }, "ctrlsManifest": [ diff --git a/docs/nodes/TRANSFORMERS/TYPE_CASTING/DF_2_NP/examples/EX1/app.jpeg b/docs/nodes/TRANSFORMERS/TYPE_CASTING/DF_2_NP/examples/EX1/app.jpeg index ddd1cf1b8f..bf16ad0815 100644 Binary files a/docs/nodes/TRANSFORMERS/TYPE_CASTING/DF_2_NP/examples/EX1/app.jpeg and b/docs/nodes/TRANSFORMERS/TYPE_CASTING/DF_2_NP/examples/EX1/app.jpeg differ diff --git a/docs/nodes/TRANSFORMERS/TYPE_CASTING/DF_2_NP/examples/EX1/app.txt b/docs/nodes/TRANSFORMERS/TYPE_CASTING/DF_2_NP/examples/EX1/app.txt index df259eafd0..a05e8e3967 100644 --- a/docs/nodes/TRANSFORMERS/TYPE_CASTING/DF_2_NP/examples/EX1/app.txt +++ b/docs/nodes/TRANSFORMERS/TYPE_CASTING/DF_2_NP/examples/EX1/app.txt @@ -2,15 +2,15 @@ "rfInstance": { "nodes": [ { - "width": 150, - "height": 150, - "id": "R_DATASET-2cbb8a61-2c9a-4ad1-aa30-531be333cdf7", - "type": "SAMPLE_DATASETS", + "width": 208, + "height": 96, + "id": "R_DATASET-b9a3532b-7924-41b5-b7a3-3b2f26342f57", + "type": "GENERATORS", "data": { - "id": "R_DATASET-2cbb8a61-2c9a-4ad1-aa30-531be333cdf7", + "id": "R_DATASET-b9a3532b-7924-41b5-b7a3-3b2f26342f57", "label": "R DATASET", "func": "R_DATASET", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "ctrls": { "dataset_key": { "type": "select", @@ -98,16 +98,18 @@ "WorldPhones", "WWWusage" ], + "desc": null, "functionName": "R_DATASET", "param": "dataset_key", - "value": "iris" + "value": "airquality" } }, "outputs": [ { "name": "default", "id": "default", - "type": "DataFrame" + "type": "DataFrame", + "desc": null } ], "pip_dependencies": [ @@ -120,157 +122,170 @@ "selected": false }, "position": { - "x": -21.263377334327345, - "y": 160.19882921815832 + "x": -580.4601807214103, + "y": 18.651973077552213 }, "selected": false, "positionAbsolute": { - "x": -21.263377334327345, - "y": 160.19882921815832 + "x": -580.4601807214103, + "y": 18.651973077552213 }, "dragging": true }, { - "width": 150, - "height": 150, - "id": "DF_2_NP-91929d87-cbfb-430e-b5ac-78ee01dba01d", - "type": "TYPE_CASTING", + "width": 160, + "height": 160, + "id": "DF_2_NP-84475e8e-a8be-4360-a62f-203a0bbc9c5a", + "type": "TRANSFORMERS", "data": { - "id": "DF_2_NP-91929d87-cbfb-430e-b5ac-78ee01dba01d", + "id": "DF_2_NP-84475e8e-a8be-4360-a62f-203a0bbc9c5a", "label": "DF 2 NP", "func": "DF_2_NP", - "type": "TYPE_CASTING", + "type": "TRANSFORMERS", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", "type": "DataFrame", - "multiple": false + "multiple": false, + "desc": null } ], "outputs": [ { "name": "default", "id": "default", - "type": "Any" + "type": "Matrix", + "desc": "Converted dataframe value from the input" } ], "path": "PYTHON/nodes/TRANSFORMERS/TYPE_CASTING/DF_2_NP/DF_2_NP.py", "selected": false }, "position": { - "x": 260.1411269778855, - "y": 160.46643712153627 + "x": -339.59500425249286, + "y": 148.88869515224056 }, "selected": false, "positionAbsolute": { - "x": 260.1411269778855, - "y": 160.46643712153627 + "x": -339.59500425249286, + "y": 148.88869515224056 }, "dragging": true }, { "width": 225, "height": 226, - "id": "LINE-fb139689-2bc4-4fbe-853a-46c9a65d0ec2", - "type": "PLOTLY", + "id": "LINE-d6eebd8f-1c5a-4565-a07c-8591d0dc0464", + "type": "VISUALIZERS", "data": { - "id": "LINE-fb139689-2bc4-4fbe-853a-46c9a65d0ec2", + "id": "LINE-d6eebd8f-1c5a-4565-a07c-8591d0dc0464", "label": "LINE", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", - "type": "OrderedPair|Matrix|DataFrame", - "multiple": false + "type": "OrderedPair|DataFrame|Matrix", + "multiple": false, + "desc": null } ], "outputs": [ { "name": "default", "id": "default", - "type": "Plotly" + "type": "Plotly", + "desc": null } ], "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/LINE/LINE.py", "selected": false }, "position": { - "x": 597.7981862927004, - "y": 121.3471798684717 + "x": -126.6228737751659, + "y": 118.07746381818538 }, "selected": false, "positionAbsolute": { - "x": 597.7981862927004, - "y": 121.3471798684717 + "x": -126.6228737751659, + "y": 118.07746381818538 }, "dragging": true }, { - "width": 210, - "height": 130, - "id": "END-c6bc9629-bc58-4bbd-80da-204aaa449eea", - "type": "TERMINATORS", + "width": 225, + "height": 226, + "id": "LINE-871ab113-ab85-4c34-af5e-53037f3bebd1", + "type": "VISUALIZERS", "data": { - "id": "END-c6bc9629-bc58-4bbd-80da-204aaa449eea", - "label": "END", - "func": "END", - "type": "TERMINATORS", + "id": "LINE-871ab113-ab85-4c34-af5e-53037f3bebd1", + "label": "LINE 1", + "func": "LINE", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", - "type": "Any", - "multiple": false + "type": "OrderedPair|DataFrame|Matrix", + "multiple": false, + "desc": null } ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": null + } + ], + "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/LINE/LINE.py", "selected": false }, "position": { - "x": 965.378096229007, - "y": 169.1651959796751 + "x": -299.7005389975791, + "y": -152.8117053854877 }, "selected": false, "positionAbsolute": { - "x": 965.378096229007, - "y": 169.1651959796751 + "x": -299.7005389975791, + "y": -152.8117053854877 }, "dragging": true } ], "edges": [ { - "source": "R_DATASET-2cbb8a61-2c9a-4ad1-aa30-531be333cdf7", + "source": "R_DATASET-b9a3532b-7924-41b5-b7a3-3b2f26342f57", "sourceHandle": "default", - "target": "DF_2_NP-91929d87-cbfb-430e-b5ac-78ee01dba01d", + "target": "DF_2_NP-84475e8e-a8be-4360-a62f-203a0bbc9c5a", "targetHandle": "default", - "id": "reactflow__edge-R_DATASET-2cbb8a61-2c9a-4ad1-aa30-531be333cdf7default-DF_2_NP-91929d87-cbfb-430e-b5ac-78ee01dba01ddefault" + "id": "reactflow__edge-R_DATASET-b9a3532b-7924-41b5-b7a3-3b2f26342f57default-DF_2_NP-84475e8e-a8be-4360-a62f-203a0bbc9c5adefault" }, { - "source": "DF_2_NP-91929d87-cbfb-430e-b5ac-78ee01dba01d", + "source": "R_DATASET-b9a3532b-7924-41b5-b7a3-3b2f26342f57", "sourceHandle": "default", - "target": "LINE-fb139689-2bc4-4fbe-853a-46c9a65d0ec2", + "target": "LINE-871ab113-ab85-4c34-af5e-53037f3bebd1", "targetHandle": "default", - "id": "reactflow__edge-DF_2_NP-91929d87-cbfb-430e-b5ac-78ee01dba01ddefault-LINE-fb139689-2bc4-4fbe-853a-46c9a65d0ec2default" + "id": "reactflow__edge-R_DATASET-b9a3532b-7924-41b5-b7a3-3b2f26342f57default-LINE-871ab113-ab85-4c34-af5e-53037f3bebd1default" }, { - "source": "LINE-fb139689-2bc4-4fbe-853a-46c9a65d0ec2", + "source": "DF_2_NP-84475e8e-a8be-4360-a62f-203a0bbc9c5a", "sourceHandle": "default", - "target": "END-c6bc9629-bc58-4bbd-80da-204aaa449eea", + "target": "LINE-d6eebd8f-1c5a-4565-a07c-8591d0dc0464", "targetHandle": "default", - "id": "reactflow__edge-LINE-fb139689-2bc4-4fbe-853a-46c9a65d0ec2default-END-c6bc9629-bc58-4bbd-80da-204aaa449eeadefault" + "id": "reactflow__edge-DF_2_NP-84475e8e-a8be-4360-a62f-203a0bbc9c5adefault-LINE-d6eebd8f-1c5a-4565-a07c-8591d0dc0464default" } ], "viewport": { - "x": 0, - "y": 0, - "zoom": 1 + "x": 722.5478564221319, + "y": 307.5775746454569, + "zoom": 1.204238868134965 } }, "ctrlsManifest": [ diff --git a/docs/nodes/TRANSFORMERS/TYPE_CASTING/DF_2_NP/examples/EX1/example.md b/docs/nodes/TRANSFORMERS/TYPE_CASTING/DF_2_NP/examples/EX1/example.md index e34f51f66c..93bc2b6d9b 100644 --- a/docs/nodes/TRANSFORMERS/TYPE_CASTING/DF_2_NP/examples/EX1/example.md +++ b/docs/nodes/TRANSFORMERS/TYPE_CASTING/DF_2_NP/examples/EX1/example.md @@ -1,5 +1,7 @@ -In this example, `R_DATASET` generates a `dataframe` type data. +In this example we use the `R_DATASET` node to generate a dataframe with the airquality string in the parameter of the node. -This `dataframe` type data is then passed to the `DF_2_NP` node, which converts its type to `np.ndarray`. +With the top `LINE` node we see the input data where each line of a different color represent the evolution of a column as we go through its rows. -Finally, this array is the input of `LINE` visualizer and plots its data. \ No newline at end of file +Then we use the `DF_2_NP` node to convert the input data from the dataframe type to the numpy array type. + +With the bottom `LINE` node we can see the output data of `DF_2_NP`. In this graph we see a lot more of lines since each line is representing the evolution of each row as we go through its columns. We can also observe this by observing that the amount of different lines in the previous `LINE` node is 6 (so column 0 to 5), exacty like the axis we have here going from 0 to 5. This shows that our output data is a numpy array as expected. diff --git a/docs/nodes/TRANSFORMERS/TYPE_CASTING/DF_2_NP/examples/EX1/output.jpeg b/docs/nodes/TRANSFORMERS/TYPE_CASTING/DF_2_NP/examples/EX1/output.jpeg index 626482f69b..c00b28854c 100644 Binary files a/docs/nodes/TRANSFORMERS/TYPE_CASTING/DF_2_NP/examples/EX1/output.jpeg and b/docs/nodes/TRANSFORMERS/TYPE_CASTING/DF_2_NP/examples/EX1/output.jpeg differ diff --git a/docs/nodes/TRANSFORMERS/TYPE_CASTING/DF_2_ORDEREDTRIPLE/examples/EX1/app.txt b/docs/nodes/TRANSFORMERS/TYPE_CASTING/DF_2_ORDEREDTRIPLE/examples/EX1/app.txt index 731c69eca8..5c18533fd3 100644 --- a/docs/nodes/TRANSFORMERS/TYPE_CASTING/DF_2_ORDEREDTRIPLE/examples/EX1/app.txt +++ b/docs/nodes/TRANSFORMERS/TYPE_CASTING/DF_2_ORDEREDTRIPLE/examples/EX1/app.txt @@ -2,77 +2,15 @@ "rfInstance": { "nodes": [ { - "width": 150, - "height": 150, - "id": "DF_2_OrderedTriple-a34a4728-2487-42d4-ab16-527e1c885efd", - "type": "TYPE_CASTING", - "data": { - "id": "DF_2_OrderedTriple-a34a4728-2487-42d4-ab16-527e1c885efd", - "label": "DF 2 OrderedTriple", - "func": "DF_2_OrderedTriple", - "type": "TYPE_CASTING", - "ctrls": { - "x": { - "type": "int", - "default": 0, - "functionName": "DF_2_OrderedTriple", - "param": "x", - "value": 0 - }, - "y": { - "type": "int", - "default": 1, - "functionName": "DF_2_OrderedTriple", - "param": "y", - "value": 1 - }, - "z": { - "type": "int", - "default": 2, - "functionName": "DF_2_OrderedTriple", - "param": "z", - "value": 2 - } - }, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "DataFrame", - "multiple": false - } - ], - "outputs": [ - { - "name": "default", - "id": "default", - "type": "OrderedTriple" - } - ], - "path": "PYTHON/nodes/TRANSFORMERS/TYPE_CASTING/DF_2_OrderedTriple/DF_2_OrderedTriple.py", - "selected": false - }, - "position": { - "x": 11.73890776878801, - "y": 2.129479163344058 - }, - "selected": false, - "positionAbsolute": { - "x": 11.73890776878801, - "y": 2.129479163344058 - }, - "dragging": true - }, - { - "width": 150, - "height": 150, + "width": 208, + "height": 96, "id": "R_DATASET-05d7349e-095e-4a58-9ac2-d019c8abcbae", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "data": { "id": "R_DATASET-05d7349e-095e-4a58-9ac2-d019c8abcbae", "label": "R DATASET", "func": "R_DATASET", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "ctrls": { "dataset_key": { "type": "select", @@ -182,59 +120,66 @@ "selected": false }, "position": { - "x": -311.30749516825614, - "y": 86.42521712412974 + "x": -338.7711900770852, + "y": 194.3183042659582 }, "selected": false, "positionAbsolute": { - "x": -311.30749516825614, - "y": 86.42521712412974 + "x": -338.7711900770852, + "y": 194.3183042659582 }, "dragging": true }, { - "width": 210, - "height": 130, - "id": "END-5411f5bc-440c-40ba-876a-a2b4fbe10c63", - "type": "TERMINATORS", + "width": 380, + "height": 293, + "id": "TABLE-a1a64ba2-624d-4309-a3a6-581e496644a7", + "type": "VISUALIZERS", "data": { - "id": "END-5411f5bc-440c-40ba-876a-a2b4fbe10c63", - "label": "END", - "func": "END", - "type": "TERMINATORS", + "id": "TABLE-a1a64ba2-624d-4309-a3a6-581e496644a7", + "label": "TABLE 1", + "func": "TABLE", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", - "type": "Any", + "type": "OrderedTriple|OrderedPair|DataFrame", "multiple": false } ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": true + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly" + } + ], + "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/TABLE/TABLE.py", + "selected": false }, "position": { - "x": 561.373875499122, - "y": 358.4341695187829 + "x": 358.1790032359889, + "y": 27.327589114130035 }, - "selected": true, + "selected": false, "positionAbsolute": { - "x": 561.373875499122, - "y": 358.4341695187829 + "x": 358.1790032359889, + "y": 27.327589114130035 }, "dragging": true }, { - "width": 225, - "height": 226, - "id": "TABLE-a1a64ba2-624d-4309-a3a6-581e496644a7", - "type": "PLOTLY", + "width": 380, + "height": 293, + "id": "TABLE-cb2c9e6a-e220-470e-a206-eda1820f9aa3", + "type": "VISUALIZERS", "data": { - "id": "TABLE-a1a64ba2-624d-4309-a3a6-581e496644a7", + "id": "TABLE-cb2c9e6a-e220-470e-a206-eda1820f9aa3", "label": "TABLE 1", "func": "TABLE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -255,53 +200,80 @@ "selected": false }, "position": { - "x": 358.1790032359889, - "y": 27.327589114130035 + "x": -8.207108311715444, + "y": 293.30295471921596 }, "selected": false, "positionAbsolute": { - "x": 358.1790032359889, - "y": 27.327589114130035 + "x": -8.207108311715444, + "y": 293.30295471921596 }, "dragging": true }, { - "width": 225, - "height": 226, - "id": "TABLE-cb2c9e6a-e220-470e-a206-eda1820f9aa3", - "type": "PLOTLY", + "width": 160, + "height": 160, + "id": "DF_2_ORDEREDTRIPLE-62a7516d-96b6-4546-8fb2-f0f8a538930a", + "type": "TRANSFORMERS", "data": { - "id": "TABLE-cb2c9e6a-e220-470e-a206-eda1820f9aa3", - "label": "TABLE 1", - "func": "TABLE", - "type": "PLOTLY", - "ctrls": {}, + "id": "DF_2_ORDEREDTRIPLE-62a7516d-96b6-4546-8fb2-f0f8a538930a", + "label": "DF 2 ORDEREDTRIPLE", + "func": "DF_2_ORDEREDTRIPLE", + "type": "TRANSFORMERS", + "ctrls": { + "x": { + "type": "int", + "default": 0, + "desc": null, + "functionName": "DF_2_ORDEREDTRIPLE", + "param": "x", + "value": 0 + }, + "y": { + "type": "int", + "default": 1, + "desc": null, + "functionName": "DF_2_ORDEREDTRIPLE", + "param": "y", + "value": 1 + }, + "z": { + "type": "int", + "default": 2, + "desc": null, + "functionName": "DF_2_ORDEREDTRIPLE", + "param": "z", + "value": 2 + } + }, "inputs": [ { "name": "default", "id": "default", - "type": "OrderedTriple|OrderedPair|DataFrame", - "multiple": false + "type": "DataFrame", + "multiple": false, + "desc": null } ], "outputs": [ { "name": "default", "id": "default", - "type": "Plotly" + "type": "OrderedTriple", + "desc": null } ], - "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/TABLE/TABLE.py", + "path": "PYTHON/nodes\\TRANSFORMERS\\TYPE_CASTING\\DF_2_ORDEREDTRIPLE\\DF_2_ORDEREDTRIPLE.py", "selected": false }, "position": { - "x": 1.6013541557234987, - "y": 332.53680458897173 + "x": 22.290347003831585, + "y": 63.93602572915705 }, "selected": false, "positionAbsolute": { - "x": 1.6013541557234987, - "y": 332.53680458897173 + "x": 22.290347003831585, + "y": 63.93602572915705 }, "dragging": true } @@ -310,43 +282,29 @@ { "source": "R_DATASET-05d7349e-095e-4a58-9ac2-d019c8abcbae", "sourceHandle": "default", - "target": "DF_2_OrderedTriple-a34a4728-2487-42d4-ab16-527e1c885efd", - "targetHandle": "default", - "id": "reactflow__edge-R_DATASET-05d7349e-095e-4a58-9ac2-d019c8abcbaedefault-DF_2_OrderedTriple-a34a4728-2487-42d4-ab16-527e1c885efddefault" - }, - { - "source": "DF_2_OrderedTriple-a34a4728-2487-42d4-ab16-527e1c885efd", - "sourceHandle": "default", - "target": "TABLE-a1a64ba2-624d-4309-a3a6-581e496644a7", - "targetHandle": "default", - "id": "reactflow__edge-DF_2_OrderedTriple-a34a4728-2487-42d4-ab16-527e1c885efddefault-TABLE-a1a64ba2-624d-4309-a3a6-581e496644a7default" - }, - { - "source": "TABLE-a1a64ba2-624d-4309-a3a6-581e496644a7", - "sourceHandle": "default", - "target": "END-5411f5bc-440c-40ba-876a-a2b4fbe10c63", + "target": "TABLE-cb2c9e6a-e220-470e-a206-eda1820f9aa3", "targetHandle": "default", - "id": "reactflow__edge-TABLE-a1a64ba2-624d-4309-a3a6-581e496644a7default-END-5411f5bc-440c-40ba-876a-a2b4fbe10c63default" + "id": "reactflow__edge-R_DATASET-05d7349e-095e-4a58-9ac2-d019c8abcbaedefault-TABLE-cb2c9e6a-e220-470e-a206-eda1820f9aa3default" }, { "source": "R_DATASET-05d7349e-095e-4a58-9ac2-d019c8abcbae", "sourceHandle": "default", - "target": "TABLE-cb2c9e6a-e220-470e-a206-eda1820f9aa3", + "target": "DF_2_ORDEREDTRIPLE-62a7516d-96b6-4546-8fb2-f0f8a538930a", "targetHandle": "default", - "id": "reactflow__edge-R_DATASET-05d7349e-095e-4a58-9ac2-d019c8abcbaedefault-TABLE-cb2c9e6a-e220-470e-a206-eda1820f9aa3default" + "id": "reactflow__edge-R_DATASET-05d7349e-095e-4a58-9ac2-d019c8abcbaedefault-DF_2_ORDEREDTRIPLE-62a7516d-96b6-4546-8fb2-f0f8a538930adefault" }, { - "source": "TABLE-cb2c9e6a-e220-470e-a206-eda1820f9aa3", + "source": "DF_2_ORDEREDTRIPLE-62a7516d-96b6-4546-8fb2-f0f8a538930a", "sourceHandle": "default", - "target": "END-5411f5bc-440c-40ba-876a-a2b4fbe10c63", + "target": "TABLE-a1a64ba2-624d-4309-a3a6-581e496644a7", "targetHandle": "default", - "id": "reactflow__edge-TABLE-cb2c9e6a-e220-470e-a206-eda1820f9aa3default-END-5411f5bc-440c-40ba-876a-a2b4fbe10c63default" + "id": "reactflow__edge-DF_2_ORDEREDTRIPLE-62a7516d-96b6-4546-8fb2-f0f8a538930adefault-TABLE-a1a64ba2-624d-4309-a3a6-581e496644a7default" } ], "viewport": { - "x": -454.16852149654983, - "y": 260.7534565927997, - "zoom": 1.3401466962340274 + "x": 606.4472645567363, + "y": 234.63130388602087, + "zoom": 0.9186369849831518 } }, "ctrlsManifest": [ diff --git a/docs/nodes/TRANSFORMERS/TYPE_CASTING/MAT_2_DF/examples/EX1/app.jpeg b/docs/nodes/TRANSFORMERS/TYPE_CASTING/MAT_2_DF/examples/EX1/app.jpeg index b3f50d1e61..3139ed345c 100644 Binary files a/docs/nodes/TRANSFORMERS/TYPE_CASTING/MAT_2_DF/examples/EX1/app.jpeg and b/docs/nodes/TRANSFORMERS/TYPE_CASTING/MAT_2_DF/examples/EX1/app.jpeg differ diff --git a/docs/nodes/TRANSFORMERS/TYPE_CASTING/MAT_2_DF/examples/EX1/app.txt b/docs/nodes/TRANSFORMERS/TYPE_CASTING/MAT_2_DF/examples/EX1/app.txt index f905d7282a..413c94059d 100644 --- a/docs/nodes/TRANSFORMERS/TYPE_CASTING/MAT_2_DF/examples/EX1/app.txt +++ b/docs/nodes/TRANSFORMERS/TYPE_CASTING/MAT_2_DF/examples/EX1/app.txt @@ -2,193 +2,209 @@ "rfInstance": { "nodes": [ { - "width": 130, - "height": 130, - "id": "MATRIX-ec259036-e37b-4671-8a8d-d684584ffbb2", - "type": "SIMULATIONS", + "width": 150, + "height": 180, + "id": "MATRIX-e3ed97a3-2b6e-4ece-908e-f48e0de4ab79", + "type": "default", "data": { - "id": "MATRIX-ec259036-e37b-4671-8a8d-d684584ffbb2", + "id": "MATRIX-e3ed97a3-2b6e-4ece-908e-f48e0de4ab79", "label": "MATRIX", "func": "MATRIX", - "type": "SIMULATIONS", + "type": "default", "ctrls": { "row": { "type": "int", "default": 2, + "desc": "number of rows", "functionName": "MATRIX", "param": "row", - "value": 2 + "value": "9" }, "column": { "type": "int", "default": 2, + "desc": "number of columns", "functionName": "MATRIX", "param": "column", - "value": 2 + "value": "3" } }, "outputs": [ { "name": "default", "id": "default", - "type": "Matrix" + "type": "Matrix", + "desc": "randomly generated matrix" } ], "path": "PYTHON/nodes/GENERATORS/SIMULATIONS/MATRIX/MATRIX.py", "selected": false }, "position": { - "x": 188.5633762135401, - "y": 349.2164179190142 + "x": -225.25714376309378, + "y": 153.73794751935753 }, "selected": false, "positionAbsolute": { - "x": 188.5633762135401, - "y": 349.2164179190142 + "x": -225.25714376309378, + "y": 153.73794751935753 }, "dragging": true }, { - "width": 225, - "height": 226, - "id": "LINE-a0ba433b-38d5-4456-820c-b1e3913bb89c", - "type": "PLOTLY", + "width": 160, + "height": 160, + "id": "MAT_2_DF-e3f15cc1-ec37-40ea-94be-1e3409ef0671", + "type": "TRANSFORMERS", "data": { - "id": "LINE-a0ba433b-38d5-4456-820c-b1e3913bb89c", - "label": "LINE", - "func": "LINE", - "type": "PLOTLY", + "id": "MAT_2_DF-e3f15cc1-ec37-40ea-94be-1e3409ef0671", + "label": "MAT 2 DF", + "func": "MAT_2_DF", + "type": "TRANSFORMERS", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", - "type": "OrderedPair|Matrix|DataFrame", - "multiple": false + "type": "Matrix", + "multiple": false, + "desc": null } ], "outputs": [ { "name": "default", "id": "default", - "type": "Plotly" + "type": "DataFrame", + "desc": "Converted matrix value from the input" } ], - "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/LINE/LINE.py", + "path": "PYTHON/nodes/TRANSFORMERS/TYPE_CASTING/MAT_2_DF/MAT_2_DF.py", "selected": false }, "position": { - "x": 713.7881635025728, - "y": 299.452799447683 + "x": -4.4360226148176025, + "y": 326.1357946190215 }, "selected": false, "positionAbsolute": { - "x": 713.7881635025728, - "y": 299.452799447683 + "x": -4.4360226148176025, + "y": 326.1357946190215 }, "dragging": true }, { - "width": 210, - "height": 130, - "id": "END-bdf9cd08-3bdf-4f93-ae2d-bc843ac59ef6", - "type": "TERMINATORS", + "width": 380, + "height": 293, + "id": "LINE-e4276e11-5fd7-4aa5-a357-9a3b7c57abab", + "type": "VISUALIZERS", "data": { - "id": "END-bdf9cd08-3bdf-4f93-ae2d-bc843ac59ef6", - "label": "END", - "func": "END", - "type": "TERMINATORS", + "id": "LINE-e4276e11-5fd7-4aa5-a357-9a3b7c57abab", + "label": "LINE", + "func": "LINE", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", - "type": "Any", - "multiple": false + "type": "OrderedPair|DataFrame|Matrix", + "multiple": false, + "desc": null } ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": true + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": null + } + ], + "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/LINE/LINE.py", + "selected": false }, "position": { - "x": 1160.9517006157112, - "y": 359.447100902452 + "x": 259.70014602948754, + "y": 315.13027092154357 }, - "selected": true, + "selected": false, "positionAbsolute": { - "x": 1160.9517006157112, - "y": 359.447100902452 + "x": 259.70014602948754, + "y": 315.13027092154357 }, "dragging": true }, { - "width": 150, - "height": 150, - "id": "MAT_2_DF-b47f36ab-ee94-4b8a-9f26-6cd00c8a299d", - "type": "TYPE_CASTING", + "width": 380, + "height": 293, + "id": "LINE-1effbf12-03cc-40ec-bc5f-22c7954a3abe", + "type": "VISUALIZERS", "data": { - "id": "MAT_2_DF-b47f36ab-ee94-4b8a-9f26-6cd00c8a299d", - "label": "MAT 2 DF", - "func": "MAT_2_DF", - "type": "TYPE_CASTING", + "id": "LINE-1effbf12-03cc-40ec-bc5f-22c7954a3abe", + "label": "LINE 1", + "func": "LINE", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", - "type": "Matrix", - "multiple": false + "type": "OrderedPair|DataFrame|Matrix", + "multiple": false, + "desc": null } ], "outputs": [ { "name": "default", "id": "default", - "type": "DataFrame" + "type": "Plotly", + "desc": null } ], - "path": "PYTHON/nodes/TRANSFORMERS/TYPE_CASTING/MAT_2_DF/MAT_2_DF.py", + "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/LINE/LINE.py", "selected": false }, "position": { - "x": 411.8143678232408, - "y": 339.92513337331167 + "x": 52.20363423768484, + "y": 16.739781481728016 }, "selected": false, "positionAbsolute": { - "x": 411.8143678232408, - "y": 339.92513337331167 + "x": 52.20363423768484, + "y": 16.739781481728016 }, "dragging": true } ], "edges": [ { - "source": "LINE-a0ba433b-38d5-4456-820c-b1e3913bb89c", + "source": "MATRIX-e3ed97a3-2b6e-4ece-908e-f48e0de4ab79", "sourceHandle": "default", - "target": "END-bdf9cd08-3bdf-4f93-ae2d-bc843ac59ef6", + "target": "MAT_2_DF-e3f15cc1-ec37-40ea-94be-1e3409ef0671", "targetHandle": "default", - "id": "reactflow__edge-LINE-a0ba433b-38d5-4456-820c-b1e3913bb89cdefault-END-bdf9cd08-3bdf-4f93-ae2d-bc843ac59ef6default" + "id": "reactflow__edge-MATRIX-e3ed97a3-2b6e-4ece-908e-f48e0de4ab79default-MAT_2_DF-e3f15cc1-ec37-40ea-94be-1e3409ef0671default" }, { - "source": "MATRIX-ec259036-e37b-4671-8a8d-d684584ffbb2", + "source": "MATRIX-e3ed97a3-2b6e-4ece-908e-f48e0de4ab79", "sourceHandle": "default", - "target": "MAT_2_DF-b47f36ab-ee94-4b8a-9f26-6cd00c8a299d", + "target": "LINE-1effbf12-03cc-40ec-bc5f-22c7954a3abe", "targetHandle": "default", - "id": "reactflow__edge-MATRIX-ec259036-e37b-4671-8a8d-d684584ffbb2default-MAT_2_DF-b47f36ab-ee94-4b8a-9f26-6cd00c8a299ddefault" + "id": "reactflow__edge-MATRIX-e3ed97a3-2b6e-4ece-908e-f48e0de4ab79default-LINE-1effbf12-03cc-40ec-bc5f-22c7954a3abedefault" }, { - "source": "MAT_2_DF-b47f36ab-ee94-4b8a-9f26-6cd00c8a299d", + "source": "MAT_2_DF-e3f15cc1-ec37-40ea-94be-1e3409ef0671", "sourceHandle": "default", - "target": "LINE-a0ba433b-38d5-4456-820c-b1e3913bb89c", + "target": "LINE-e4276e11-5fd7-4aa5-a357-9a3b7c57abab", "targetHandle": "default", - "id": "reactflow__edge-MAT_2_DF-b47f36ab-ee94-4b8a-9f26-6cd00c8a299ddefault-LINE-a0ba433b-38d5-4456-820c-b1e3913bb89cdefault" + "id": "reactflow__edge-MAT_2_DF-e3f15cc1-ec37-40ea-94be-1e3409ef0671default-LINE-e4276e11-5fd7-4aa5-a357-9a3b7c57ababdefault" } ], "viewport": { - "x": 0, - "y": 0, - "zoom": 1 + "x": 606.4472645567363, + "y": 234.63130388602087, + "zoom": 0.9186369849831518 } }, "ctrlsManifest": [ diff --git a/docs/nodes/TRANSFORMERS/TYPE_CASTING/MAT_2_DF/examples/EX1/example.md b/docs/nodes/TRANSFORMERS/TYPE_CASTING/MAT_2_DF/examples/EX1/example.md index 996c5a18aa..38dd29c741 100644 --- a/docs/nodes/TRANSFORMERS/TYPE_CASTING/MAT_2_DF/examples/EX1/example.md +++ b/docs/nodes/TRANSFORMERS/TYPE_CASTING/MAT_2_DF/examples/EX1/example.md @@ -1,3 +1,7 @@ -In this example, `MAT_2_DF` node gets an array `[[1],[2],[3]]` as an input. +In this example we use the `MATRIX` node to generate a matrix with 9 rows and 3 columns in the parameters. -This array is converted into `dataframe` type and plots its data. \ No newline at end of file +With the top `LINE` node we can see the matrix representation in which each of the 9 colored lines represent one of the row of the matrix and it's value at each column. + +Then we use the `MAT_2_DF` node to convert the input array from matrix type to a dataframe type. + +With the bottom `LINE` node we can see the output array of `MAT_2_DF`. In this graph we can only see 3 lines of different colors since it's showing the evolution of the 3 columns as we go through their rows which is as expected from a dataframe type of data. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/TYPE_CASTING/MAT_2_DF/examples/EX1/output.jpeg b/docs/nodes/TRANSFORMERS/TYPE_CASTING/MAT_2_DF/examples/EX1/output.jpeg index 81beb8dd01..44f7a2718e 100644 Binary files a/docs/nodes/TRANSFORMERS/TYPE_CASTING/MAT_2_DF/examples/EX1/output.jpeg and b/docs/nodes/TRANSFORMERS/TYPE_CASTING/MAT_2_DF/examples/EX1/output.jpeg differ diff --git a/docs/nodes/TRANSFORMERS/TYPE_CASTING/NP_2_DF/examples/EX1/app.jpeg b/docs/nodes/TRANSFORMERS/TYPE_CASTING/NP_2_DF/examples/EX1/app.jpeg index 1d438bd052..f012e4d047 100644 Binary files a/docs/nodes/TRANSFORMERS/TYPE_CASTING/NP_2_DF/examples/EX1/app.jpeg and b/docs/nodes/TRANSFORMERS/TYPE_CASTING/NP_2_DF/examples/EX1/app.jpeg differ diff --git a/docs/nodes/TRANSFORMERS/TYPE_CASTING/NP_2_DF/examples/EX1/app.txt b/docs/nodes/TRANSFORMERS/TYPE_CASTING/NP_2_DF/examples/EX1/app.txt index 5831e6419a..199cb34543 100644 --- a/docs/nodes/TRANSFORMERS/TYPE_CASTING/NP_2_DF/examples/EX1/app.txt +++ b/docs/nodes/TRANSFORMERS/TYPE_CASTING/NP_2_DF/examples/EX1/app.txt @@ -1,232 +1,354 @@ { "rfInstance": { "nodes": [ + { + "width": 160, + "height": 160, + "id": "NP_2_DF-11220119-eee5-4a20-8c9b-3875433e658c", + "type": "TRANSFORMERS", + "data": { + "id": "NP_2_DF-11220119-eee5-4a20-8c9b-3875433e658c", + "label": "NP 2 DF", + "func": "NP_2_DF", + "type": "TRANSFORMERS", + "ctrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Any", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "DataFrame", + "desc": "Converted numpy array value from the input" + } + ], + "path": "PYTHON/nodes/TRANSFORMERS/TYPE_CASTING/NP_2_DF/NP_2_DF.py", + "selected": false + }, + "position": { + "x": -571.2328272838067, + "y": 487.3807469451905 + }, + "selected": false, + "positionAbsolute": { + "x": -571.2328272838067, + "y": 487.3807469451905 + }, + "dragging": true + }, { "width": 150, - "height": 150, - "id": "SKLEARNIMAGE-e736d6fb-7e8e-41cd-87d3-a4f10d5f70c3", - "type": "SAMPLE_IMAGES", + "height": 180, + "id": "BASIC_OSCILLATOR-34b2dbb6-c35c-4109-8281-d763fb03a2e5", + "type": "default", "data": { - "id": "SKLEARNIMAGE-e736d6fb-7e8e-41cd-87d3-a4f10d5f70c3", - "label": "SKLEARNIMAGE", - "func": "SKLEARNIMAGE", - "type": "SAMPLE_IMAGES", + "id": "BASIC_OSCILLATOR-34b2dbb6-c35c-4109-8281-d763fb03a2e5", + "label": "BASIC OSCILLATOR", + "func": "BASIC_OSCILLATOR", + "type": "default", "ctrls": { - "img_key": { + "sample_rate": { + "type": "int", + "default": 100, + "desc": "How many samples taken during a second", + "functionName": "BASIC_OSCILLATOR", + "param": "sample_rate", + "value": "100" + }, + "time": { + "type": "int", + "default": 10, + "desc": "The total amount of time of the signal", + "functionName": "BASIC_OSCILLATOR", + "param": "time", + "value": 10 + }, + "waveform": { "type": "select", - "default": "astronaut", + "default": "sine", "options": [ - "astronaut", - "binary_blobs", - "brain", - "brick", - "camera", - "cat", - "cell", - "cells3d", - "checkerboard", - "chelsea", - "clock", - "coffee", - "coins", - "colorwheel", - "create_image_fetcher", - "data_dir", - "download_all", - "eagle", - "file_hash", - "grass", - "gravel", - "horse", - "hubble_deep_field", - "human_mitosis", - "image_fetcher", - "immunohistochemistry", - "kidney", - "lbp_frontal_face_cascade_filename", - "lfw_subset", - "lily", - "logo", - "microaneurysms", - "moon", - "nickel_solidification", - "page", - "protein_transport", - "retina", - "rocket", - "shepp_logan_phantom", - "skin", - "stereo_motorcycle", - "text", - "vortex" + "sine", + "square", + "triangle", + "sawtooth" ], - "functionName": "SKLEARNIMAGE", - "param": "img_key", - "value": "astronaut" + "desc": null, + "functionName": "BASIC_OSCILLATOR", + "param": "waveform", + "value": "sine" + }, + "amplitude": { + "type": "float", + "default": 1, + "desc": null, + "functionName": "BASIC_OSCILLATOR", + "param": "amplitude", + "value": 1 + }, + "frequency": { + "type": "float", + "default": 1, + "desc": null, + "functionName": "BASIC_OSCILLATOR", + "param": "frequency", + "value": 1 + }, + "offset": { + "type": "float", + "default": 0, + "desc": null, + "functionName": "BASIC_OSCILLATOR", + "param": "offset", + "value": "0" + }, + "phase": { + "type": "float", + "default": 0, + "desc": null, + "functionName": "BASIC_OSCILLATOR", + "param": "phase", + "value": "0" } }, "outputs": [ { "name": "default", "id": "default", - "type": "Image" + "type": "OrderedPair", + "desc": null } ], - "path": "PYTHON/nodes/GENERATORS/SAMPLE_IMAGES/SKLEARNIMAGE/SKLEARNIMAGE.py", + "path": "PYTHON/nodes/GENERATORS/SIMULATIONS/BASIC_OSCILLATOR/BASIC_OSCILLATOR.py", "selected": false }, "position": { - "x": -27.61189288784054, - "y": 628.4649240993438 + "x": -569.0550195828876, + "y": 203.47140926114037 }, "selected": false, "positionAbsolute": { - "x": -27.61189288784054, - "y": 628.4649240993438 + "x": -569.0550195828876, + "y": 203.47140926114037 }, "dragging": true }, { - "width": 150, - "height": 150, - "id": "NP_2_DF-11e21238-e5ea-43a3-b0c5-17d74f0e91f7", - "type": "TYPE_CASTING", + "width": 225, + "height": 226, + "id": "LINE-62e48882-7697-4c67-9e56-0b6f10152e69", + "type": "VISUALIZERS", "data": { - "id": "NP_2_DF-11e21238-e5ea-43a3-b0c5-17d74f0e91f7", - "label": "NP 2 DF", - "func": "NP_2_DF", - "type": "TYPE_CASTING", + "id": "LINE-62e48882-7697-4c67-9e56-0b6f10152e69", + "label": "LINE", + "func": "LINE", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", - "type": "DataFrame|OrderedPair|OrderedTriple|Matrix|Grayscale|Image|ParametricDataFrame|ParametricOrderedPair|ParametricOrderedTriple|ParametricImage|ParametricGrayscale|ParametricMatrix", - "multiple": false + "type": "OrderedPair|DataFrame|Matrix", + "multiple": false, + "desc": null } ], "outputs": [ { "name": "default", "id": "default", - "type": "DataFrame" + "type": "Plotly", + "desc": null } ], - "path": "PYTHON/nodes/TRANSFORMERS/TYPE_CASTING/NP_2_DF/NP_2_DF.py", + "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/LINE/LINE.py", "selected": false }, "position": { - "x": 265.58559943685066, - "y": 628.2195175487302 + "x": 20.527963094804335, + "y": 428.32209712717724 }, "selected": false, "positionAbsolute": { - "x": 265.58559943685066, - "y": 628.2195175487302 + "x": 20.527963094804335, + "y": 428.32209712717724 }, "dragging": true }, { - "width": 210, - "height": 130, - "id": "END-a85095ce-c32c-4a3f-9bfb-2ee5ef065fac", - "type": "TERMINATORS", + "width": 225, + "height": 226, + "id": "LINE-05688284-e6cc-46c5-8275-4c9748d84900", + "type": "VISUALIZERS", "data": { - "id": "END-a85095ce-c32c-4a3f-9bfb-2ee5ef065fac", - "label": "END", - "func": "END", - "type": "TERMINATORS", + "id": "LINE-05688284-e6cc-46c5-8275-4c9748d84900", + "label": "LINE 1", + "func": "LINE", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", - "type": "Any", - "multiple": false + "type": "OrderedPair|DataFrame|Matrix", + "multiple": false, + "desc": null } ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": true + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": null + } + ], + "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/LINE/LINE.py", + "selected": false }, "position": { - "x": 951.9436914911648, - "y": 637.1490759446185 + "x": 15.61839225442884, + "y": 150.47677369917045 }, - "selected": true, + "selected": false, "positionAbsolute": { - "x": 951.9436914911648, - "y": 637.1490759446185 + "x": 15.61839225442884, + "y": 150.47677369917045 }, "dragging": true }, { "width": 225, "height": 226, - "id": "TABLE-d4a76c19-a1ef-454c-b91e-4ad5765c4708", - "type": "PLOTLY", + "id": "TABLE-f888b0d5-bc24-4634-9ba2-fda9038f044e", + "type": "VISUALIZERS", "data": { - "id": "TABLE-d4a76c19-a1ef-454c-b91e-4ad5765c4708", + "id": "TABLE-f888b0d5-bc24-4634-9ba2-fda9038f044e", "label": "TABLE", "func": "TABLE", - "type": "PLOTLY", + "type": "VISUALIZERS", + "ctrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedTriple|OrderedPair|DataFrame|Matrix|Vector", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": null + } + ], + "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/TABLE/TABLE.py", + "selected": false + }, + "position": { + "x": -364.726123767692, + "y": 427.1385364736938 + }, + "selected": false, + "positionAbsolute": { + "x": -364.726123767692, + "y": 427.1385364736938 + }, + "dragging": true + }, + { + "width": 225, + "height": 226, + "id": "TABLE-8216adbc-6c2a-490a-bab9-8cf02f710e54", + "type": "VISUALIZERS", + "data": { + "id": "TABLE-8216adbc-6c2a-490a-bab9-8cf02f710e54", + "label": "TABLE 1", + "func": "TABLE", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { "name": "default", "id": "default", - "type": "OrderedTriple|OrderedPair|DataFrame", - "multiple": false + "type": "OrderedTriple|OrderedPair|DataFrame|Matrix|Vector", + "multiple": false, + "desc": null } ], "outputs": [ { "name": "default", "id": "default", - "type": "Plotly" + "type": "Plotly", + "desc": null } ], "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/TABLE/TABLE.py", "selected": false }, "position": { - "x": 559.028728533984, - "y": 586.3143567948883 + "x": -367.55298879435026, + "y": 147.1981842096718 }, "selected": false, "positionAbsolute": { - "x": 559.028728533984, - "y": 586.3143567948883 + "x": -367.55298879435026, + "y": 147.1981842096718 }, "dragging": true } ], "edges": [ { - "source": "SKLEARNIMAGE-e736d6fb-7e8e-41cd-87d3-a4f10d5f70c3", + "source": "BASIC_OSCILLATOR-34b2dbb6-c35c-4109-8281-d763fb03a2e5", + "sourceHandle": "default", + "target": "NP_2_DF-11220119-eee5-4a20-8c9b-3875433e658c", + "targetHandle": "default", + "id": "reactflow__edge-BASIC_OSCILLATOR-34b2dbb6-c35c-4109-8281-d763fb03a2e5default-NP_2_DF-11220119-eee5-4a20-8c9b-3875433e658cdefault" + }, + { + "source": "BASIC_OSCILLATOR-34b2dbb6-c35c-4109-8281-d763fb03a2e5", + "sourceHandle": "default", + "target": "TABLE-8216adbc-6c2a-490a-bab9-8cf02f710e54", + "targetHandle": "default", + "id": "reactflow__edge-BASIC_OSCILLATOR-34b2dbb6-c35c-4109-8281-d763fb03a2e5default-TABLE-8216adbc-6c2a-490a-bab9-8cf02f710e54default" + }, + { + "source": "BASIC_OSCILLATOR-34b2dbb6-c35c-4109-8281-d763fb03a2e5", "sourceHandle": "default", - "target": "NP_2_DF-11e21238-e5ea-43a3-b0c5-17d74f0e91f7", + "target": "LINE-05688284-e6cc-46c5-8275-4c9748d84900", "targetHandle": "default", - "id": "reactflow__edge-SKLEARNIMAGE-e736d6fb-7e8e-41cd-87d3-a4f10d5f70c3default-NP_2_DF-11e21238-e5ea-43a3-b0c5-17d74f0e91f7default" + "id": "reactflow__edge-BASIC_OSCILLATOR-34b2dbb6-c35c-4109-8281-d763fb03a2e5default-LINE-05688284-e6cc-46c5-8275-4c9748d84900default" }, { - "source": "NP_2_DF-11e21238-e5ea-43a3-b0c5-17d74f0e91f7", + "source": "NP_2_DF-11220119-eee5-4a20-8c9b-3875433e658c", "sourceHandle": "default", - "target": "TABLE-d4a76c19-a1ef-454c-b91e-4ad5765c4708", + "target": "TABLE-f888b0d5-bc24-4634-9ba2-fda9038f044e", "targetHandle": "default", - "id": "reactflow__edge-NP_2_DF-11e21238-e5ea-43a3-b0c5-17d74f0e91f7default-TABLE-d4a76c19-a1ef-454c-b91e-4ad5765c4708default" + "id": "reactflow__edge-NP_2_DF-11220119-eee5-4a20-8c9b-3875433e658cdefault-TABLE-f888b0d5-bc24-4634-9ba2-fda9038f044edefault" }, { - "source": "TABLE-d4a76c19-a1ef-454c-b91e-4ad5765c4708", + "source": "NP_2_DF-11220119-eee5-4a20-8c9b-3875433e658c", "sourceHandle": "default", - "target": "END-a85095ce-c32c-4a3f-9bfb-2ee5ef065fac", + "target": "LINE-62e48882-7697-4c67-9e56-0b6f10152e69", "targetHandle": "default", - "id": "reactflow__edge-TABLE-d4a76c19-a1ef-454c-b91e-4ad5765c4708default-END-a85095ce-c32c-4a3f-9bfb-2ee5ef065facdefault" + "id": "reactflow__edge-NP_2_DF-11220119-eee5-4a20-8c9b-3875433e658cdefault-LINE-62e48882-7697-4c67-9e56-0b6f10152e69default" } ], "viewport": { - "x": 0, - "y": 0, - "zoom": 1 + "x": 722.5478564221319, + "y": 307.5775746454569, + "zoom": 1.204238868134965 } }, "ctrlsManifest": [ diff --git a/docs/nodes/TRANSFORMERS/TYPE_CASTING/NP_2_DF/examples/EX1/example.md b/docs/nodes/TRANSFORMERS/TYPE_CASTING/NP_2_DF/examples/EX1/example.md index 57df6ee1f1..0c27bfbd3a 100644 --- a/docs/nodes/TRANSFORMERS/TYPE_CASTING/NP_2_DF/examples/EX1/example.md +++ b/docs/nodes/TRANSFORMERS/TYPE_CASTING/NP_2_DF/examples/EX1/example.md @@ -1,5 +1,16 @@ -In this example, `SKLEARNIMAGE` generates an array that consists of RGB colors. +In this example we use the `BASIC_OSCILLATOR` node to generate a numpy array. +The parameters of the node are set at: -This array is then passed to the `NP_2_DF` node, which stacks 3-4 different arrays into a single 2D array. +sample_rate: 100 +time: 10 +waveform: sine +amplitude: 1 +frequency: 1 +offset: 0 +phase: 0 -Finally, this array is converted to `dataframe` type and plots its data. \ No newline at end of file +With the top `TABLE` node we can see the x values representing the time when the value was taken and the y represent the values themselves. Then in the top `LINE` node we can see what the data looks like from time 0 to time 10. + +Then we use the `NP_2_DF` node to convert the input data from the numpy array type to the dataframe type. + +With the bottom `TABLE` node we can see that we now have only 1 column which is normal since with a dataframe type of data we only use the values since the time is represent by the number of the row at which the value is read in the column. We can observe this also in the bottom `LINE` node where we can seee the same data but here instead of being from time 0 to time 10 it's from 0 to 1000. This is due to the fact that we have a `sample_rate` of 100 meaning that in 1 time measure we take 100 values. Therefore having 10 times means that we have 1000 rows for the y columns. diff --git a/docs/nodes/TRANSFORMERS/TYPE_CASTING/NP_2_DF/examples/EX1/output.jpeg b/docs/nodes/TRANSFORMERS/TYPE_CASTING/NP_2_DF/examples/EX1/output.jpeg index dcd01a3595..3eb79fb11c 100644 Binary files a/docs/nodes/TRANSFORMERS/TYPE_CASTING/NP_2_DF/examples/EX1/output.jpeg and b/docs/nodes/TRANSFORMERS/TYPE_CASTING/NP_2_DF/examples/EX1/output.jpeg differ diff --git a/docs/nodes/TRANSFORMERS/TYPE_CASTING/ORDERED_TRIPLE_2_SURFACE/examples/EX1/app.txt b/docs/nodes/TRANSFORMERS/TYPE_CASTING/ORDERED_TRIPLE_2_SURFACE/examples/EX1/app.txt index cedda49aca..dff3b1510f 100644 --- a/docs/nodes/TRANSFORMERS/TYPE_CASTING/ORDERED_TRIPLE_2_SURFACE/examples/EX1/app.txt +++ b/docs/nodes/TRANSFORMERS/TYPE_CASTING/ORDERED_TRIPLE_2_SURFACE/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 150, "height": 150, "id": "PLOTLY_DATASET-5a7231e7-7fa7-480f-9562-c117499c99cd", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "data": { "id": "PLOTLY_DATASET-5a7231e7-7fa7-480f-9562-c117499c99cd", "label": "PLOTLY DATASET", "func": "PLOTLY_DATASET", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "ctrls": { "dataset_key": { "type": "select", @@ -57,12 +57,12 @@ "width": 150, "height": 150, "id": "DF_2_ORDEREDTRIPLE-c2918872-5cb8-4469-b2c7-3e2ab878d204", - "type": "TYPE_CASTING", + "type": "TRANSFORMERS", "data": { "id": "DF_2_ORDEREDTRIPLE-c2918872-5cb8-4469-b2c7-3e2ab878d204", "label": "DF 2 ORDEREDTRIPLE", "func": "DF_2_ORDEREDTRIPLE", - "type": "TYPE_CASTING", + "type": "TRANSFORMERS", "ctrls": { "x": { "type": "int", @@ -119,12 +119,12 @@ "width": 150, "height": 150, "id": "ORDERED_TRIPLE_2_SURFACE-810534da-2e75-4d23-b28a-d07602ab0cf3", - "type": "TYPE_CASTING", + "type": "TRANSFORMERS", "data": { "id": "ORDERED_TRIPLE_2_SURFACE-810534da-2e75-4d23-b28a-d07602ab0cf3", "label": "ORDERED TRIPLE 2 SURFACE", "func": "ORDERED_TRIPLE_2_SURFACE", - "type": "TYPE_CASTING", + "type": "TRANSFORMERS", "ctrls": {}, "inputs": [ { @@ -155,49 +155,16 @@ }, "dragging": true }, - { - "width": 210, - "height": 130, - "id": "END-27d70d41-6ff3-4222-9fa6-7278850d6cff", - "type": "TERMINATORS", - "data": { - "id": "END-27d70d41-6ff3-4222-9fa6-7278850d6cff", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", - "selected": false - }, - "position": { - "x": 1298.2738429101842, - "y": 160.3054054196486 - }, - "selected": false, - "positionAbsolute": { - "x": 1298.2738429101842, - "y": 160.3054054196486 - }, - "dragging": true - }, { "width": 380, "height": 293, "id": "SURFACE3D-815e6548-3e6e-4740-b240-4e61891fec60", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "SURFACE3D-815e6548-3e6e-4740-b240-4e61891fec60", "label": "SURFACE3D", "func": "SURFACE3D", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -250,13 +217,6 @@ "target": "SURFACE3D-815e6548-3e6e-4740-b240-4e61891fec60", "targetHandle": "default", "id": "reactflow__edge-ORDERED_TRIPLE_2_SURFACE-810534da-2e75-4d23-b28a-d07602ab0cf3default-SURFACE3D-815e6548-3e6e-4740-b240-4e61891fec60default" - }, - { - "source": "SURFACE3D-815e6548-3e6e-4740-b240-4e61891fec60", - "sourceHandle": "default", - "target": "END-27d70d41-6ff3-4222-9fa6-7278850d6cff", - "targetHandle": "default", - "id": "reactflow__edge-SURFACE3D-815e6548-3e6e-4740-b240-4e61891fec60default-END-27d70d41-6ff3-4222-9fa6-7278850d6cffdefault" } ], "viewport": { diff --git a/docs/nodes/VISUALIZERS/DATA_STRUCTURE/ARRAY_VIEW/a1-[autogen]/python_code.txt b/docs/nodes/VISUALIZERS/DATA_STRUCTURE/ARRAY_VIEW/a1-[autogen]/python_code.txt index a19bee1b62..007ed0a229 100644 --- a/docs/nodes/VISUALIZERS/DATA_STRUCTURE/ARRAY_VIEW/a1-[autogen]/python_code.txt +++ b/docs/nodes/VISUALIZERS/DATA_STRUCTURE/ARRAY_VIEW/a1-[autogen]/python_code.txt @@ -18,7 +18,7 @@ def numpy_array_as_table(arr: np.ndarray): return new_arr.reshape(-1, 1) -@flojoy(node_type="PLOTLY") +@flojoy def ARRAY_VIEW(default: OrderedPair | Matrix | DataFrame | Image) -> Plotly: diff --git a/docs/nodes/VISUALIZERS/DATA_STRUCTURE/ARRAY_VIEW/examples/EX1/app.txt b/docs/nodes/VISUALIZERS/DATA_STRUCTURE/ARRAY_VIEW/examples/EX1/app.txt index 91f4288aba..463ecae5c6 100644 --- a/docs/nodes/VISUALIZERS/DATA_STRUCTURE/ARRAY_VIEW/examples/EX1/app.txt +++ b/docs/nodes/VISUALIZERS/DATA_STRUCTURE/ARRAY_VIEW/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 240, "height": 260, "id": "ARRAY_VIEW-1efcd977-7ea1-4036-b70b-9e04177953f8", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "ARRAY_VIEW-1efcd977-7ea1-4036-b70b-9e04177953f8", "label": "ARRAY VIEW", "func": "ARRAY_VIEW", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -42,15 +42,15 @@ "dragging": true }, { - "width": 150, - "height": 150, + "width": 160, + "height": 160, "id": "LOCAL_FILE-6cd15e81-644c-47c3-9309-bdfb92b80322", - "type": "LOCAL_FILE_SYSTEM", + "type": "LOADERS", "data": { "id": "LOCAL_FILE-6cd15e81-644c-47c3-9309-bdfb92b80322", "label": "LOCAL FILE", "func": "LOCAL_FILE", - "type": "LOCAL_FILE_SYSTEM", + "type": "LOADERS", "ctrls": { "file_path": { "type": "str", @@ -95,59 +95,26 @@ "selected": false }, "position": { - "x": -232.3350019193849, - "y": 222.68903387760122 + "x": -226.61117729370193, + "y": 156.29266821967894 }, "selected": false, "positionAbsolute": { - "x": -232.3350019193849, - "y": 222.68903387760122 + "x": -226.61117729370193, + "y": 156.29266821967894 }, "dragging": true }, { - "width": 210, - "height": 130, - "id": "END-c4336a1c-b75f-4b7e-acda-4a6767f5fc58", - "type": "TERMINATORS", - "data": { - "id": "END-c4336a1c-b75f-4b7e-acda-4a6767f5fc58", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", - "selected": false - }, - "position": { - "x": 727.4931647979206, - "y": 308.7656577735042 - }, - "selected": false, - "positionAbsolute": { - "x": 727.4931647979206, - "y": 308.7656577735042 - }, - "dragging": true - }, - { - "width": 150, - "height": 150, + "width": 208, + "height": 96, "id": "PLOTLY_DATASET-19eba195-7482-48cc-aac0-8cc1325fe0c9", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "data": { "id": "PLOTLY_DATASET-19eba195-7482-48cc-aac0-8cc1325fe0c9", "label": "PLOTLY DATASET", "func": "PLOTLY_DATASET", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "ctrls": { "dataset_key": { "type": "select", @@ -180,80 +147,26 @@ "selected": false }, "position": { - "x": -240.06249858954502, - "y": 687.4465652665302 - }, - "selected": false, - "positionAbsolute": { - "x": -240.06249858954502, - "y": 687.4465652665302 - }, - "dragging": true - }, - { - "width": 150, - "height": 150, - "id": "LINSPACE-f5c8b478-c39a-4450-abfa-52fbc5b5177b", - "type": "default", - "data": { - "id": "LINSPACE-f5c8b478-c39a-4450-abfa-52fbc5b5177b", - "label": "LINSPACE", - "func": "LINSPACE", - "type": "default", - "ctrls": { - "start": { - "type": "float", - "default": 10, - "functionName": "LINSPACE", - "param": "start", - "value": 10 - }, - "end": { - "type": "float", - "default": 0, - "functionName": "LINSPACE", - "param": "end", - "value": 0 - }, - "step": { - "type": "int", - "default": 1000, - "functionName": "LINSPACE", - "param": "step", - "value": 1000 - } - }, - "outputs": [ - { - "name": "default", - "id": "default", - "type": "OrderedPair" - } - ], - "path": "PYTHON/nodes\\GENERATORS\\SIMULATIONS\\LINSPACE\\LINSPACE.py", - "selected": false - }, - "position": { - "x": -208.63046860299858, - "y": -16.592276921086295 + "x": -251.51014784091092, + "y": 626.774024234291 }, "selected": false, "positionAbsolute": { - "x": -208.63046860299858, - "y": -16.592276921086295 + "x": -251.51014784091092, + "y": 626.774024234291 }, "dragging": true }, { - "width": 130, - "height": 130, + "width": 208, + "height": 96, "id": "MATRIX-eb2f42c0-a990-4294-8032-45abfac569df", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "MATRIX-eb2f42c0-a990-4294-8032-45abfac569df", "label": "MATRIX", "func": "MATRIX", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "row": { "type": "int", @@ -281,53 +194,13 @@ "selected": false }, "position": { - "x": -237.60214272514102, - "y": 461.86680064131633 + "x": -251.3393218267801, + "y": 419.51049841126246 }, "selected": false, "positionAbsolute": { - "x": -237.60214272514102, - "y": 461.86680064131633 - }, - "dragging": true - }, - { - "width": 240, - "height": 260, - "id": "ARRAY_VIEW-7d78d396-398b-499b-953f-e29aa877b5cf", - "type": "PLOTLY", - "data": { - "id": "ARRAY_VIEW-7d78d396-398b-499b-953f-e29aa877b5cf", - "label": "ARRAY VIEW 1", - "func": "ARRAY_VIEW", - "type": "PLOTLY", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "OrderedPair|Matrix|DataFrame|Image", - "multiple": false - } - ], - "outputs": [ - { - "name": "default", - "id": "default", - "type": "Plotly" - } - ], - "path": "PYTHON/nodes\\VISUALIZERS\\DATA_STRUCTURE\\ARRAY_VIEW\\ARRAY_VIEW.py", - "selected": false - }, - "position": { - "x": 57.622423079275194, - "y": 1.7214033588389839 - }, - "selected": false, - "positionAbsolute": { - "x": 57.622423079275194, - "y": 1.7214033588389839 + "x": -251.3393218267801, + "y": 419.51049841126246 }, "dragging": true }, @@ -335,12 +208,12 @@ "width": 240, "height": 260, "id": "ARRAY_VIEW-111b6446-143e-43aa-83e9-3138fcdbf17b", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "ARRAY_VIEW-111b6446-143e-43aa-83e9-3138fcdbf17b", "label": "ARRAY VIEW 2", "func": "ARRAY_VIEW", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -361,13 +234,13 @@ "selected": false }, "position": { - "x": 47.984363760758214, - "y": 371.99332085303405 + "x": 50.27389361103141, + "y": 352.53231712571204 }, "selected": false, "positionAbsolute": { - "x": 47.984363760758214, - "y": 371.99332085303405 + "x": 50.27389361103141, + "y": 352.53231712571204 }, "dragging": true }, @@ -375,12 +248,12 @@ "width": 240, "height": 260, "id": "ARRAY_VIEW-6736c8e9-a710-4b14-bdd4-829e0ee961c7", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "ARRAY_VIEW-6736c8e9-a710-4b14-bdd4-829e0ee961c7", "label": "ARRAY VIEW 3", "func": "ARRAY_VIEW", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -398,16 +271,16 @@ } ], "path": "PYTHON/nodes\\VISUALIZERS\\DATA_STRUCTURE\\ARRAY_VIEW\\ARRAY_VIEW.py", - "selected": true + "selected": false }, "position": { - "x": 408.2387752517457, - "y": 553.3504390006673 + "x": 368.17200287196505, + "y": 555.6399688509405 }, - "selected": true, + "selected": false, "positionAbsolute": { - "x": 408.2387752517457, - "y": 553.3504390006673 + "x": 368.17200287196505, + "y": 555.6399688509405 }, "dragging": true } @@ -420,13 +293,6 @@ "targetHandle": "default", "id": "reactflow__edge-LOCAL_FILE-6cd15e81-644c-47c3-9309-bdfb92b80322default-ARRAY_VIEW-1efcd977-7ea1-4036-b70b-9e04177953f8default" }, - { - "source": "ARRAY_VIEW-1efcd977-7ea1-4036-b70b-9e04177953f8", - "sourceHandle": "default", - "target": "END-c4336a1c-b75f-4b7e-acda-4a6767f5fc58", - "targetHandle": "default", - "id": "reactflow__edge-ARRAY_VIEW-1efcd977-7ea1-4036-b70b-9e04177953f8default-END-c4336a1c-b75f-4b7e-acda-4a6767f5fc58default" - }, { "source": "MATRIX-eb2f42c0-a990-4294-8032-45abfac569df", "sourceHandle": "default", @@ -434,46 +300,18 @@ "targetHandle": "default", "id": "reactflow__edge-MATRIX-eb2f42c0-a990-4294-8032-45abfac569dfdefault-ARRAY_VIEW-111b6446-143e-43aa-83e9-3138fcdbf17bdefault" }, - { - "source": "ARRAY_VIEW-111b6446-143e-43aa-83e9-3138fcdbf17b", - "sourceHandle": "default", - "target": "END-c4336a1c-b75f-4b7e-acda-4a6767f5fc58", - "targetHandle": "default", - "id": "reactflow__edge-ARRAY_VIEW-111b6446-143e-43aa-83e9-3138fcdbf17bdefault-END-c4336a1c-b75f-4b7e-acda-4a6767f5fc58default" - }, { "source": "PLOTLY_DATASET-19eba195-7482-48cc-aac0-8cc1325fe0c9", "sourceHandle": "default", "target": "ARRAY_VIEW-6736c8e9-a710-4b14-bdd4-829e0ee961c7", "targetHandle": "default", "id": "reactflow__edge-PLOTLY_DATASET-19eba195-7482-48cc-aac0-8cc1325fe0c9default-ARRAY_VIEW-6736c8e9-a710-4b14-bdd4-829e0ee961c7default" - }, - { - "source": "LINSPACE-f5c8b478-c39a-4450-abfa-52fbc5b5177b", - "sourceHandle": "default", - "target": "ARRAY_VIEW-7d78d396-398b-499b-953f-e29aa877b5cf", - "targetHandle": "default", - "id": "reactflow__edge-LINSPACE-f5c8b478-c39a-4450-abfa-52fbc5b5177bdefault-ARRAY_VIEW-7d78d396-398b-499b-953f-e29aa877b5cfdefault" - }, - { - "source": "ARRAY_VIEW-7d78d396-398b-499b-953f-e29aa877b5cf", - "sourceHandle": "default", - "target": "END-c4336a1c-b75f-4b7e-acda-4a6767f5fc58", - "targetHandle": "default", - "id": "reactflow__edge-ARRAY_VIEW-7d78d396-398b-499b-953f-e29aa877b5cfdefault-END-c4336a1c-b75f-4b7e-acda-4a6767f5fc58default" - }, - { - "source": "ARRAY_VIEW-6736c8e9-a710-4b14-bdd4-829e0ee961c7", - "sourceHandle": "default", - "target": "END-c4336a1c-b75f-4b7e-acda-4a6767f5fc58", - "targetHandle": "default", - "id": "reactflow__edge-ARRAY_VIEW-6736c8e9-a710-4b14-bdd4-829e0ee961c7default-END-c4336a1c-b75f-4b7e-acda-4a6767f5fc58default" } ], "viewport": { - "x": -296.35399545928726, - "y": 66.8470830817738, - "zoom": 0.8744723800359967 + "x": 606.4472645567363, + "y": 234.63130388602087, + "zoom": 0.9186369849831518 } }, "ctrlsManifest": [ diff --git a/docs/nodes/VISUALIZERS/DATA_STRUCTURE/MATRIX_VIEW/a1-[autogen]/python_code.txt b/docs/nodes/VISUALIZERS/DATA_STRUCTURE/MATRIX_VIEW/a1-[autogen]/python_code.txt index 34193c132a..4c16dfa71a 100644 --- a/docs/nodes/VISUALIZERS/DATA_STRUCTURE/MATRIX_VIEW/a1-[autogen]/python_code.txt +++ b/docs/nodes/VISUALIZERS/DATA_STRUCTURE/MATRIX_VIEW/a1-[autogen]/python_code.txt @@ -65,7 +65,7 @@ def numpy_array_as_table(arr: DCNpArrayType): return cell_values -@flojoy(node_type="PLOTLY") +@flojoy def MATRIX_VIEW(default: OrderedPair | Matrix) -> Plotly: diff --git a/docs/nodes/VISUALIZERS/DATA_STRUCTURE/MATRIX_VIEW/examples/EX1/app.txt b/docs/nodes/VISUALIZERS/DATA_STRUCTURE/MATRIX_VIEW/examples/EX1/app.txt index 1bcdeefe2d..83474a70d9 100644 --- a/docs/nodes/VISUALIZERS/DATA_STRUCTURE/MATRIX_VIEW/examples/EX1/app.txt +++ b/docs/nodes/VISUALIZERS/DATA_STRUCTURE/MATRIX_VIEW/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 130, "height": 130, "id": "MATRIX-957da30a-8624-44d8-93fb-51ec90f92485", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "MATRIX-957da30a-8624-44d8-93fb-51ec90f92485", "label": "MATRIX", "func": "MATRIX", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "row": { "type": "int", @@ -52,12 +52,12 @@ "width": 240, "height": 260, "id": "MATRIX_VIEW-33a3d38e-93b1-4e33-9789-9f457d04498a", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "MATRIX_VIEW-33a3d38e-93b1-4e33-9789-9f457d04498a", "label": "MATRIX VIEW", "func": "MATRIX_VIEW", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -87,39 +87,6 @@ "y": 95.620522779557 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-7c8843a3-119f-4f4e-83b1-0d4e55d4cbd5", - "type": "TERMINATORS", - "data": { - "id": "END-7c8843a3-119f-4f4e-83b1-0d4e55d4cbd5", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", - "selected": false - }, - "position": { - "x": 1123.2153146260518, - "y": 164.1334864111738 - }, - "selected": false, - "positionAbsolute": { - "x": 1123.2153146260518, - "y": 164.1334864111738 - }, - "dragging": true } ], "edges": [ @@ -129,13 +96,6 @@ "target": "MATRIX_VIEW-33a3d38e-93b1-4e33-9789-9f457d04498a", "targetHandle": "default", "id": "reactflow__edge-MATRIX-957da30a-8624-44d8-93fb-51ec90f92485default-MATRIX_VIEW-33a3d38e-93b1-4e33-9789-9f457d04498adefault" - }, - { - "source": "MATRIX_VIEW-33a3d38e-93b1-4e33-9789-9f457d04498a", - "sourceHandle": "default", - "target": "END-7c8843a3-119f-4f4e-83b1-0d4e55d4cbd5", - "targetHandle": "default", - "id": "reactflow__edge-MATRIX_VIEW-33a3d38e-93b1-4e33-9789-9f457d04498adefault-END-7c8843a3-119f-4f4e-83b1-0d4e55d4cbd5default" } ], "viewport": { diff --git a/docs/nodes/VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/TEXT_VIEW.md b/docs/nodes/VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/TEXT_VIEW.md new file mode 100644 index 0000000000..13c4fd525d --- /dev/null +++ b/docs/nodes/VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/TEXT_VIEW.md @@ -0,0 +1,47 @@ + +[//]: # (Custom component imports) + +import DocString from '@site/src/components/DocString'; +import PythonCode from '@site/src/components/PythonCode'; +import AppDisplay from '@site/src/components/AppDisplay'; +import SectionBreak from '@site/src/components/SectionBreak'; +import AppendixSection from '@site/src/components/AppendixSection'; + +[//]: # (Docstring) + +import DocstringSource from '!!raw-loader!./a1-[autogen]/docstring.txt'; +import PythonSource from '!!raw-loader!./a1-[autogen]/python_code.txt'; + +{DocstringSource} +{PythonSource} + + + + + +[//]: # (Examples) + +## Examples + + + + + + + + +[//]: # (Appendix) + +import Notes from '!!raw-loader!./appendix/notes.md'; +import Hardware from '!!raw-loader!./appendix/hardware.md'; +import Media from '!!raw-loader!./appendix/media.md'; + +## Appendix + +{Notes} +{Hardware} +{Media} + + diff --git a/docs/nodes/VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/a1-[autogen]/docstring.txt b/docs/nodes/VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/a1-[autogen]/docstring.txt new file mode 100644 index 0000000000..19fe60f6e8 --- /dev/null +++ b/docs/nodes/VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/a1-[autogen]/docstring.txt @@ -0,0 +1 @@ +The TEXT_VIEW node creates a text visualization for a given TextBlob DC type. \ No newline at end of file diff --git a/docs/nodes/VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/a1-[autogen]/python_code.txt b/docs/nodes/VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/a1-[autogen]/python_code.txt new file mode 100644 index 0000000000..16cd9891c1 --- /dev/null +++ b/docs/nodes/VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/a1-[autogen]/python_code.txt @@ -0,0 +1,8 @@ +from flojoy import flojoy, TextBlob + + +@flojoy +def TEXT_VIEW(default: TextBlob): + + + return default diff --git a/docs/nodes/VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/appendix/hardware.md b/docs/nodes/VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/appendix/hardware.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/nodes/VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/appendix/media.md b/docs/nodes/VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/appendix/media.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/nodes/VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/appendix/notes.md b/docs/nodes/VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/appendix/notes.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/nodes/VISUALIZERS/PLOTLY/BAR/a1-[autogen]/docstring.txt b/docs/nodes/VISUALIZERS/PLOTLY/BAR/a1-[autogen]/docstring.txt index 3992bea656..1d809680fc 100644 --- a/docs/nodes/VISUALIZERS/PLOTLY/BAR/a1-[autogen]/docstring.txt +++ b/docs/nodes/VISUALIZERS/PLOTLY/BAR/a1-[autogen]/docstring.txt @@ -6,4 +6,4 @@ The BAR node creates a Plotly Bar visualization for a given input data container Supported DC types: ---------------- - `ordered_pair`, `dataframe` (including timeseries), `matrix` + `ordered_pair`, `dataframe` (including timeseries), `matrix`, `vector` diff --git a/docs/nodes/VISUALIZERS/PLOTLY/BAR/a1-[autogen]/python_code.txt b/docs/nodes/VISUALIZERS/PLOTLY/BAR/a1-[autogen]/python_code.txt index 6456f488ff..503cb8bb09 100644 --- a/docs/nodes/VISUALIZERS/PLOTLY/BAR/a1-[autogen]/python_code.txt +++ b/docs/nodes/VISUALIZERS/PLOTLY/BAR/a1-[autogen]/python_code.txt @@ -1,4 +1,4 @@ -from flojoy import flojoy, OrderedPair, DataFrame, Matrix, Plotly +from flojoy import flojoy, OrderedPair, DataFrame, Matrix, Plotly, Vector import plotly.graph_objects as go import pandas as pd from nodes.VISUALIZERS.template import plot_layout @@ -6,57 +6,62 @@ import numpy as np @flojoy -def BAR(default: OrderedPair | DataFrame | Matrix) -> Plotly: +def BAR(default: OrderedPair | DataFrame | Matrix | Vector) -> Plotly: layout = plot_layout(title="BAR") fig = go.Figure(layout=layout) - if isinstance(default, OrderedPair): - x = default.x - if isinstance(default.x, dict): - dict_keys = list(default.x.keys()) - x = default.x[dict_keys[0]] - y = default.y - fig.add_trace(go.Bar(x=x, y=y)) - elif isinstance(default, DataFrame): - df = default.m - first_col = df.iloc[:, 0] - is_timeseries = False - if pd.api.types.is_datetime64_any_dtype(first_col): - is_timeseries = True - if is_timeseries: - for col in df.columns: - if col != df.columns[0]: - fig.add_trace( - go.Bar( - y=df[col].values, - x=first_col, - name=col, + match default: + case OrderedPair(): + x = default.x + if isinstance(default.x, dict): + dict_keys = list(default.x.keys()) + x = default.x[dict_keys[0]] + y = default.y + fig.add_trace(go.Bar(x=x, y=y)) + case DataFrame(): + df = default.m + first_col = df.iloc[:, 0] + is_timeseries = False + if pd.api.types.is_datetime64_any_dtype(first_col): + is_timeseries = True + if is_timeseries: + for col in df.columns: + if col != df.columns[0]: + fig.add_trace( + go.Bar( + y=df[col].values, + x=first_col, + name=col, + ) ) - ) - fig.update_layout(xaxis_title=df.columns[0]) - else: - for col in df.columns: - if df[col].dtype == "object": - counts = df[col].value_counts() - fig.add_trace( - go.Bar(x=counts.index.tolist(), y=counts.tolist(), name=col) - ) - else: - fig.add_trace(go.Bar(x=df.index, y=df[col], name=col)) - fig.update_layout(xaxis_title="DF index", yaxis_title="Y Axis") - - else: - m = default.m - - num_rows, num_cols = m.shape - - x_ticks = np.arange(num_cols) - - for i in range(num_rows): - fig.add_trace(go.Bar(x=x_ticks, y=m[i, :], name=f"Row {i+1}")) - - fig.update_layout(xaxis_title="Column", yaxis_title="Value") + fig.update_layout(xaxis_title=df.columns[0]) + else: + for col in df.columns: + if df[col].dtype == "object": + counts = df[col].value_counts() + fig.add_trace( + go.Bar(x=counts.index.tolist(), y=counts.tolist(), name=col) + ) + else: + fig.add_trace(go.Bar(x=df.index, y=df[col], name=col)) + fig.update_layout(xaxis_title="DF index", yaxis_title="Y Axis") + + case Matrix(): + m = default.m + + num_rows, num_cols = m.shape + + x_ticks = np.arange(num_cols) + + for i in range(num_rows): + fig.add_trace(go.Bar(x=x_ticks, y=m[i, :], name=f"Row {i+1}")) + + fig.update_layout(xaxis_title="Column", yaxis_title="Value") + case Vector(): + y = default.v + x = np.arange(len(y)) + fig.add_trace(go.Bar(x=x, y=y)) return Plotly(fig=fig) diff --git a/docs/nodes/VISUALIZERS/PLOTLY/BAR/examples/EX1/app.txt b/docs/nodes/VISUALIZERS/PLOTLY/BAR/examples/EX1/app.txt index aff15a66b8..4e4ae1543e 100644 --- a/docs/nodes/VISUALIZERS/PLOTLY/BAR/examples/EX1/app.txt +++ b/docs/nodes/VISUALIZERS/PLOTLY/BAR/examples/EX1/app.txt @@ -2,69 +2,15 @@ "rfInstance": { "nodes": [ { - "width": 150, - "height": 150, - "id": "LINSPACE-ec927a55-840d-4e1d-bfe3-7069d35eaca5", - "type": "default", - "data": { - "id": "LINSPACE-ec927a55-840d-4e1d-bfe3-7069d35eaca5", - "label": "LINSPACE", - "func": "LINSPACE", - "type": "default", - "ctrls": { - "start": { - "type": "float", - "default": 10, - "functionName": "LINSPACE", - "param": "start", - "value": 10 - }, - "end": { - "type": "float", - "default": 0, - "functionName": "LINSPACE", - "param": "end", - "value": 0 - }, - "step": { - "type": "int", - "default": 1000, - "functionName": "LINSPACE", - "param": "step", - "value": 1000 - } - }, - "outputs": [ - { - "name": "default", - "id": "default", - "type": "OrderedPair" - } - ], - "path": "PYTHON/nodes\\GENERATORS\\SIMULATIONS\\LINSPACE\\LINSPACE.py", - "selected": false - }, - "position": { - "x": 19.77518382763421, - "y": -79.20725161431301 - }, - "selected": false, - "positionAbsolute": { - "x": 19.77518382763421, - "y": -79.20725161431301 - }, - "dragging": true - }, - { - "width": 130, - "height": 130, + "width": 208, + "height": 96, "id": "TIMESERIES-305de524-fd3a-422d-bdf1-31d59094fec3", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "TIMESERIES-305de524-fd3a-422d-bdf1-31d59094fec3", "label": "TIMESERIES", "func": "TIMESERIES", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "start_date": { "type": "str", @@ -92,26 +38,26 @@ "selected": false }, "position": { - "x": -2.0718236744695986, - "y": 125.72951526577788 + "x": -63.304829660611006, + "y": 109.24551147270125 }, "selected": false, "positionAbsolute": { - "x": -2.0718236744695986, - "y": 125.72951526577788 + "x": -63.304829660611006, + "y": 109.24551147270125 }, "dragging": true }, { - "width": 130, - "height": 130, + "width": 208, + "height": 96, "id": "MATRIX-a9b94d12-79cd-41b8-bac6-e764b105f4fa", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "MATRIX-a9b94d12-79cd-41b8-bac6-e764b105f4fa", "label": "MATRIX", "func": "MATRIX", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "row": { "type": "int", @@ -136,29 +82,29 @@ } ], "path": "PYTHON/nodes\\GENERATORS\\SIMULATIONS\\MATRIX\\MATRIX.py", - "selected": true + "selected": false }, "position": { - "x": -8.905815928064925, - "y": 378.7074924446537 + "x": -89.90574242528106, + "y": 369.53768944496886 }, - "selected": true, + "selected": false, "positionAbsolute": { - "x": -8.905815928064925, - "y": 378.7074924446537 + "x": -89.90574242528106, + "y": 369.53768944496886 }, "dragging": true }, { - "width": 150, - "height": 150, + "width": 208, + "height": 96, "id": "PLOTLY_DATASET-db79195b-b335-4d6e-b159-66385db68a90", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "data": { "id": "PLOTLY_DATASET-db79195b-b335-4d6e-b159-66385db68a90", "label": "PLOTLY DATASET", "func": "PLOTLY_DATASET", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "ctrls": { "dataset_key": { "type": "select", @@ -191,26 +137,26 @@ "selected": false }, "position": { - "x": 22.506662806454145, - "y": 625.9792684792644 + "x": -69.19136719039435, + "y": 630.5641699791069 }, "selected": false, "positionAbsolute": { - "x": 22.506662806454145, - "y": 625.9792684792644 + "x": -69.19136719039435, + "y": 630.5641699791069 }, "dragging": true }, { - "width": 225, - "height": 226, + "width": 380, + "height": 293, "id": "BAR-a91c1fd4-ed0a-4c99-bb22-609ffa2299ca", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "BAR-a91c1fd4-ed0a-4c99-bb22-609ffa2299ca", "label": "BAR", "func": "BAR", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -231,26 +177,26 @@ "selected": false }, "position": { - "x": 271.810495779071, - "y": 98.89951965355135 + "x": 289.7569908907779, + "y": 24.93517972661823 }, "selected": false, "positionAbsolute": { - "x": 271.810495779071, - "y": 98.89951965355135 + "x": 289.7569908907779, + "y": 24.93517972661823 }, "dragging": true }, { - "width": 225, - "height": 226, + "width": 380, + "height": 293, "id": "BAR-67887c6e-5070-4f8b-a453-6f17094bab99", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "BAR-67887c6e-5070-4f8b-a453-6f17094bab99", "label": "BAR 1", "func": "BAR", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -271,26 +217,26 @@ "selected": false }, "position": { - "x": 437.02228968829434, - "y": 610.8795544259854 + "x": 348.3808606913409, + "y": 531.4079284287167 }, "selected": false, "positionAbsolute": { - "x": 437.02228968829434, - "y": 610.8795544259854 + "x": 348.3808606913409, + "y": 531.4079284287167 }, "dragging": true }, { - "width": 225, - "height": 226, + "width": 380, + "height": 293, "id": "BAR-25c3fe48-8421-43df-9cb9-24d38dc92f35", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "BAR-25c3fe48-8421-43df-9cb9-24d38dc92f35", "label": "BAR 2", "func": "BAR", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -311,98 +257,18 @@ "selected": false }, "position": { - "x": 582.8070155150792, - "y": 318.62000176290394 + "x": 657.6937400125055, + "y": 249.8464792652676 }, "selected": false, "positionAbsolute": { - "x": 582.8070155150792, - "y": 318.62000176290394 - }, - "dragging": true - }, - { - "width": 225, - "height": 226, - "id": "BAR-f42d1175-a463-49f9-9079-da0b770b7507", - "type": "PLOTLY", - "data": { - "id": "BAR-f42d1175-a463-49f9-9079-da0b770b7507", - "label": "BAR 3", - "func": "BAR", - "type": "PLOTLY", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "OrderedPair|DataFrame|Matrix", - "multiple": false - } - ], - "outputs": [ - { - "name": "default", - "id": "default", - "type": "Plotly" - } - ], - "path": "PYTHON/nodes\\VISUALIZERS\\PLOTLY\\BAR\\BAR.py", - "selected": false - }, - "position": { - "x": 615.5747879865954, - "y": -101.17977593795786 - }, - "selected": false, - "positionAbsolute": { - "x": 615.5747879865954, - "y": -101.17977593795786 - }, - "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-0ca0fb75-ae0d-4b1b-9e71-49d1f553bd0b", - "type": "TERMINATORS", - "data": { - "id": "END-0ca0fb75-ae0d-4b1b-9e71-49d1f553bd0b", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", - "selected": false - }, - "position": { - "x": 1116.4866351961823, - "y": 230.3617465657985 - }, - "selected": false, - "positionAbsolute": { - "x": 1116.4866351961823, - "y": 230.3617465657985 + "x": 657.6937400125055, + "y": 249.8464792652676 }, "dragging": true } ], "edges": [ - { - "source": "LINSPACE-ec927a55-840d-4e1d-bfe3-7069d35eaca5", - "sourceHandle": "default", - "target": "BAR-f42d1175-a463-49f9-9079-da0b770b7507", - "targetHandle": "default", - "id": "reactflow__edge-LINSPACE-ec927a55-840d-4e1d-bfe3-7069d35eaca5default-BAR-f42d1175-a463-49f9-9079-da0b770b7507default" - }, { "source": "TIMESERIES-305de524-fd3a-422d-bdf1-31d59094fec3", "sourceHandle": "default", @@ -423,40 +289,12 @@ "target": "BAR-67887c6e-5070-4f8b-a453-6f17094bab99", "targetHandle": "default", "id": "reactflow__edge-PLOTLY_DATASET-db79195b-b335-4d6e-b159-66385db68a90default-BAR-67887c6e-5070-4f8b-a453-6f17094bab99default" - }, - { - "source": "BAR-a91c1fd4-ed0a-4c99-bb22-609ffa2299ca", - "sourceHandle": "default", - "target": "END-0ca0fb75-ae0d-4b1b-9e71-49d1f553bd0b", - "targetHandle": "default", - "id": "reactflow__edge-BAR-a91c1fd4-ed0a-4c99-bb22-609ffa2299cadefault-END-0ca0fb75-ae0d-4b1b-9e71-49d1f553bd0bdefault" - }, - { - "source": "BAR-f42d1175-a463-49f9-9079-da0b770b7507", - "sourceHandle": "default", - "target": "END-0ca0fb75-ae0d-4b1b-9e71-49d1f553bd0b", - "targetHandle": "default", - "id": "reactflow__edge-BAR-f42d1175-a463-49f9-9079-da0b770b7507default-END-0ca0fb75-ae0d-4b1b-9e71-49d1f553bd0bdefault" - }, - { - "source": "BAR-25c3fe48-8421-43df-9cb9-24d38dc92f35", - "sourceHandle": "default", - "target": "END-0ca0fb75-ae0d-4b1b-9e71-49d1f553bd0b", - "targetHandle": "default", - "id": "reactflow__edge-BAR-25c3fe48-8421-43df-9cb9-24d38dc92f35default-END-0ca0fb75-ae0d-4b1b-9e71-49d1f553bd0bdefault" - }, - { - "source": "BAR-67887c6e-5070-4f8b-a453-6f17094bab99", - "sourceHandle": "default", - "target": "END-0ca0fb75-ae0d-4b1b-9e71-49d1f553bd0b", - "targetHandle": "default", - "id": "reactflow__edge-BAR-67887c6e-5070-4f8b-a453-6f17094bab99default-END-0ca0fb75-ae0d-4b1b-9e71-49d1f553bd0bdefault" } ], "viewport": { - "x": -296.35399545928726, - "y": 66.8470830817738, - "zoom": 0.8744723800359967 + "x": 606.4472645567363, + "y": 234.63130388602087, + "zoom": 0.9186369849831518 } }, "ctrlsManifest": [ diff --git a/docs/nodes/VISUALIZERS/PLOTLY/BIG_NUMBER/a1-[autogen]/python_code.txt b/docs/nodes/VISUALIZERS/PLOTLY/BIG_NUMBER/a1-[autogen]/python_code.txt index 28445b938c..646ea0e572 100644 --- a/docs/nodes/VISUALIZERS/PLOTLY/BIG_NUMBER/a1-[autogen]/python_code.txt +++ b/docs/nodes/VISUALIZERS/PLOTLY/BIG_NUMBER/a1-[autogen]/python_code.txt @@ -1,4 +1,12 @@ -from flojoy import flojoy, Plotly, OrderedPair, DefaultParams, SmallMemory, Scalar +from flojoy import ( + flojoy, + Plotly, + OrderedPair, + DefaultParams, + SmallMemory, + Scalar, + Vector, +) import plotly.graph_objects as go from nodes.VISUALIZERS.template import plot_layout @@ -7,7 +15,7 @@ MEMORY_KEY = "BIG_NUMBER_MEMORY_KEY" @flojoy(inject_node_metadata=True) def BIG_NUMBER( - default: OrderedPair | Scalar, + default: OrderedPair | Scalar | Vector, default_params: DefaultParams, suffix: str, prefix: str, @@ -27,6 +35,8 @@ def BIG_NUMBER( big_num = default.y[-1] case Scalar(): big_num = default.c + case Vector(): + big_num = default.v[-1] val_format = ".1%" if relative_delta is True else ".1f" fig.add_trace( go.Indicator( @@ -43,6 +53,6 @@ def BIG_NUMBER( }, ) ) - SmallMemory().write_to_memory(job_id, MEMORY_KEY, big_num) + SmallMemory().write_to_memory(job_id, MEMORY_KEY, str(float(big_num))) return Plotly(fig=fig) diff --git a/docs/nodes/VISUALIZERS/PLOTLY/BIG_NUMBER/examples/EX1/app.txt b/docs/nodes/VISUALIZERS/PLOTLY/BIG_NUMBER/examples/EX1/app.txt index f7bfcfd0bd..1d4c362a06 100644 --- a/docs/nodes/VISUALIZERS/PLOTLY/BIG_NUMBER/examples/EX1/app.txt +++ b/docs/nodes/VISUALIZERS/PLOTLY/BIG_NUMBER/examples/EX1/app.txt @@ -1,39 +1,6 @@ { "rfInstance": { "nodes": [ - { - "width": 210, - "height": 130, - "id": "END-6555aed9-4f39-456f-94bb-2fae298ae88f", - "type": "TERMINATORS", - "data": { - "id": "END-6555aed9-4f39-456f-94bb-2fae298ae88f", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", - "selected": false - }, - "position": { - "x": 201.3357255930201, - "y": 557.2980747810793 - }, - "selected": false, - "positionAbsolute": { - "x": 201.3357255930201, - "y": 557.2980747810793 - }, - "dragging": true - }, { "width": 150, "height": 150, @@ -88,57 +55,16 @@ }, "dragging": true }, - { - "width": 150, - "height": 150, - "id": "GOTO-c29d54b5-4478-42da-b59b-5e5b190a2ee6", - "type": "LOOPS", - "data": { - "id": "GOTO-c29d54b5-4478-42da-b59b-5e5b190a2ee6", - "label": "GOTO", - "func": "GOTO", - "type": "LOOPS", - "ctrls": { - "goto_node_id": { - "type": "NodeReference", - "default": "", - "functionName": "GOTO", - "param": "goto_node_id", - "value": "LOOP-d294c908-88a7-4f19-8446-9a68061e1f14" - } - }, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\LOOPS\\GOTO\\GOTO.py", - "selected": false - }, - "position": { - "x": 842.7642970215916, - "y": 378.7266462096507 - }, - "selected": false, - "positionAbsolute": { - "x": 842.7642970215916, - "y": 378.7266462096507 - }, - "dragging": true - }, { "width": 150, "height": 150, "id": "LOOP-d294c908-88a7-4f19-8446-9a68061e1f14", - "type": "LOOPS", + "type": "LOGIC_GATES", "data": { "id": "LOOP-d294c908-88a7-4f19-8446-9a68061e1f14", "label": "LOOP", "func": "LOOP", - "type": "LOOPS", + "type": "LOGIC_GATES", "ctrls": { "num_loops": { "type": "int", @@ -186,12 +112,12 @@ "width": 130, "height": 130, "id": "CONSTANT-b7112c9c-029c-4899-bd7f-ae304c690697", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "CONSTANT-b7112c9c-029c-4899-bd7f-ae304c690697", "label": "2.0", "func": "CONSTANT", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "constant": { "type": "float", @@ -234,12 +160,12 @@ "width": 130, "height": 130, "id": "FEEDBACK-f81e0c07-98f4-4f31-b5b3-7a32118d139e", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "FEEDBACK-f81e0c07-98f4-4f31-b5b3-7a32118d139e", "label": "FEEDBACK", "func": "FEEDBACK", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "referred_node": { "type": "NodeReference", @@ -282,12 +208,12 @@ "width": 130, "height": 130, "id": "CONSTANT-2c2b2a67-fa77-41db-9f40-f6bad42c460b", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "CONSTANT-2c2b2a67-fa77-41db-9f40-f6bad42c460b", "label": "4", "func": "CONSTANT", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "constant": { "type": "float", @@ -376,12 +302,12 @@ "width": 380, "height": 293, "id": "BIG_NUMBER-da31944f-c5f5-461e-a3c2-fe4432f870d6", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "BIG_NUMBER-da31944f-c5f5-461e-a3c2-fe4432f870d6", "label": "BIG NUMBER", "func": "BIG_NUMBER", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": { "suffix": { "type": "str", @@ -457,13 +383,6 @@ "targetHandle": "default", "id": "reactflow__edge-LOOP-d294c908-88a7-4f19-8446-9a68061e1f14body-CONSTANT-b7112c9c-029c-4899-bd7f-ae304c690697default" }, - { - "source": "LOOP-d294c908-88a7-4f19-8446-9a68061e1f14", - "sourceHandle": "end", - "target": "END-6555aed9-4f39-456f-94bb-2fae298ae88f", - "targetHandle": "default", - "id": "reactflow__edge-LOOP-d294c908-88a7-4f19-8446-9a68061e1f14end-END-6555aed9-4f39-456f-94bb-2fae298ae88fdefault" - }, { "source": "LOOP-d294c908-88a7-4f19-8446-9a68061e1f14", "sourceHandle": "body", @@ -492,13 +411,6 @@ "targetHandle": "b", "id": "reactflow__edge-CONSTANT-b7112c9c-029c-4899-bd7f-ae304c690697default-MULTIPLY-de5357d2-7121-4297-9f04-d46406df63f0b" }, - { - "source": "MULTIPLY-de5357d2-7121-4297-9f04-d46406df63f0", - "sourceHandle": "default", - "target": "GOTO-c29d54b5-4478-42da-b59b-5e5b190a2ee6", - "targetHandle": "default", - "id": "reactflow__edge-MULTIPLY-de5357d2-7121-4297-9f04-d46406df63f0default-GOTO-c29d54b5-4478-42da-b59b-5e5b190a2ee6default" - }, { "source": "FEEDBACK-f81e0c07-98f4-4f31-b5b3-7a32118d139e", "sourceHandle": "default", diff --git a/docs/nodes/VISUALIZERS/PLOTLY/COMPOSITE/a1-[autogen]/docstring.txt b/docs/nodes/VISUALIZERS/PLOTLY/COMPOSITE/a1-[autogen]/docstring.txt index 1dac9ef794..3705659867 100644 --- a/docs/nodes/VISUALIZERS/PLOTLY/COMPOSITE/a1-[autogen]/docstring.txt +++ b/docs/nodes/VISUALIZERS/PLOTLY/COMPOSITE/a1-[autogen]/docstring.txt @@ -7,5 +7,5 @@ The COMPOSITE node creates a combination of Plotly visualizations for a given in Supported DC types: ---------------- - `ordered_pair`, `dataframe` (including timeseries), `matrix` + `ordered_pair`, `dataframe` (including timeseries), `matrix`, `vector` diff --git a/docs/nodes/VISUALIZERS/PLOTLY/COMPOSITE/a1-[autogen]/python_code.txt b/docs/nodes/VISUALIZERS/PLOTLY/COMPOSITE/a1-[autogen]/python_code.txt index f07ace20ca..ad0e2b5ff4 100644 --- a/docs/nodes/VISUALIZERS/PLOTLY/COMPOSITE/a1-[autogen]/python_code.txt +++ b/docs/nodes/VISUALIZERS/PLOTLY/COMPOSITE/a1-[autogen]/python_code.txt @@ -1,4 +1,4 @@ -from flojoy import flojoy, OrderedPair, DataFrame, Matrix, Plotly +from flojoy import flojoy, OrderedPair, DataFrame, Matrix, Plotly, Vector import plotly.graph_objects as go import pandas as pd import numpy as np @@ -8,8 +8,8 @@ from typing import Literal @flojoy def COMPOSITE( - primary_trace: OrderedPair | DataFrame | Matrix, - secondary_trace: OrderedPair | DataFrame | Matrix, + primary_trace: OrderedPair | DataFrame | Matrix | Vector, + secondary_trace: OrderedPair | DataFrame | Matrix | Vector, first_figure: Literal["bar", "line", "histogram", "scatter"] = "scatter", second_figure: Literal["bar", "line", "histogram", "scatter"] = "scatter", ) -> Plotly: @@ -26,7 +26,7 @@ def COMPOSITE( def match_figure( fig: go.Figure, figure_type: Literal["bar", "line", "histogram", "scatter"], - dc: OrderedPair | Matrix | DataFrame, + dc: OrderedPair | Matrix | DataFrame | Vector, ): match figure_type: case "bar": @@ -39,140 +39,159 @@ def match_figure( add_scatter_trace(fig, dc) -def add_bar_trace(fig: go.Figure, dc: OrderedPair | Matrix | DataFrame): - if isinstance(dc, DataFrame): - df = dc.m - first_col = df.iloc[:, 0] - is_timeseries = False - if is_timeseries: - for col in df.columns: - if col != df.columns[0]: - fig.add_trace(go.Bar(y=df[col].values, x=first_col, name=col)) - fig.update_layout(xaxis_title=df.columns[0]) - else: - for col in df.columns: - if df[col].dtype == "object": - counts = df[col].value_counts() - fig.add_trace( - go.Bar( - x=counts.index.tolist(), - y=counts.tolist(), - name=col, +def add_bar_trace(fig: go.Figure, dc: OrderedPair | Matrix | DataFrame | Vector): + match dc: + case DataFrame(): + df = dc.m + first_col = df.iloc[:, 0] + is_timeseries = False + if is_timeseries: + for col in df.columns: + if col != df.columns[0]: + fig.add_trace(go.Bar(y=df[col].values, x=first_col, name=col)) + fig.update_layout(xaxis_title=df.columns[0]) + else: + for col in df.columns: + if df[col].dtype == "object": + counts = df[col].value_counts() + fig.add_trace( + go.Bar( + x=counts.index.tolist(), + y=counts.tolist(), + name=col, + ) ) - ) - else: - fig.add_trace(go.Bar(x=df.index, y=df[col], name=col)) - fig.update_layout(xaxis_title="DF index", yaxis_title="Y Axis") - elif isinstance(dc, OrderedPair): - x = dc.x - if isinstance(dc.x, dict): - dict_keys = list(dc.x.keys()) - x = dc.x[dict_keys[0]] - y = dc.y - fig.add_trace(go.Bar(x=x, y=y)) - else: - m = dc.m - num_rows, num_cols = m.shape - x_ticks = np.arange(num_cols) + else: + fig.add_trace(go.Bar(x=df.index, y=df[col], name=col)) + fig.update_layout(xaxis_title="DF index", yaxis_title="Y Axis") + case OrderedPair(): + x = dc.x + if isinstance(dc.x, dict): + dict_keys = list(dc.x.keys()) + x = dc.x[dict_keys[0]] + y = dc.y + fig.add_trace(go.Bar(x=x, y=y)) + case Matrix(): + m = dc.m + num_rows, num_cols = m.shape + x_ticks = np.arange(num_cols) - for i in range(num_rows): - fig.add_trace(go.Bar(x=x_ticks, y=m[i, :], name=f"Row {i+1}")) - fig.update_layout(xaxis_title="Column", yaxis_title="Value") + for i in range(num_rows): + fig.add_trace(go.Bar(x=x_ticks, y=m[i, :], name=f"Row {i+1}")) + fig.update_layout(xaxis_title="Column", yaxis_title="Value") + case Vector(): + y = dc.v + x = np.arange(len(y)) + fig.add_trace(go.Bar(x=x, y=y)) -def add_histogram_trace(fig: go.Figure, dc: OrderedPair | Matrix | DataFrame): - if isinstance(dc, DataFrame): - df = dc.m - for col in df.columns: - fig.add_trace(go.Histogram(x=df[col], name=col)) - fig.update_layout(xaxis_title="Value", yaxis_title="Frequency") - elif isinstance(dc, OrderedPair): - y = dc.y - fig.add_trace(go.Histogram(x=y)) - else: - m = dc.m - histogram_trace = go.Histogram(x=m.flatten()) - fig.add_trace(histogram_trace) +def add_histogram_trace(fig: go.Figure, dc: OrderedPair | Matrix | DataFrame | Vector): + match dc: + case DataFrame(): + df = dc.m + for col in df.columns: + fig.add_trace(go.Histogram(x=df[col], name=col)) + fig.update_layout(xaxis_title="Value", yaxis_title="Frequency") + case OrderedPair(): + y = dc.y + fig.add_trace(go.Histogram(x=y)) + case Matrix(): + m = dc.m + histogram_trace = go.Histogram(x=m.flatten()) + fig.add_trace(histogram_trace) + case Vector(): + y = dc.v + fig.add_trace(go.Histogram(x=y)) -def add_line_trace(fig: go.Figure, dc: OrderedPair | Matrix | DataFrame): - if isinstance(dc, DataFrame): - df = dc.m - first_col = df.iloc[:, 0] - is_timeseries = False - if pd.api.types.is_datetime64_any_dtype(first_col): - is_timeseries = True - if is_timeseries: - for col in df.columns: - if col != df.columns[0]: +def add_line_trace(fig: go.Figure, dc: OrderedPair | Matrix | DataFrame | Vector): + match dc: + case DataFrame(): + df = dc.m + first_col = df.iloc[:, 0] + is_timeseries = False + if pd.api.types.is_datetime64_any_dtype(first_col): + is_timeseries = True + if is_timeseries: + for col in df.columns: + if col != df.columns[0]: + fig.add_trace( + go.Scatter( + y=df[col].values, + x=first_col, + mode="lines", + name=col, + ) + ) + else: + for col in df.columns: fig.add_trace( go.Scatter( y=df[col].values, - x=first_col, + x=df.index, mode="lines", name=col, ) ) - else: - for col in df.columns: + case OrderedPair(): + x = dc.x + if isinstance(dc.x, dict): + dict_keys = list(dc.x.keys()) + x = dc.x[dict_keys[0]] + y = dc.y + fig.add_trace(go.Scatter(x=x, y=y, mode="lines")) + case Matrix(): + m = dc.m + num_rows, num_cols = m.shape + x_ticks = np.arange(num_cols) + for i in range(num_rows): fig.add_trace( - go.Scatter( - y=df[col].values, - x=df.index, - mode="lines", - name=col, - ) + go.Scatter(x=x_ticks, y=m[i, :], name=f"Row {i+1}", mode="lines") ) - elif isinstance(dc, OrderedPair): - x = dc.x - if isinstance(dc.x, dict): - dict_keys = list(dc.x.keys()) - x = dc.x[dict_keys[0]] - y = dc.y - fig.add_trace(go.Scatter(x=x, y=y, mode="lines")) - else: - m = dc.m - num_rows, num_cols = m.shape - x_ticks = np.arange(num_cols) - for i in range(num_rows): - fig.add_trace( - go.Scatter(x=x_ticks, y=m[i, :], name=f"Row {i+1}", mode="lines") - ) - fig.update_layout(xaxis_title="Column", yaxis_title="Value") + fig.update_layout(xaxis_title="Column", yaxis_title="Value") + case Vector(): + y = dc.v + x = np.arange(len(y)) + fig.add_trace(go.Scatter(x=x, y=y, mode="lines")) -def add_scatter_trace(fig: go.Figure, dc: OrderedPair | Matrix | DataFrame): - if isinstance(dc, OrderedPair): - x = dc.x - if isinstance(dc.x, dict): - dict_keys = list(dc.x.keys()) - x = dc.x[dict_keys[0]] - y = dc.y - fig.add_trace(go.Scatter(x=x, y=y, mode="markers", marker=dict(size=4))) - elif isinstance(dc, DataFrame): - df = dc.m - first_col = df.iloc[:, 0] - is_timeseries = False - if pd.api.types.is_datetime64_any_dtype(first_col): - is_timeseries = True - if is_timeseries: - for col in df.columns: - if col != df.columns[0]: +def add_scatter_trace(fig: go.Figure, dc: OrderedPair | Matrix | DataFrame | Vector): + match dc: + case OrderedPair(): + x = dc.x + if isinstance(dc.x, dict): + dict_keys = list(dc.x.keys()) + x = dc.x[dict_keys[0]] + y = dc.y + fig.add_trace(go.Scatter(x=x, y=y, mode="markers", marker=dict(size=4))) + case DataFrame(): + df = dc.m + first_col = df.iloc[:, 0] + is_timeseries = False + if pd.api.types.is_datetime64_any_dtype(first_col): + is_timeseries = True + if is_timeseries: + for col in df.columns: + if col != df.columns[0]: + fig.add_trace( + go.Scatter(x=first_col, y=df[col], mode="markers", name=col) + ) + else: + for col in df.columns: fig.add_trace( - go.Scatter(x=first_col, y=df[col], mode="markers", name=col) + go.Scatter(x=df.index, y=df[col], mode="markers", name=col) ) - else: - for col in df.columns: + case Matrix(): + m = dc.m + num_rows, num_cols = m.shape + x_ticks = np.arange(num_cols) + for i in range(num_rows): fig.add_trace( - go.Scatter(x=df.index, y=df[col], mode="markers", name=col) + go.Scatter(x=x_ticks, y=m[i, :], name=f"Row {i+1}", mode="markers") ) - else: - m = dc.m - num_rows, num_cols = m.shape - x_ticks = np.arange(num_cols) - for i in range(num_rows): - fig.add_trace( - go.Scatter(x=x_ticks, y=m[i, :], name=f"Row {i+1}", mode="markers") - ) - fig.update_layout(xaxis_title="Column", yaxis_title="Value") + fig.update_layout(xaxis_title="Column", yaxis_title="Value") + case Vector(): + y = dc.v + x = np.arange(len(y)) + fig.add_trace(go.Scatter(x=x, y=y, mode="markers", marker=dict(size=4))) diff --git a/docs/nodes/VISUALIZERS/PLOTLY/COMPOSITE/examples/EX1/app.jpeg b/docs/nodes/VISUALIZERS/PLOTLY/COMPOSITE/examples/EX1/app.jpeg index 1f31829458..773da6a2db 100644 Binary files a/docs/nodes/VISUALIZERS/PLOTLY/COMPOSITE/examples/EX1/app.jpeg and b/docs/nodes/VISUALIZERS/PLOTLY/COMPOSITE/examples/EX1/app.jpeg differ diff --git a/docs/nodes/VISUALIZERS/PLOTLY/COMPOSITE/examples/EX1/app.txt b/docs/nodes/VISUALIZERS/PLOTLY/COMPOSITE/examples/EX1/app.txt index 9d2ce5438b..2eb8d1b21d 100644 --- a/docs/nodes/VISUALIZERS/PLOTLY/COMPOSITE/examples/EX1/app.txt +++ b/docs/nodes/VISUALIZERS/PLOTLY/COMPOSITE/examples/EX1/app.txt @@ -3,11 +3,11 @@ "nodes": [ { "width": 150, - "height": 150, - "id": "LINSPACE-60fd71d1-de6b-4e65-ad69-26a864105478", + "height": 180, + "id": "LINSPACE-9f7d65a9-2b57-481e-8fec-675fd6a27c4c", "type": "default", "data": { - "id": "LINSPACE-60fd71d1-de6b-4e65-ad69-26a864105478", + "id": "LINSPACE-9f7d65a9-2b57-481e-8fec-675fd6a27c4c", "label": "LINSPACE", "func": "LINSPACE", "type": "default", @@ -15,6 +15,7 @@ "start": { "type": "float", "default": 10, + "desc": null, "functionName": "LINSPACE", "param": "start", "value": 10 @@ -22,6 +23,7 @@ "end": { "type": "float", "default": 0, + "desc": null, "functionName": "LINSPACE", "param": "end", "value": 0 @@ -29,42 +31,44 @@ "step": { "type": "int", "default": 1000, + "desc": null, "functionName": "LINSPACE", "param": "step", - "value": 1000 + "value": "300" } }, "outputs": [ { "name": "default", "id": "default", - "type": "OrderedPair" + "type": "Vector", + "desc": null } ], - "path": "PYTHON/nodes\\GENERATORS\\SIMULATIONS\\LINSPACE\\LINSPACE.py", + "path": "PYTHON/nodes/GENERATORS/SIMULATIONS/LINSPACE/LINSPACE.py", "selected": false }, "position": { - "x": 84.85957083781548, - "y": 68.08542793709125 + "x": -66.43604164074642, + "y": -68.3746613701575 }, "selected": false, "positionAbsolute": { - "x": 84.85957083781548, - "y": 68.08542793709125 + "x": -66.43604164074642, + "y": -68.3746613701575 }, "dragging": true }, { - "width": 150, - "height": 150, - "id": "PLOTLY_DATASET-63f34937-87a4-4d31-8d21-928dd647d0a4", - "type": "SAMPLE_DATASETS", + "width": 208, + "height": 132, + "id": "PLOTLY_DATASET-b564f0e8-b1ae-4315-b43c-737bc2173d0a", + "type": "GENERATORS", "data": { - "id": "PLOTLY_DATASET-63f34937-87a4-4d31-8d21-928dd647d0a4", + "id": "PLOTLY_DATASET-b564f0e8-b1ae-4315-b43c-737bc2173d0a", "label": "PLOTLY DATASET", "func": "PLOTLY_DATASET", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "ctrls": { "dataset_key": { "type": "select", @@ -81,6 +85,7 @@ "medals_wide", "stocks" ], + "desc": null, "functionName": "PLOTLY_DATASET", "param": "dataset_key", "value": "iris" @@ -90,33 +95,34 @@ { "name": "default", "id": "default", - "type": "DataFrame" + "type": "DataFrame", + "desc": null } ], - "path": "PYTHON/nodes\\GENERATORS\\SAMPLE_DATASETS\\PLOTLY_DATASET\\PLOTLY_DATASET.py", + "path": "PYTHON/nodes/GENERATORS/SAMPLE_DATASETS/PLOTLY_DATASET/PLOTLY_DATASET.py", "selected": false }, "position": { - "x": 83.52799494535296, - "y": 319.29027411218215 + "x": -106.64021374014129, + "y": 145.3514779489801 }, "selected": false, "positionAbsolute": { - "x": 83.52799494535296, - "y": 319.29027411218215 + "x": -106.64021374014129, + "y": 145.3514779489801 }, "dragging": true }, { "width": 380, "height": 293, - "id": "COMPOSITE-23b5006b-c0a2-406b-b76e-9ec1bf282eef", - "type": "PLOTLY", + "id": "COMPOSITE-b6def6e5-2c37-4da4-9e3c-395873927217", + "type": "VISUALIZERS", "data": { - "id": "COMPOSITE-23b5006b-c0a2-406b-b76e-9ec1bf282eef", + "id": "COMPOSITE-b6def6e5-2c37-4da4-9e3c-395873927217", "label": "COMPOSITE", "func": "COMPOSITE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": { "first_figure": { "type": "select", @@ -127,9 +133,10 @@ "histogram", "scatter" ], + "desc": null, "functionName": "COMPOSITE", "param": "first_figure", - "value": "scatter" + "value": "line" }, "second_figure": { "type": "select", @@ -140,6 +147,7 @@ "histogram", "scatter" ], + "desc": null, "functionName": "COMPOSITE", "param": "second_figure", "value": "scatter" @@ -150,97 +158,182 @@ "name": "primary_trace", "id": "primary_trace", "type": "OrderedPair|DataFrame|Matrix", - "multiple": false + "multiple": false, + "desc": null }, { "name": "secondary_trace", "id": "secondary_trace", "type": "OrderedPair|DataFrame|Matrix", - "multiple": false + "multiple": false, + "desc": null } ], "outputs": [ { "name": "default", "id": "default", - "type": "Plotly" + "type": "Plotly", + "desc": null } ], - "path": "PYTHON/nodes\\VISUALIZERS\\PLOTLY\\COMPOSITE\\COMPOSITE.py", + "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/COMPOSITE/COMPOSITE.py", "selected": false }, "position": { - "x": 498.3322829295064, - "y": 116.89764399357261 + "x": 350.43881227824863, + "y": -35.91689494861453 }, "selected": false, "positionAbsolute": { - "x": 498.3322829295064, - "y": 116.89764399357261 + "x": 350.43881227824863, + "y": -35.91689494861453 }, "dragging": true }, { - "width": 210, - "height": 130, - "id": "END-d651a481-cd4b-4d5f-8b67-701a4311d16d", - "type": "TERMINATORS", + "width": 208, + "height": 100, + "id": "CONSTANT-7c624ace-7cb4-40ab-8121-af39ec25f5fb", + "type": "GENERATORS", "data": { - "id": "END-d651a481-cd4b-4d5f-8b67-701a4311d16d", - "label": "END", - "func": "END", - "type": "TERMINATORS", + "id": "CONSTANT-7c624ace-7cb4-40ab-8121-af39ec25f5fb", + "label": "2", + "func": "CONSTANT", + "type": "GENERATORS", + "ctrls": { + "constant": { + "type": "float", + "default": 3, + "desc": null, + "functionName": "CONSTANT", + "param": "constant", + "value": "2" + }, + "step": { + "type": "int", + "default": 1000, + "desc": null, + "functionName": "CONSTANT", + "param": "step", + "value": "300" + } + }, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair", + "desc": null + } + ], + "path": "PYTHON/nodes/GENERATORS/SIMULATIONS/CONSTANT/CONSTANT.py", + "selected": false + }, + "position": { + "x": -106.8907422401193, + "y": -197.052576359828 + }, + "selected": false, + "positionAbsolute": { + "x": -106.8907422401193, + "y": -197.052576359828 + }, + "dragging": true + }, + { + "width": 72, + "height": 72, + "id": "ADD-d7f9c6e1-013c-46ed-962d-680dc412e944", + "type": "ARITHMETIC", + "data": { + "id": "ADD-d7f9c6e1-013c-46ed-962d-680dc412e944", + "label": "ADD", + "func": "ADD", + "type": "ARITHMETIC", "ctrls": {}, "inputs": [ + { + "name": "a", + "id": "a", + "type": "OrderedPair|Scalar|Vector", + "multiple": false, + "desc": null + }, + { + "name": "b", + "id": "b", + "type": "OrderedPair|Scalar|Vector", + "multiple": true, + "desc": null + } + ], + "outputs": [ { "name": "default", "id": "default", - "type": "Any", - "multiple": false + "type": "OrderedPair|Scalar|Vector", + "desc": null } ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", + "path": "PYTHON/nodes/TRANSFORMERS/ARITHMETIC/ADD/ADD.py", "selected": false }, "position": { - "x": 1015.797426706774, - "y": 214.9173662989844 + "x": 161.5017601761473, + "y": -92.92555379325714 }, "selected": false, "positionAbsolute": { - "x": 1015.797426706774, - "y": 214.9173662989844 + "x": 161.5017601761473, + "y": -92.92555379325714 }, "dragging": true } ], "edges": [ { - "source": "LINSPACE-60fd71d1-de6b-4e65-ad69-26a864105478", + "source": "CONSTANT-7c624ace-7cb4-40ab-8121-af39ec25f5fb", "sourceHandle": "default", - "target": "COMPOSITE-23b5006b-c0a2-406b-b76e-9ec1bf282eef", - "targetHandle": "primary_trace", - "id": "reactflow__edge-LINSPACE-60fd71d1-de6b-4e65-ad69-26a864105478default-COMPOSITE-23b5006b-c0a2-406b-b76e-9ec1bf282eefprimary_trace" + "target": "ADD-d7f9c6e1-013c-46ed-962d-680dc412e944", + "targetHandle": "a", + "id": "reactflow__edge-CONSTANT-7c624ace-7cb4-40ab-8121-af39ec25f5fbdefault-ADD-d7f9c6e1-013c-46ed-962d-680dc412e944a" }, { - "source": "PLOTLY_DATASET-63f34937-87a4-4d31-8d21-928dd647d0a4", + "source": "LINSPACE-9f7d65a9-2b57-481e-8fec-675fd6a27c4c", "sourceHandle": "default", - "target": "COMPOSITE-23b5006b-c0a2-406b-b76e-9ec1bf282eef", - "targetHandle": "secondary_trace", - "id": "reactflow__edge-PLOTLY_DATASET-63f34937-87a4-4d31-8d21-928dd647d0a4default-COMPOSITE-23b5006b-c0a2-406b-b76e-9ec1bf282eefsecondary_trace" + "target": "ADD-d7f9c6e1-013c-46ed-962d-680dc412e944", + "targetHandle": "b", + "id": "reactflow__edge-LINSPACE-9f7d65a9-2b57-481e-8fec-675fd6a27c4cdefault-ADD-d7f9c6e1-013c-46ed-962d-680dc412e944b" }, { - "source": "COMPOSITE-23b5006b-c0a2-406b-b76e-9ec1bf282eef", + "source": "ADD-d7f9c6e1-013c-46ed-962d-680dc412e944", "sourceHandle": "default", - "target": "END-d651a481-cd4b-4d5f-8b67-701a4311d16d", - "targetHandle": "default", - "id": "reactflow__edge-COMPOSITE-23b5006b-c0a2-406b-b76e-9ec1bf282eefdefault-END-d651a481-cd4b-4d5f-8b67-701a4311d16ddefault" + "target": "COMPOSITE-b6def6e5-2c37-4da4-9e3c-395873927217", + "targetHandle": "primary_trace", + "id": "reactflow__edge-ADD-d7f9c6e1-013c-46ed-962d-680dc412e944default-COMPOSITE-b6def6e5-2c37-4da4-9e3c-395873927217primary_trace" + }, + { + "source": "PLOTLY_DATASET-b564f0e8-b1ae-4315-b43c-737bc2173d0a", + "sourceHandle": "default", + "target": "COMPOSITE-b6def6e5-2c37-4da4-9e3c-395873927217", + "targetHandle": "secondary_trace", + "id": "reactflow__edge-PLOTLY_DATASET-b564f0e8-b1ae-4315-b43c-737bc2173d0adefault-COMPOSITE-b6def6e5-2c37-4da4-9e3c-395873927217secondary_trace" } ], "viewport": { - "x": -296.35399545928726, - "y": 66.8470830817738, - "zoom": 0.8744723800359967 + "x": 547.784939185504, + "y": 240.2714794602041, + "zoom": 0.9407196048144776 } }, "ctrlsManifest": [ diff --git a/docs/nodes/VISUALIZERS/PLOTLY/COMPOSITE/examples/EX1/output.jpeg b/docs/nodes/VISUALIZERS/PLOTLY/COMPOSITE/examples/EX1/output.jpeg index 628c1e93f8..fb249d4cd8 100644 Binary files a/docs/nodes/VISUALIZERS/PLOTLY/COMPOSITE/examples/EX1/output.jpeg and b/docs/nodes/VISUALIZERS/PLOTLY/COMPOSITE/examples/EX1/output.jpeg differ diff --git a/docs/nodes/VISUALIZERS/PLOTLY/HISTOGRAM/a1-[autogen]/docstring.txt b/docs/nodes/VISUALIZERS/PLOTLY/HISTOGRAM/a1-[autogen]/docstring.txt index 359e2cd579..5f0ac6a176 100644 --- a/docs/nodes/VISUALIZERS/PLOTLY/HISTOGRAM/a1-[autogen]/docstring.txt +++ b/docs/nodes/VISUALIZERS/PLOTLY/HISTOGRAM/a1-[autogen]/docstring.txt @@ -7,5 +7,5 @@ The HISTOGRAM node creates a Plotly Histogram visualization for a given Supported DC types: ------------------ - `ordered_pair`, `dataframe`, `matrix` + `ordered_pair`, `dataframe`, `matrix`, `vector` diff --git a/docs/nodes/VISUALIZERS/PLOTLY/HISTOGRAM/a1-[autogen]/python_code.txt b/docs/nodes/VISUALIZERS/PLOTLY/HISTOGRAM/a1-[autogen]/python_code.txt index 8f6e4626f8..58a7d1e878 100644 --- a/docs/nodes/VISUALIZERS/PLOTLY/HISTOGRAM/a1-[autogen]/python_code.txt +++ b/docs/nodes/VISUALIZERS/PLOTLY/HISTOGRAM/a1-[autogen]/python_code.txt @@ -1,29 +1,32 @@ import pandas as pd import plotly.graph_objects as go -from flojoy import flojoy, OrderedPair, DataFrame, Matrix, Plotly +from flojoy import flojoy, OrderedPair, DataFrame, Matrix, Plotly, Vector from nodes.VISUALIZERS.template import plot_layout @flojoy -def HISTOGRAM(default: OrderedPair | DataFrame | Matrix) -> Plotly: +def HISTOGRAM(default: OrderedPair | DataFrame | Matrix | Vector) -> Plotly: layout = plot_layout(title="HISTOGRAM") fig = go.Figure(layout=layout) - if isinstance(default, OrderedPair): - y = default.y - fig.add_trace(go.Histogram(x=y)) - elif isinstance(default, DataFrame): - df = pd.DataFrame(default.m) - for col in df.columns: - fig.add_trace(go.Histogram(x=df[col], name=col)) + match default: + case OrderedPair(): + y = default.y + fig.add_trace(go.Histogram(x=y)) + case DataFrame(): + df = pd.DataFrame(default.m) + for col in df.columns: + fig.add_trace(go.Histogram(x=df[col], name=col)) - fig.update_layout(xaxis_title="Value", yaxis_title="Frequency") - else: - m = default.m - flattened_matrix = m.flatten() - histogram_trace = go.Histogram(x=flattened_matrix) - - fig = fig.add_trace(histogram_trace) + fig.update_layout(xaxis_title="Value", yaxis_title="Frequency") + case Matrix(): + m = default.m + flattened_matrix = m.flatten() + histogram_trace = go.Histogram(x=flattened_matrix) + fig = fig.add_trace(histogram_trace) + case Vector(): + v = default.v + fig.add_trace(go.Histogram(x=v)) return Plotly(fig=fig) diff --git a/docs/nodes/VISUALIZERS/PLOTLY/HISTOGRAM/examples/EX1/app.txt b/docs/nodes/VISUALIZERS/PLOTLY/HISTOGRAM/examples/EX1/app.txt index f528f65d9e..f0b602e3b8 100644 --- a/docs/nodes/VISUALIZERS/PLOTLY/HISTOGRAM/examples/EX1/app.txt +++ b/docs/nodes/VISUALIZERS/PLOTLY/HISTOGRAM/examples/EX1/app.txt @@ -2,69 +2,15 @@ "rfInstance": { "nodes": [ { - "width": 150, - "height": 150, - "id": "LINSPACE-32bf4749-f44a-4f3b-9fca-280a8c1a7930", - "type": "default", - "data": { - "id": "LINSPACE-32bf4749-f44a-4f3b-9fca-280a8c1a7930", - "label": "LINSPACE", - "func": "LINSPACE", - "type": "default", - "ctrls": { - "start": { - "type": "float", - "default": 10, - "functionName": "LINSPACE", - "param": "start", - "value": 10 - }, - "end": { - "type": "float", - "default": 0, - "functionName": "LINSPACE", - "param": "end", - "value": 0 - }, - "step": { - "type": "int", - "default": 1000, - "functionName": "LINSPACE", - "param": "step", - "value": 1000 - } - }, - "outputs": [ - { - "name": "default", - "id": "default", - "type": "OrderedPair" - } - ], - "path": "PYTHON/nodes\\GENERATORS\\SIMULATIONS\\LINSPACE\\LINSPACE.py", - "selected": false - }, - "position": { - "x": 145.49252342766638, - "y": -35.65136970553726 - }, - "selected": false, - "positionAbsolute": { - "x": 145.49252342766638, - "y": -35.65136970553726 - }, - "dragging": true - }, - { - "width": 130, - "height": 130, + "width": 208, + "height": 96, "id": "TIMESERIES-1f113e5c-ee47-4e67-a040-ed8107f98095", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "TIMESERIES-1f113e5c-ee47-4e67-a040-ed8107f98095", "label": "TIMESERIES", "func": "TIMESERIES", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "start_date": { "type": "str", @@ -92,26 +38,26 @@ "selected": false }, "position": { - "x": -31.98906231081486, - "y": 180.07660190864533 + "x": -7.7821224453163325, + "y": 48.813887088913134 }, "selected": false, "positionAbsolute": { - "x": -31.98906231081486, - "y": 180.07660190864533 + "x": -7.7821224453163325, + "y": 48.813887088913134 }, "dragging": true }, { - "width": 130, - "height": 130, + "width": 208, + "height": 96, "id": "MATRIX-bb1dc76f-50a7-4e4d-94f2-66c729fef752", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "MATRIX-bb1dc76f-50a7-4e4d-94f2-66c729fef752", "label": "MATRIX", "func": "MATRIX", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "row": { "type": "int", @@ -139,26 +85,26 @@ "selected": false }, "position": { - "x": 22.054843684253996, - "y": 723.8292282322853 + "x": -136.49306026080123, + "y": 497.03098149496736 }, "selected": false, "positionAbsolute": { - "x": 22.054843684253996, - "y": 723.8292282322853 + "x": -136.49306026080123, + "y": 497.03098149496736 }, "dragging": true }, { - "width": 150, - "height": 150, + "width": 208, + "height": 96, "id": "PLOTLY_DATASET-a2a99924-c20c-40b8-8725-378427432b04", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "data": { "id": "PLOTLY_DATASET-a2a99924-c20c-40b8-8725-378427432b04", "label": "PLOTLY DATASET", "func": "PLOTLY_DATASET", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "ctrls": { "dataset_key": { "type": "select", @@ -191,26 +137,26 @@ "selected": false }, "position": { - "x": 18.171290915186148, - "y": 440.8034142357426 + "x": -207.3110221141082, + "y": 282.180770332777 }, "selected": false, "positionAbsolute": { - "x": 18.171290915186148, - "y": 440.8034142357426 + "x": -207.3110221141082, + "y": 282.180770332777 }, "dragging": true }, { - "width": 250, - "height": 159, + "width": 380, + "height": 293, "id": "HISTOGRAM-e3f0af53-0c45-4457-ae12-7f6eb0327f39", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "HISTOGRAM-e3f0af53-0c45-4457-ae12-7f6eb0327f39", "label": "HISTOGRAM", "func": "HISTOGRAM", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -231,59 +177,26 @@ "selected": false }, "position": { - "x": 752.250474584973, - "y": 441.97734280295566 + "x": 132.4645746655445, + "y": 173.27376638391252 }, "selected": false, "positionAbsolute": { - "x": 752.250474584973, - "y": 441.97734280295566 + "x": 132.4645746655445, + "y": 173.27376638391252 }, "dragging": true }, { - "width": 210, - "height": 130, - "id": "END-13de4aba-1c8e-45e2-801e-3102187a3923", - "type": "TERMINATORS", - "data": { - "id": "END-13de4aba-1c8e-45e2-801e-3102187a3923", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", - "selected": false - }, - "position": { - "x": 1334.6531036384777, - "y": 271.2955530802111 - }, - "selected": false, - "positionAbsolute": { - "x": 1334.6531036384777, - "y": 271.2955530802111 - }, - "dragging": true - }, - { - "width": 250, - "height": 159, + "width": 380, + "height": 293, "id": "HISTOGRAM-6bb3aef4-a631-4732-931b-b4a71f49557e", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "HISTOGRAM-6bb3aef4-a631-4732-931b-b4a71f49557e", "label": "HISTOGRAM 1", "func": "HISTOGRAM", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -304,26 +217,26 @@ "selected": false }, "position": { - "x": 379.88476599867, - "y": 666.8839022599676 + "x": 576.1267979151604, + "y": 390.2182152496157 }, "selected": false, "positionAbsolute": { - "x": 379.88476599867, - "y": 666.8839022599676 + "x": 576.1267979151604, + "y": 390.2182152496157 }, "dragging": true }, { - "width": 250, - "height": 159, + "width": 380, + "height": 293, "id": "HISTOGRAM-3f0b2e7d-3a6c-4d14-a17c-3ba2fe7c0bfa", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "HISTOGRAM-3f0b2e7d-3a6c-4d14-a17c-3ba2fe7c0bfa", "label": "HISTOGRAM 2", "func": "HISTOGRAM", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -344,65 +257,18 @@ "selected": false }, "position": { - "x": 396.5206086873053, - "y": 169.585423555329 + "x": 520.1949127052811, + "y": -44.71890278881858 }, "selected": false, "positionAbsolute": { - "x": 396.5206086873053, - "y": 169.585423555329 - }, - "dragging": true - }, - { - "width": 250, - "height": 159, - "id": "HISTOGRAM-31603d5b-2656-44cd-b445-071bb1cb6b1f", - "type": "PLOTLY", - "data": { - "id": "HISTOGRAM-31603d5b-2656-44cd-b445-071bb1cb6b1f", - "label": "HISTOGRAM 3", - "func": "HISTOGRAM", - "type": "PLOTLY", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "OrderedPair|DataFrame|Matrix", - "multiple": false - } - ], - "outputs": [ - { - "name": "default", - "id": "default", - "type": "Plotly" - } - ], - "path": "PYTHON/nodes\\VISUALIZERS\\PLOTLY\\HISTOGRAM\\HISTOGRAM.py", - "selected": false - }, - "position": { - "x": 749.3456302612497, - "y": -69.67675638632511 - }, - "selected": false, - "positionAbsolute": { - "x": 749.3456302612497, - "y": -69.67675638632511 + "x": 520.1949127052811, + "y": -44.71890278881858 }, "dragging": true } ], "edges": [ - { - "source": "LINSPACE-32bf4749-f44a-4f3b-9fca-280a8c1a7930", - "sourceHandle": "default", - "target": "HISTOGRAM-31603d5b-2656-44cd-b445-071bb1cb6b1f", - "targetHandle": "default", - "id": "reactflow__edge-LINSPACE-32bf4749-f44a-4f3b-9fca-280a8c1a7930default-HISTOGRAM-31603d5b-2656-44cd-b445-071bb1cb6b1fdefault" - }, { "source": "TIMESERIES-1f113e5c-ee47-4e67-a040-ed8107f98095", "sourceHandle": "default", @@ -423,40 +289,12 @@ "target": "HISTOGRAM-6bb3aef4-a631-4732-931b-b4a71f49557e", "targetHandle": "default", "id": "reactflow__edge-MATRIX-bb1dc76f-50a7-4e4d-94f2-66c729fef752default-HISTOGRAM-6bb3aef4-a631-4732-931b-b4a71f49557edefault" - }, - { - "source": "HISTOGRAM-3f0b2e7d-3a6c-4d14-a17c-3ba2fe7c0bfa", - "sourceHandle": "default", - "target": "END-13de4aba-1c8e-45e2-801e-3102187a3923", - "targetHandle": "default", - "id": "reactflow__edge-HISTOGRAM-3f0b2e7d-3a6c-4d14-a17c-3ba2fe7c0bfadefault-END-13de4aba-1c8e-45e2-801e-3102187a3923default" - }, - { - "source": "HISTOGRAM-31603d5b-2656-44cd-b445-071bb1cb6b1f", - "sourceHandle": "default", - "target": "END-13de4aba-1c8e-45e2-801e-3102187a3923", - "targetHandle": "default", - "id": "reactflow__edge-HISTOGRAM-31603d5b-2656-44cd-b445-071bb1cb6b1fdefault-END-13de4aba-1c8e-45e2-801e-3102187a3923default" - }, - { - "source": "HISTOGRAM-e3f0af53-0c45-4457-ae12-7f6eb0327f39", - "sourceHandle": "default", - "target": "END-13de4aba-1c8e-45e2-801e-3102187a3923", - "targetHandle": "default", - "id": "reactflow__edge-HISTOGRAM-e3f0af53-0c45-4457-ae12-7f6eb0327f39default-END-13de4aba-1c8e-45e2-801e-3102187a3923default" - }, - { - "source": "HISTOGRAM-6bb3aef4-a631-4732-931b-b4a71f49557e", - "sourceHandle": "default", - "target": "END-13de4aba-1c8e-45e2-801e-3102187a3923", - "targetHandle": "default", - "id": "reactflow__edge-HISTOGRAM-6bb3aef4-a631-4732-931b-b4a71f49557edefault-END-13de4aba-1c8e-45e2-801e-3102187a3923default" } ], "viewport": { - "x": -296.35399545928726, - "y": 66.8470830817738, - "zoom": 0.8744723800359967 + "x": 606.4472645567363, + "y": 234.63130388602087, + "zoom": 0.9186369849831518 } }, "ctrlsManifest": [ diff --git a/docs/nodes/VISUALIZERS/PLOTLY/IMAGE/examples/EX1/app.txt b/docs/nodes/VISUALIZERS/PLOTLY/IMAGE/examples/EX1/app.txt index ef0b07fe70..3da6b85d8b 100644 --- a/docs/nodes/VISUALIZERS/PLOTLY/IMAGE/examples/EX1/app.txt +++ b/docs/nodes/VISUALIZERS/PLOTLY/IMAGE/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 150, "height": 150, "id": "LOCAL_FILE-f21874a3-6a2f-4f64-ae87-faebdfba5c6d", - "type": "LOCAL_FILE_SYSTEM", + "type": "LOADERS", "data": { "id": "LOCAL_FILE-f21874a3-6a2f-4f64-ae87-faebdfba5c6d", "label": "LOCAL FILE", "func": "LOCAL_FILE", - "type": "LOCAL_FILE_SYSTEM", + "type": "LOADERS", "ctrls": { "file_path": { "type": "str", @@ -69,12 +69,12 @@ "width": 225, "height": 226, "id": "IMAGE-c69df1a9-06a0-41aa-beb2-41bc8a400ed5", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "IMAGE-c69df1a9-06a0-41aa-beb2-41bc8a400ed5", "label": "IMAGE", "func": "IMAGE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -104,39 +104,6 @@ "y": 85.72712333520752 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-796cba6c-8b14-44eb-9236-6e57d899421d", - "type": "TERMINATORS", - "data": { - "id": "END-796cba6c-8b14-44eb-9236-6e57d899421d", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", - "selected": false - }, - "position": { - "x": 1100.4817479739488, - "y": 129.55021985987543 - }, - "selected": false, - "positionAbsolute": { - "x": 1100.4817479739488, - "y": 129.55021985987543 - }, - "dragging": true } ], "edges": [ @@ -146,13 +113,6 @@ "target": "IMAGE-c69df1a9-06a0-41aa-beb2-41bc8a400ed5", "targetHandle": "default", "id": "reactflow__edge-LOCAL_FILE-f21874a3-6a2f-4f64-ae87-faebdfba5c6ddefault-IMAGE-c69df1a9-06a0-41aa-beb2-41bc8a400ed5default" - }, - { - "source": "IMAGE-c69df1a9-06a0-41aa-beb2-41bc8a400ed5", - "sourceHandle": "default", - "target": "END-796cba6c-8b14-44eb-9236-6e57d899421d", - "targetHandle": "default", - "id": "reactflow__edge-IMAGE-c69df1a9-06a0-41aa-beb2-41bc8a400ed5default-END-796cba6c-8b14-44eb-9236-6e57d899421ddefault" } ], "viewport": { diff --git a/docs/nodes/VISUALIZERS/PLOTLY/LINE/a1-[autogen]/docstring.txt b/docs/nodes/VISUALIZERS/PLOTLY/LINE/a1-[autogen]/docstring.txt index 84d68c38bd..acaa059d66 100644 --- a/docs/nodes/VISUALIZERS/PLOTLY/LINE/a1-[autogen]/docstring.txt +++ b/docs/nodes/VISUALIZERS/PLOTLY/LINE/a1-[autogen]/docstring.txt @@ -6,4 +6,4 @@ The LINE node creates a Plotly Line visualization for a given input data contain Supported DC types: ------------------- - `ordered_pair`, `dataframe` (including timeseries), `matrix` + `ordered_pair`, `dataframe` (including timeseries), `matrix`, `vector` diff --git a/docs/nodes/VISUALIZERS/PLOTLY/LINE/a1-[autogen]/python_code.txt b/docs/nodes/VISUALIZERS/PLOTLY/LINE/a1-[autogen]/python_code.txt index 2bb9558496..88ed85e680 100644 --- a/docs/nodes/VISUALIZERS/PLOTLY/LINE/a1-[autogen]/python_code.txt +++ b/docs/nodes/VISUALIZERS/PLOTLY/LINE/a1-[autogen]/python_code.txt @@ -1,4 +1,4 @@ -from flojoy import flojoy, Plotly, OrderedPair, DataFrame, Matrix +from flojoy import flojoy, Plotly, OrderedPair, DataFrame, Matrix, Vector import numpy as np import plotly.graph_objects as go import pandas as pd @@ -6,58 +6,63 @@ from nodes.VISUALIZERS.template import plot_layout @flojoy -def LINE(default: OrderedPair | DataFrame | Matrix) -> Plotly: +def LINE(default: OrderedPair | DataFrame | Matrix | Vector) -> Plotly: layout = plot_layout(title="LINE") fig = go.Figure(layout=layout) - if isinstance(default, OrderedPair): - x = default.x - if isinstance(default.x, dict): - dict_keys = list(default.x.keys()) - x = default.x[dict_keys[0]] - y = default.y - fig.add_trace(go.Scatter(x=x, y=y, mode="lines")) - elif isinstance(default, DataFrame): - df = default.m - first_col = df.iloc[:, 0] - is_timeseries = False - if pd.api.types.is_datetime64_any_dtype(first_col): - is_timeseries = True - if is_timeseries: - for col in df.columns: - if col != df.columns[0]: + match default: + case OrderedPair(): + x = default.x + if isinstance(default.x, dict): + dict_keys = list(default.x.keys()) + x = default.x[dict_keys[0]] + y = default.y + fig.add_trace(go.Scatter(x=x, y=y, mode="lines")) + case DataFrame(): + df = default.m + first_col = df.iloc[:, 0] + is_timeseries = False + if pd.api.types.is_datetime64_any_dtype(first_col): + is_timeseries = True + if is_timeseries: + for col in df.columns: + if col != df.columns[0]: + fig.add_trace( + go.Scatter( + y=df[col].values, + x=first_col, + mode="lines", + name=col, + ) + ) + else: + for col in df.columns: fig.add_trace( go.Scatter( y=df[col].values, - x=first_col, + x=df.index, mode="lines", name=col, ) ) - else: - for col in df.columns: - fig.add_trace( - go.Scatter( - y=df[col].values, - x=df.index, - mode="lines", - name=col, - ) - ) - else: - m = default.m + case Matrix(): + m = default.m - num_rows, num_cols = m.shape + num_rows, num_cols = m.shape - x_ticks = np.arange(num_cols) + x_ticks = np.arange(num_cols) - for i in range(num_rows): - fig.add_trace( - go.Scatter(x=x_ticks, y=m[i, :], name=f"Row {i+1}", mode="lines") - ) + for i in range(num_rows): + fig.add_trace( + go.Scatter(x=x_ticks, y=m[i, :], name=f"Row {i+1}", mode="lines") + ) - fig.update_layout(xaxis_title="Column", yaxis_title="Value") + fig.update_layout(xaxis_title="Column", yaxis_title="Value") + case Vector(): + y = default.v + x = np.arange(len(y)) + fig.add_trace(go.Scatter(x=x, y=y, mode="lines")) return Plotly(fig=fig) diff --git a/docs/nodes/VISUALIZERS/PLOTLY/LINE/examples/EX1/app.txt b/docs/nodes/VISUALIZERS/PLOTLY/LINE/examples/EX1/app.txt index 27b532f690..90ddf52d8e 100644 --- a/docs/nodes/VISUALIZERS/PLOTLY/LINE/examples/EX1/app.txt +++ b/docs/nodes/VISUALIZERS/PLOTLY/LINE/examples/EX1/app.txt @@ -2,69 +2,15 @@ "rfInstance": { "nodes": [ { - "width": 150, - "height": 150, - "id": "LINSPACE-4a588ebe-8693-43ac-91f9-3ce85eac444e", - "type": "default", - "data": { - "id": "LINSPACE-4a588ebe-8693-43ac-91f9-3ce85eac444e", - "label": "LINSPACE", - "func": "LINSPACE", - "type": "default", - "ctrls": { - "start": { - "type": "float", - "default": 10, - "functionName": "LINSPACE", - "param": "start", - "value": 10 - }, - "end": { - "type": "float", - "default": 0, - "functionName": "LINSPACE", - "param": "end", - "value": 0 - }, - "step": { - "type": "int", - "default": 1000, - "functionName": "LINSPACE", - "param": "step", - "value": 1000 - } - }, - "outputs": [ - { - "name": "default", - "id": "default", - "type": "OrderedPair" - } - ], - "path": "PYTHON/nodes\\GENERATORS\\SIMULATIONS\\LINSPACE\\LINSPACE.py", - "selected": false - }, - "position": { - "x": 73.3067219450088, - "y": -291.80119674931484 - }, - "selected": false, - "positionAbsolute": { - "x": 73.3067219450088, - "y": -291.80119674931484 - }, - "dragging": true - }, - { - "width": 130, - "height": 130, + "width": 208, + "height": 96, "id": "MATRIX-adb7407c-2ba3-4478-8c1a-2c0d2dc1f095", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "MATRIX-adb7407c-2ba3-4478-8c1a-2c0d2dc1f095", "label": "MATRIX", "func": "MATRIX", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "row": { "type": "int", @@ -92,26 +38,26 @@ "selected": false }, "position": { - "x": 100.15409750155447, - "y": 479.8429342272712 + "x": 83.36011635478266, + "y": 444.9631272301297 }, "selected": false, "positionAbsolute": { - "x": 100.15409750155447, - "y": 479.8429342272712 + "x": 83.36011635478266, + "y": 444.9631272301297 }, "dragging": true }, { - "width": 150, - "height": 150, + "width": 208, + "height": 96, "id": "R_DATASET-6c382bcf-a72e-488d-a784-eb21cb00839a", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "data": { "id": "R_DATASET-6c382bcf-a72e-488d-a784-eb21cb00839a", "label": "R DATASET", "func": "R_DATASET", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "ctrls": { "dataset_key": { "type": "select", @@ -232,15 +178,15 @@ "dragging": true }, { - "width": 130, - "height": 130, + "width": 208, + "height": 96, "id": "TIMESERIES-511ecdda-9fd1-443e-95bb-2399e69b6484", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "TIMESERIES-511ecdda-9fd1-443e-95bb-2399e69b6484", "label": "TIMESERIES", "func": "TIMESERIES", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "start_date": { "type": "str", @@ -268,66 +214,26 @@ "selected": false }, "position": { - "x": 69.47384345035496, - "y": -24.4832604248532 + "x": 61.722775228768, + "y": 2.6454783507012394 }, "selected": false, "positionAbsolute": { - "x": 69.47384345035496, - "y": -24.4832604248532 + "x": 61.722775228768, + "y": 2.6454783507012394 }, "dragging": true }, { - "width": 225, - "height": 226, - "id": "LINE-5c3fb9d2-57ce-4364-8030-96505b8ad344", - "type": "PLOTLY", - "data": { - "id": "LINE-5c3fb9d2-57ce-4364-8030-96505b8ad344", - "label": "LINE", - "func": "LINE", - "type": "PLOTLY", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "OrderedPair|DataFrame|Matrix", - "multiple": false - } - ], - "outputs": [ - { - "name": "default", - "id": "default", - "type": "Plotly" - } - ], - "path": "PYTHON/nodes\\VISUALIZERS\\PLOTLY\\LINE\\LINE.py", - "selected": false - }, - "position": { - "x": 739.1689027250129, - "y": -239.71711666292288 - }, - "selected": false, - "positionAbsolute": { - "x": 739.1689027250129, - "y": -239.71711666292288 - }, - "dragging": true - }, - { - "width": 225, - "height": 226, + "width": 380, + "height": 293, "id": "LINE-b77bfca4-130d-46b6-9962-f53f605d7107", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-b77bfca4-130d-46b6-9962-f53f605d7107", "label": "LINE 1", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -348,26 +254,26 @@ "selected": false }, "position": { - "x": 608.09609803873, - "y": 402.54847413335165 + "x": 469.8687147537621, + "y": 362.50128832181895 }, "selected": false, "positionAbsolute": { - "x": 608.09609803873, - "y": 402.54847413335165 + "x": 469.8687147537621, + "y": 362.50128832181895 }, "dragging": true }, { - "width": 225, - "height": 226, + "width": 380, + "height": 293, "id": "LINE-fba98010-ffc1-4864-8a5a-356f46f70a26", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-fba98010-ffc1-4864-8a5a-356f46f70a26", "label": "LINE 2", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -399,15 +305,15 @@ "dragging": true }, { - "width": 225, - "height": 226, + "width": 380, + "height": 293, "id": "LINE-be1cb8d9-dc67-4567-8952-8b7eaeb9134d", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "LINE-be1cb8d9-dc67-4567-8952-8b7eaeb9134d", "label": "LINE 3", "func": "LINE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -428,58 +334,18 @@ "selected": false }, "position": { - "x": 367.4351082265475, - "y": -104.27979408941752 + "x": 403.6067599272868, + "y": -57.773384759895634 }, "selected": false, "positionAbsolute": { - "x": 367.4351082265475, - "y": -104.27979408941752 - }, - "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-808f32a4-ad05-43db-a4f7-15318f28ea45", - "type": "TERMINATORS", - "data": { - "id": "END-808f32a4-ad05-43db-a4f7-15318f28ea45", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", - "selected": false - }, - "position": { - "x": 1213.984802077975, - "y": 15.502280681030811 - }, - "selected": false, - "positionAbsolute": { - "x": 1213.984802077975, - "y": 15.502280681030811 + "x": 403.6067599272868, + "y": -57.773384759895634 }, "dragging": true } ], "edges": [ - { - "source": "LINSPACE-4a588ebe-8693-43ac-91f9-3ce85eac444e", - "sourceHandle": "default", - "target": "LINE-5c3fb9d2-57ce-4364-8030-96505b8ad344", - "targetHandle": "default", - "id": "reactflow__edge-LINSPACE-4a588ebe-8693-43ac-91f9-3ce85eac444edefault-LINE-5c3fb9d2-57ce-4364-8030-96505b8ad344default" - }, { "source": "TIMESERIES-511ecdda-9fd1-443e-95bb-2399e69b6484", "sourceHandle": "default", @@ -500,40 +366,12 @@ "target": "LINE-b77bfca4-130d-46b6-9962-f53f605d7107", "targetHandle": "default", "id": "reactflow__edge-MATRIX-adb7407c-2ba3-4478-8c1a-2c0d2dc1f095default-LINE-b77bfca4-130d-46b6-9962-f53f605d7107default" - }, - { - "source": "LINE-be1cb8d9-dc67-4567-8952-8b7eaeb9134d", - "sourceHandle": "default", - "target": "END-808f32a4-ad05-43db-a4f7-15318f28ea45", - "targetHandle": "default", - "id": "reactflow__edge-LINE-be1cb8d9-dc67-4567-8952-8b7eaeb9134ddefault-END-808f32a4-ad05-43db-a4f7-15318f28ea45default" - }, - { - "source": "LINE-5c3fb9d2-57ce-4364-8030-96505b8ad344", - "sourceHandle": "default", - "target": "END-808f32a4-ad05-43db-a4f7-15318f28ea45", - "targetHandle": "default", - "id": "reactflow__edge-LINE-5c3fb9d2-57ce-4364-8030-96505b8ad344default-END-808f32a4-ad05-43db-a4f7-15318f28ea45default" - }, - { - "source": "LINE-fba98010-ffc1-4864-8a5a-356f46f70a26", - "sourceHandle": "default", - "target": "END-808f32a4-ad05-43db-a4f7-15318f28ea45", - "targetHandle": "default", - "id": "reactflow__edge-LINE-fba98010-ffc1-4864-8a5a-356f46f70a26default-END-808f32a4-ad05-43db-a4f7-15318f28ea45default" - }, - { - "source": "LINE-b77bfca4-130d-46b6-9962-f53f605d7107", - "sourceHandle": "default", - "target": "END-808f32a4-ad05-43db-a4f7-15318f28ea45", - "targetHandle": "default", - "id": "reactflow__edge-LINE-b77bfca4-130d-46b6-9962-f53f605d7107default-END-808f32a4-ad05-43db-a4f7-15318f28ea45default" } ], "viewport": { - "x": -296.35399545928726, - "y": 66.8470830817738, - "zoom": 0.8744723800359967 + "x": 606.4472645567363, + "y": 234.63130388602087, + "zoom": 0.9186369849831518 } }, "ctrlsManifest": [ diff --git a/docs/nodes/VISUALIZERS/PLOTLY/PROPHET_COMPONENTS/a1-[autogen]/python_code.txt b/docs/nodes/VISUALIZERS/PLOTLY/PROPHET_COMPONENTS/a1-[autogen]/python_code.txt index 595ae0c547..ef1d1e2710 100644 --- a/docs/nodes/VISUALIZERS/PLOTLY/PROPHET_COMPONENTS/a1-[autogen]/python_code.txt +++ b/docs/nodes/VISUALIZERS/PLOTLY/PROPHET_COMPONENTS/a1-[autogen]/python_code.txt @@ -1,14 +1,73 @@ -from flojoy import flojoy, DataFrame, Plotly, DataContainer -from prophet.plot import plot_components_plotly -from prophet.serialize import model_from_json +from flojoy import flojoy, run_in_venv, DataFrame, Plotly, DataContainer @flojoy(deps={"prophet": "1.1.4", "holidays": "0.26", "pystan": "2.19.1.1"}) +@run_in_venv( + pip_dependencies=[ + "prophet==1.1.4", + ] +) def PROPHET_COMPONENTS( default: DataFrame, data: DataContainer, periods: int = 365 ) -> Plotly: + import os + import sys + import prophet + + import pandas as pd + import numpy as np + + from prophet.plot import plot_components_plotly + from prophet.serialize import model_from_json + + def _make_dummy_dataframe_for_prophet(): + Generate random time series data to test if prophet works + start_date = pd.Timestamp("2023-01-01") + end_date = pd.Timestamp("2023-07-20") + num_days = (end_date - start_date).days + 1 + timestamps = pd.date_range(start=start_date, end=end_date, freq="D") + data = np.random.randn(num_days) # Random data points + df = pd.DataFrame({"ds": timestamps, "ys": data}) + df.rename( + columns={df.columns[0]: "ds", df.columns[1]: "y"}, inplace=True + ) # PROPHET model expects first column to be `ds` and second to be `y` + return df + + def _apply_macos_prophet_hotfix(): + This is a hotfix for MacOS. See https://github.com/facebook/prophet/issues/2250#issuecomment-1559516328 for more detail + + if not sys.platform == "darwin": + return + + # Test if prophet works (i.e. if the hotfix had already been applied) + try: + _dummy_df = _make_dummy_dataframe_for_prophet() + prophet.Prophet().fit(_dummy_df) + except RuntimeError as e: + print(f"Could not run prophet, applying hotfix...") + else: + return + + prophet_dir = prophet.__path__[0] # type: ignore + # Get stan dir + stan_dir = os.path.join(prophet_dir, "stan_model") + # Find cmdstan-xxxxx dir + cmdstan_basename = [x for x in os.listdir(stan_dir) if x.startswith("cmdstan")] + assert len(cmdstan_basename) == 1, "Could not find cmdstan dir" + cmdstan_basename = cmdstan_basename[0] + # Run (from stan_dir) : install_name_tool -add_rpath @executable_path//stan/lib/stan_math/lib/tbb prophet_model.bin + cmd = f"install_name_tool -add_rpath @executable_path/{cmdstan_basename}/stan/lib/stan_math/lib/tbb prophet_model.bin" + cwd = os.getcwd() + os.chdir(stan_dir) + return_code = os.system(cmd) + os.chdir(cwd) + if return_code != 0: + raise RuntimeError("Could not apply hotfix") + + _apply_macos_prophet_hotfix() + extra = data.extra if not extra or "prophet" not in extra: raise ValueError( diff --git a/docs/nodes/VISUALIZERS/PLOTLY/PROPHET_COMPONENTS/examples/EX1/app.txt b/docs/nodes/VISUALIZERS/PLOTLY/PROPHET_COMPONENTS/examples/EX1/app.txt index 6b9c98e88e..3445a61a43 100644 --- a/docs/nodes/VISUALIZERS/PLOTLY/PROPHET_COMPONENTS/examples/EX1/app.txt +++ b/docs/nodes/VISUALIZERS/PLOTLY/PROPHET_COMPONENTS/examples/EX1/app.txt @@ -3,12 +3,12 @@ "nodes": [ { "id": "PROPHET_PREDICT-f91b407d-a959-4080-8f4f-9ccb8aaf62af", - "type": "PREDICT_TIME_SERIES", + "type": "AI_ML", "data": { "id": "PROPHET_PREDICT-f91b407d-a959-4080-8f4f-9ccb8aaf62af", "label": "PROPHET PREDICT", "func": "PROPHET_PREDICT", - "type": "PREDICT_TIME_SERIES", + "type": "AI_ML", "ctrls": { "run_forecast": { "type": "bool", @@ -40,25 +40,27 @@ "type": "DataFrame" } ], - "path": "PYTHON/nodes/AI_ML/PREDICT_TIME_SERIES/PROPHET_PREDICT/PROPHET_PREDICT.py" + "path": "PYTHON/nodes/AI_ML/PREDICT_TIME_SERIES/PROPHET_PREDICT/PROPHET_PREDICT.py", + "selected": false }, "position": { "x": 44.19991981803559, "y": 49.45240668102545 }, "width": 150, - "height": 150 + "height": 150, + "selected": false }, { "width": 130, "height": 130, "id": "TIMESERIES-9938e1c3-e758-46d4-af6e-0a764e77dfd2", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "TIMESERIES-9938e1c3-e758-46d4-af6e-0a764e77dfd2", "label": "TIMESERIES", "func": "TIMESERIES", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "start_date": { "type": "str", @@ -100,12 +102,12 @@ "width": 225, "height": 226, "id": "PROPHET_COMPONENTS-38474a31-dfa1-4d2b-8834-558ecadb82e3", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "PROPHET_COMPONENTS-38474a31-dfa1-4d2b-8834-558ecadb82e3", "label": "PROPHET COMPONENTS", "func": "PROPHET_COMPONENTS", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": { "periods": { "type": "int", @@ -148,12 +150,12 @@ "width": 225, "height": 226, "id": "PROPHET_PLOT-94b3e918-2bd3-4b08-9620-0017623eef60", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "PROPHET_PLOT-94b3e918-2bd3-4b08-9620-0017623eef60", "label": "PROPHET PLOT", "func": "PROPHET_PLOT", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": { "periods": { "type": "int", @@ -191,39 +193,6 @@ "y": 269.6217029641205 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-19d116f5-06e8-4a8c-b5ae-59b6db539708", - "type": "TERMINATORS", - "data": { - "id": "END-19d116f5-06e8-4a8c-b5ae-59b6db539708", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 724.5157287422192, - "y": 77.71454473069355 - }, - "selected": false, - "positionAbsolute": { - "x": 724.5157287422192, - "y": 77.71454473069355 - }, - "dragging": true } ], "edges": [ @@ -247,20 +216,6 @@ "target": "PROPHET_PLOT-94b3e918-2bd3-4b08-9620-0017623eef60", "targetHandle": "default", "id": "reactflow__edge-PROPHET_PREDICT-f91b407d-a959-4080-8f4f-9ccb8aaf62afdefault-PROPHET_PLOT-94b3e918-2bd3-4b08-9620-0017623eef60default" - }, - { - "source": "PROPHET_COMPONENTS-38474a31-dfa1-4d2b-8834-558ecadb82e3", - "sourceHandle": "default", - "target": "END-19d116f5-06e8-4a8c-b5ae-59b6db539708", - "targetHandle": "default", - "id": "reactflow__edge-PROPHET_COMPONENTS-38474a31-dfa1-4d2b-8834-558ecadb82e3default-END-19d116f5-06e8-4a8c-b5ae-59b6db539708default" - }, - { - "source": "PROPHET_PLOT-94b3e918-2bd3-4b08-9620-0017623eef60", - "sourceHandle": "default", - "target": "END-19d116f5-06e8-4a8c-b5ae-59b6db539708", - "targetHandle": "default", - "id": "reactflow__edge-PROPHET_PLOT-94b3e918-2bd3-4b08-9620-0017623eef60default-END-19d116f5-06e8-4a8c-b5ae-59b6db539708default" } ], "viewport": { diff --git a/docs/nodes/VISUALIZERS/PLOTLY/PROPHET_PLOT/a1-[autogen]/python_code.txt b/docs/nodes/VISUALIZERS/PLOTLY/PROPHET_PLOT/a1-[autogen]/python_code.txt index c6e41a5e16..29ff0a80ae 100644 --- a/docs/nodes/VISUALIZERS/PLOTLY/PROPHET_PLOT/a1-[autogen]/python_code.txt +++ b/docs/nodes/VISUALIZERS/PLOTLY/PROPHET_PLOT/a1-[autogen]/python_code.txt @@ -1,11 +1,71 @@ -from flojoy import flojoy, DataFrame, Plotly, DataContainer -from prophet.plot import plot_plotly -from prophet.serialize import model_from_json +from flojoy import flojoy, run_in_venv, DataFrame, Plotly, DataContainer @flojoy(deps={"prophet": "1.1.4", "holidays": "0.26", "pystan": "2.19.1.1"}) +@run_in_venv( + pip_dependencies=[ + "prophet==1.1.4", + ] +) def PROPHET_PLOT(default: DataFrame, data: DataContainer, periods: int = 365) -> Plotly: + + import os + import sys + import prophet + + import pandas as pd + import numpy as np + + from prophet.plot import plot_plotly + from prophet.serialize import model_from_json + + def _make_dummy_dataframe_for_prophet(): + Generate random time series data to test if prophet works + start_date = pd.Timestamp("2023-01-01") + end_date = pd.Timestamp("2023-07-20") + num_days = (end_date - start_date).days + 1 + timestamps = pd.date_range(start=start_date, end=end_date, freq="D") + data = np.random.randn(num_days) # Random data points + df = pd.DataFrame({"ds": timestamps, "ys": data}) + df.rename( + columns={df.columns[0]: "ds", df.columns[1]: "y"}, inplace=True + ) # PROPHET model expects first column to be `ds` and second to be `y` + return df + + def _apply_macos_prophet_hotfix(): + This is a hotfix for MacOS. See https://github.com/facebook/prophet/issues/2250#issuecomment-1559516328 for more detail + + if not sys.platform == "darwin": + return + + # Test if prophet works (i.e. if the hotfix had already been applied) + try: + _dummy_df = _make_dummy_dataframe_for_prophet() + prophet.Prophet().fit(_dummy_df) + except RuntimeError as e: + print(f"Could not run prophet, applying hotfix...") + else: + return + + prophet_dir = prophet.__path__[0] # type: ignore + # Get stan dir + stan_dir = os.path.join(prophet_dir, "stan_model") + # Find cmdstan-xxxxx dir + cmdstan_basename = [x for x in os.listdir(stan_dir) if x.startswith("cmdstan")] + assert len(cmdstan_basename) == 1, "Could not find cmdstan dir" + cmdstan_basename = cmdstan_basename[0] + # Run (from stan_dir) : install_name_tool -add_rpath @executable_path//stan/lib/stan_math/lib/tbb prophet_model.bin + cmd = f"install_name_tool -add_rpath @executable_path/{cmdstan_basename}/stan/lib/stan_math/lib/tbb prophet_model.bin" + cwd = os.getcwd() + os.chdir(stan_dir) + return_code = os.system(cmd) + os.chdir(cwd) + if return_code != 0: + raise RuntimeError("Could not apply hotfix") + + _apply_macos_prophet_hotfix() + extra = data.extra if not extra or "prophet" not in extra: raise ValueError( diff --git a/docs/nodes/VISUALIZERS/PLOTLY/PROPHET_PLOT/examples/EX1/app.txt b/docs/nodes/VISUALIZERS/PLOTLY/PROPHET_PLOT/examples/EX1/app.txt index 6b9c98e88e..3445a61a43 100644 --- a/docs/nodes/VISUALIZERS/PLOTLY/PROPHET_PLOT/examples/EX1/app.txt +++ b/docs/nodes/VISUALIZERS/PLOTLY/PROPHET_PLOT/examples/EX1/app.txt @@ -3,12 +3,12 @@ "nodes": [ { "id": "PROPHET_PREDICT-f91b407d-a959-4080-8f4f-9ccb8aaf62af", - "type": "PREDICT_TIME_SERIES", + "type": "AI_ML", "data": { "id": "PROPHET_PREDICT-f91b407d-a959-4080-8f4f-9ccb8aaf62af", "label": "PROPHET PREDICT", "func": "PROPHET_PREDICT", - "type": "PREDICT_TIME_SERIES", + "type": "AI_ML", "ctrls": { "run_forecast": { "type": "bool", @@ -40,25 +40,27 @@ "type": "DataFrame" } ], - "path": "PYTHON/nodes/AI_ML/PREDICT_TIME_SERIES/PROPHET_PREDICT/PROPHET_PREDICT.py" + "path": "PYTHON/nodes/AI_ML/PREDICT_TIME_SERIES/PROPHET_PREDICT/PROPHET_PREDICT.py", + "selected": false }, "position": { "x": 44.19991981803559, "y": 49.45240668102545 }, "width": 150, - "height": 150 + "height": 150, + "selected": false }, { "width": 130, "height": 130, "id": "TIMESERIES-9938e1c3-e758-46d4-af6e-0a764e77dfd2", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "TIMESERIES-9938e1c3-e758-46d4-af6e-0a764e77dfd2", "label": "TIMESERIES", "func": "TIMESERIES", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "start_date": { "type": "str", @@ -100,12 +102,12 @@ "width": 225, "height": 226, "id": "PROPHET_COMPONENTS-38474a31-dfa1-4d2b-8834-558ecadb82e3", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "PROPHET_COMPONENTS-38474a31-dfa1-4d2b-8834-558ecadb82e3", "label": "PROPHET COMPONENTS", "func": "PROPHET_COMPONENTS", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": { "periods": { "type": "int", @@ -148,12 +150,12 @@ "width": 225, "height": 226, "id": "PROPHET_PLOT-94b3e918-2bd3-4b08-9620-0017623eef60", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "PROPHET_PLOT-94b3e918-2bd3-4b08-9620-0017623eef60", "label": "PROPHET PLOT", "func": "PROPHET_PLOT", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": { "periods": { "type": "int", @@ -191,39 +193,6 @@ "y": 269.6217029641205 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-19d116f5-06e8-4a8c-b5ae-59b6db539708", - "type": "TERMINATORS", - "data": { - "id": "END-19d116f5-06e8-4a8c-b5ae-59b6db539708", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes/LOGIC_GATES/TERMINATORS/END/END.py", - "selected": false - }, - "position": { - "x": 724.5157287422192, - "y": 77.71454473069355 - }, - "selected": false, - "positionAbsolute": { - "x": 724.5157287422192, - "y": 77.71454473069355 - }, - "dragging": true } ], "edges": [ @@ -247,20 +216,6 @@ "target": "PROPHET_PLOT-94b3e918-2bd3-4b08-9620-0017623eef60", "targetHandle": "default", "id": "reactflow__edge-PROPHET_PREDICT-f91b407d-a959-4080-8f4f-9ccb8aaf62afdefault-PROPHET_PLOT-94b3e918-2bd3-4b08-9620-0017623eef60default" - }, - { - "source": "PROPHET_COMPONENTS-38474a31-dfa1-4d2b-8834-558ecadb82e3", - "sourceHandle": "default", - "target": "END-19d116f5-06e8-4a8c-b5ae-59b6db539708", - "targetHandle": "default", - "id": "reactflow__edge-PROPHET_COMPONENTS-38474a31-dfa1-4d2b-8834-558ecadb82e3default-END-19d116f5-06e8-4a8c-b5ae-59b6db539708default" - }, - { - "source": "PROPHET_PLOT-94b3e918-2bd3-4b08-9620-0017623eef60", - "sourceHandle": "default", - "target": "END-19d116f5-06e8-4a8c-b5ae-59b6db539708", - "targetHandle": "default", - "id": "reactflow__edge-PROPHET_PLOT-94b3e918-2bd3-4b08-9620-0017623eef60default-END-19d116f5-06e8-4a8c-b5ae-59b6db539708default" } ], "viewport": { diff --git a/docs/nodes/VISUALIZERS/PLOTLY/SCATTER/a1-[autogen]/python_code.txt b/docs/nodes/VISUALIZERS/PLOTLY/SCATTER/a1-[autogen]/python_code.txt index 7615f88994..842bf687fd 100644 --- a/docs/nodes/VISUALIZERS/PLOTLY/SCATTER/a1-[autogen]/python_code.txt +++ b/docs/nodes/VISUALIZERS/PLOTLY/SCATTER/a1-[autogen]/python_code.txt @@ -1,51 +1,56 @@ import numpy as np import pandas as pd import plotly.graph_objects as go -from flojoy import DataFrame, Matrix, OrderedPair, Plotly, flojoy +from flojoy import DataFrame, Matrix, OrderedPair, Plotly, flojoy, Vector from nodes.VISUALIZERS.template import plot_layout @flojoy -def SCATTER(default: OrderedPair | DataFrame | Matrix) -> Plotly: +def SCATTER(default: OrderedPair | DataFrame | Matrix | Vector) -> Plotly: layout = plot_layout(title="SCATTER") fig = go.Figure(layout=layout) - - if isinstance(default, OrderedPair): - x = default.x - if isinstance(default.x, dict): - dict_keys = list(default.x.keys()) - x = default.x[dict_keys[0]] - y = default.y - fig.add_trace(go.Scatter(x=x, y=y, mode="markers", marker=dict(size=4))) - elif isinstance(default, DataFrame): - df = pd.DataFrame(default.m) - first_col = df.iloc[:, 0] - is_timeseries = False - if pd.api.types.is_datetime64_any_dtype(first_col): - is_timeseries = True - if is_timeseries: - for col in df.columns: - if col != df.columns[0]: + match default: + case OrderedPair(): + x = default.x + if isinstance(default.x, dict): + dict_keys = list(default.x.keys()) + x = default.x[dict_keys[0]] + y = default.y + fig.add_trace(go.Scatter(x=x, y=y, mode="markers", marker=dict(size=4))) + case DataFrame(): + df = pd.DataFrame(default.m) + first_col = df.iloc[:, 0] + is_timeseries = False + if pd.api.types.is_datetime64_any_dtype(first_col): + is_timeseries = True + if is_timeseries: + for col in df.columns: + if col != df.columns[0]: + fig.add_trace( + go.Scatter(x=first_col, y=df[col], mode="markers", name=col) + ) + else: + for col in df.columns: fig.add_trace( - go.Scatter(x=first_col, y=df[col], mode="markers", name=col) + go.Scatter(x=df.index, y=df[col], mode="markers", name=col) ) - else: - for col in df.columns: - fig.add_trace( - go.Scatter(x=df.index, y=df[col], mode="markers", name=col) - ) - else: - m: np.ndarray = default.m - num_rows, num_cols = m.shape - x_ticks = np.arange(num_cols) + case Matrix(): + m: np.ndarray = default.m + num_rows, num_cols = m.shape - for i in range(num_rows): - fig.add_trace( - go.Scatter(x=x_ticks, y=m[i, :], name=f"Row {i+1}", mode="markers") - ) + x_ticks = np.arange(num_cols) + + for i in range(num_rows): + fig.add_trace( + go.Scatter(x=x_ticks, y=m[i, :], name=f"Row {i+1}", mode="markers") + ) - fig.update_layout(xaxis_title="Column", yaxis_title="Value") + fig.update_layout(xaxis_title="Column", yaxis_title="Value") + case Vector(): + y = default.v + x = np.arange(len(y)) + fig.add_trace(go.Scatter(x=x, y=y, mode="markers", marker=dict(size=4))) return Plotly(fig=fig) diff --git a/docs/nodes/VISUALIZERS/PLOTLY/SCATTER/examples/EX1/app.txt b/docs/nodes/VISUALIZERS/PLOTLY/SCATTER/examples/EX1/app.txt index 5b82e6514b..5cbf9f492f 100644 --- a/docs/nodes/VISUALIZERS/PLOTLY/SCATTER/examples/EX1/app.txt +++ b/docs/nodes/VISUALIZERS/PLOTLY/SCATTER/examples/EX1/app.txt @@ -2,15 +2,15 @@ "rfInstance": { "nodes": [ { - "width": 150, - "height": 150, + "width": 208, + "height": 96, "id": "PLOTLY_DATASET-686a1fd9-8dab-4de2-80d6-21386dc65e34", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "data": { "id": "PLOTLY_DATASET-686a1fd9-8dab-4de2-80d6-21386dc65e34", "label": "PLOTLY DATASET", "func": "PLOTLY_DATASET", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "ctrls": { "dataset_key": { "type": "select", @@ -44,79 +44,25 @@ }, "position": { "x": 96.7381246005109, - "y": 778.0447835342841 + "y": 744.7785434386891 }, "selected": false, "positionAbsolute": { "x": 96.7381246005109, - "y": 778.0447835342841 + "y": 744.7785434386891 }, "dragging": true }, { - "width": 150, - "height": 150, - "id": "LINSPACE-a64efc87-8757-466c-b903-f0f556303dbe", - "type": "default", - "data": { - "id": "LINSPACE-a64efc87-8757-466c-b903-f0f556303dbe", - "label": "LINSPACE", - "func": "LINSPACE", - "type": "default", - "ctrls": { - "start": { - "type": "float", - "default": 10, - "functionName": "LINSPACE", - "param": "start", - "value": 10 - }, - "end": { - "type": "float", - "default": 0, - "functionName": "LINSPACE", - "param": "end", - "value": 0 - }, - "step": { - "type": "int", - "default": 1000, - "functionName": "LINSPACE", - "param": "step", - "value": 1000 - } - }, - "outputs": [ - { - "name": "default", - "id": "default", - "type": "OrderedPair" - } - ], - "path": "PYTHON/nodes\\GENERATORS\\SIMULATIONS\\LINSPACE\\LINSPACE.py", - "selected": false - }, - "position": { - "x": 124.47121112924117, - "y": 69.80390115946057 - }, - "selected": false, - "positionAbsolute": { - "x": 124.47121112924117, - "y": 69.80390115946057 - }, - "dragging": true - }, - { - "width": 130, - "height": 130, + "width": 208, + "height": 96, "id": "TIMESERIES-a11c4d23-595e-4325-91ab-6901e4626395", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "TIMESERIES-a11c4d23-595e-4325-91ab-6901e4626395", "label": "TIMESERIES", "func": "TIMESERIES", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "start_date": { "type": "str", @@ -144,26 +90,26 @@ "selected": false }, "position": { - "x": 97.2082941714267, - "y": 295.30525026292963 + "x": 96.06118244399238, + "y": 329.71860208595893 }, "selected": false, "positionAbsolute": { - "x": 97.2082941714267, - "y": 295.30525026292963 + "x": 96.06118244399238, + "y": 329.71860208595893 }, "dragging": true }, { - "width": 130, - "height": 130, + "width": 208, + "height": 96, "id": "MATRIX-8f1eae39-3d4b-4382-a18a-8db31ab0e1a8", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "MATRIX-8f1eae39-3d4b-4382-a18a-8db31ab0e1a8", "label": "MATRIX", "func": "MATRIX", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "row": { "type": "int", @@ -202,15 +148,15 @@ "dragging": true }, { - "width": 225, - "height": 226, + "width": 380, + "height": 293, "id": "SCATTER-8f064bb5-af44-44fd-82f4-9a948f3695b5", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "SCATTER-8f064bb5-af44-44fd-82f4-9a948f3695b5", "label": "SCATTER", "func": "SCATTER", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -231,26 +177,26 @@ "selected": false }, "position": { - "x": 390.21358494564254, - "y": 475.08598948716053 + "x": 345.47622757570446, + "y": 453.29086666590865 }, "selected": false, "positionAbsolute": { - "x": 390.21358494564254, - "y": 475.08598948716053 + "x": 345.47622757570446, + "y": 453.29086666590865 }, "dragging": true }, { - "width": 225, - "height": 226, + "width": 380, + "height": 293, "id": "SCATTER-bbfa1109-425d-457f-8f4f-bd6477f6ed0f", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "SCATTER-bbfa1109-425d-457f-8f4f-bd6477f6ed0f", "label": "SCATTER 1", "func": "SCATTER", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -271,26 +217,26 @@ "selected": false }, "position": { - "x": 811.8934636655582, - "y": 675.522722190246 + "x": 761.4205476584486, + "y": 659.4631580061657 }, "selected": false, "positionAbsolute": { - "x": 811.8934636655582, - "y": 675.522722190246 + "x": 761.4205476584486, + "y": 659.4631580061657 }, "dragging": true }, { - "width": 225, - "height": 226, + "width": 380, + "height": 293, "id": "SCATTER-a4744b2a-78e6-4874-a2ae-177e1dd6aa82", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "SCATTER-a4744b2a-78e6-4874-a2ae-177e1dd6aa82", "label": "SCATTER 2", "func": "SCATTER", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -311,98 +257,18 @@ "selected": false }, "position": { - "x": 672.4493562892767, - "y": 250.79752408205673 + "x": 713.7453784769118, + "y": 248.50330062718808 }, "selected": false, "positionAbsolute": { - "x": 672.4493562892767, - "y": 250.79752408205673 - }, - "dragging": true - }, - { - "width": 225, - "height": 226, - "id": "SCATTER-fac44ad1-a863-4a6c-87f6-b43c5ca4631a", - "type": "PLOTLY", - "data": { - "id": "SCATTER-fac44ad1-a863-4a6c-87f6-b43c5ca4631a", - "label": "SCATTER 3", - "func": "SCATTER", - "type": "PLOTLY", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "OrderedPair|DataFrame|Matrix", - "multiple": false - } - ], - "outputs": [ - { - "name": "default", - "id": "default", - "type": "Plotly" - } - ], - "path": "PYTHON/nodes\\VISUALIZERS\\PLOTLY\\SCATTER\\SCATTER.py", - "selected": false - }, - "position": { - "x": 399.57597716039686, - "y": -0.14382278524794856 - }, - "selected": false, - "positionAbsolute": { - "x": 399.57597716039686, - "y": -0.14382278524794856 - }, - "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-fc54d745-26c4-42ba-be36-eafbe5f5a240", - "type": "TERMINATORS", - "data": { - "id": "END-fc54d745-26c4-42ba-be36-eafbe5f5a240", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", - "selected": false - }, - "position": { - "x": 1304.312408118375, - "y": 329.9324838900597 - }, - "selected": false, - "positionAbsolute": { - "x": 1304.312408118375, - "y": 329.9324838900597 + "x": 713.7453784769118, + "y": 248.50330062718808 }, "dragging": true } ], "edges": [ - { - "source": "LINSPACE-a64efc87-8757-466c-b903-f0f556303dbe", - "sourceHandle": "default", - "target": "SCATTER-fac44ad1-a863-4a6c-87f6-b43c5ca4631a", - "targetHandle": "default", - "id": "reactflow__edge-LINSPACE-a64efc87-8757-466c-b903-f0f556303dbedefault-SCATTER-fac44ad1-a863-4a6c-87f6-b43c5ca4631adefault" - }, { "source": "TIMESERIES-a11c4d23-595e-4325-91ab-6901e4626395", "sourceHandle": "default", @@ -423,40 +289,12 @@ "target": "SCATTER-bbfa1109-425d-457f-8f4f-bd6477f6ed0f", "targetHandle": "default", "id": "reactflow__edge-PLOTLY_DATASET-686a1fd9-8dab-4de2-80d6-21386dc65e34default-SCATTER-bbfa1109-425d-457f-8f4f-bd6477f6ed0fdefault" - }, - { - "source": "SCATTER-fac44ad1-a863-4a6c-87f6-b43c5ca4631a", - "sourceHandle": "default", - "target": "END-fc54d745-26c4-42ba-be36-eafbe5f5a240", - "targetHandle": "default", - "id": "reactflow__edge-SCATTER-fac44ad1-a863-4a6c-87f6-b43c5ca4631adefault-END-fc54d745-26c4-42ba-be36-eafbe5f5a240default" - }, - { - "source": "SCATTER-a4744b2a-78e6-4874-a2ae-177e1dd6aa82", - "sourceHandle": "default", - "target": "END-fc54d745-26c4-42ba-be36-eafbe5f5a240", - "targetHandle": "default", - "id": "reactflow__edge-SCATTER-a4744b2a-78e6-4874-a2ae-177e1dd6aa82default-END-fc54d745-26c4-42ba-be36-eafbe5f5a240default" - }, - { - "source": "SCATTER-8f064bb5-af44-44fd-82f4-9a948f3695b5", - "sourceHandle": "default", - "target": "END-fc54d745-26c4-42ba-be36-eafbe5f5a240", - "targetHandle": "default", - "id": "reactflow__edge-SCATTER-8f064bb5-af44-44fd-82f4-9a948f3695b5default-END-fc54d745-26c4-42ba-be36-eafbe5f5a240default" - }, - { - "source": "SCATTER-bbfa1109-425d-457f-8f4f-bd6477f6ed0f", - "sourceHandle": "default", - "target": "END-fc54d745-26c4-42ba-be36-eafbe5f5a240", - "targetHandle": "default", - "id": "reactflow__edge-SCATTER-bbfa1109-425d-457f-8f4f-bd6477f6ed0fdefault-END-fc54d745-26c4-42ba-be36-eafbe5f5a240default" } ], "viewport": { - "x": -296.35399545928726, - "y": 66.8470830817738, - "zoom": 0.8744723800359967 + "x": 606.4472645567363, + "y": 234.63130388602087, + "zoom": 0.9186369849831518 } }, "ctrlsManifest": [ diff --git a/docs/nodes/VISUALIZERS/PLOTLY/SCATTER3D/examples/EX1/app.txt b/docs/nodes/VISUALIZERS/PLOTLY/SCATTER3D/examples/EX1/app.txt index 702ed67ace..2c93687618 100644 --- a/docs/nodes/VISUALIZERS/PLOTLY/SCATTER3D/examples/EX1/app.txt +++ b/docs/nodes/VISUALIZERS/PLOTLY/SCATTER3D/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 150, "height": 150, "id": "PLOTLY_DATASET-6af3469b-5751-4778-84a1-2b17bc9c0894", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "data": { "id": "PLOTLY_DATASET-6af3469b-5751-4778-84a1-2b17bc9c0894", "label": "PLOTLY DATASET", "func": "PLOTLY_DATASET", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "ctrls": { "dataset_key": { "type": "select", @@ -53,49 +53,16 @@ }, "dragging": true }, - { - "width": 210, - "height": 130, - "id": "END-9bf7a22c-ae80-4214-ae2e-28a5d7e83d81", - "type": "TERMINATORS", - "data": { - "id": "END-9bf7a22c-ae80-4214-ae2e-28a5d7e83d81", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", - "selected": false - }, - "position": { - "x": 970.0654328891447, - "y": 129.05154701626657 - }, - "selected": false, - "positionAbsolute": { - "x": 970.0654328891447, - "y": 129.05154701626657 - }, - "dragging": true - }, { "width": 150, "height": 150, "id": "DF_2_ORDEREDTRIPLE-a3a65384-680c-4114-81e1-476ec8835a58", - "type": "TYPE_CASTING", + "type": "TRANSFORMERS", "data": { "id": "DF_2_ORDEREDTRIPLE-a3a65384-680c-4114-81e1-476ec8835a58", "label": "DF 2 ORDEREDTRIPLE", "func": "DF_2_ORDEREDTRIPLE", - "type": "TYPE_CASTING", + "type": "TRANSFORMERS", "ctrls": { "x": { "type": "int", @@ -152,12 +119,12 @@ "width": 225, "height": 226, "id": "SCATTER3D-27578128-aa7b-40fe-8dfd-d971192bba27", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "SCATTER3D-27578128-aa7b-40fe-8dfd-d971192bba27", "label": "SCATTER3D 1", "func": "SCATTER3D", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -192,12 +159,12 @@ "width": 225, "height": 226, "id": "SCATTER3D-0ba51c41-646b-47e4-a6e0-a306230f4ec6", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "SCATTER3D-0ba51c41-646b-47e4-a6e0-a306230f4ec6", "label": "SCATTER3D 1", "func": "SCATTER3D", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -244,26 +211,12 @@ "targetHandle": "default", "id": "reactflow__edge-PLOTLY_DATASET-6af3469b-5751-4778-84a1-2b17bc9c0894default-SCATTER3D-27578128-aa7b-40fe-8dfd-d971192bba27default" }, - { - "source": "SCATTER3D-27578128-aa7b-40fe-8dfd-d971192bba27", - "sourceHandle": "default", - "target": "END-9bf7a22c-ae80-4214-ae2e-28a5d7e83d81", - "targetHandle": "default", - "id": "reactflow__edge-SCATTER3D-27578128-aa7b-40fe-8dfd-d971192bba27default-END-9bf7a22c-ae80-4214-ae2e-28a5d7e83d81default" - }, { "source": "DF_2_ORDEREDTRIPLE-a3a65384-680c-4114-81e1-476ec8835a58", "sourceHandle": "default", "target": "SCATTER3D-0ba51c41-646b-47e4-a6e0-a306230f4ec6", "targetHandle": "default", "id": "reactflow__edge-DF_2_ORDEREDTRIPLE-a3a65384-680c-4114-81e1-476ec8835a58default-SCATTER3D-0ba51c41-646b-47e4-a6e0-a306230f4ec6default" - }, - { - "source": "SCATTER3D-0ba51c41-646b-47e4-a6e0-a306230f4ec6", - "sourceHandle": "default", - "target": "END-9bf7a22c-ae80-4214-ae2e-28a5d7e83d81", - "targetHandle": "default", - "id": "reactflow__edge-SCATTER3D-0ba51c41-646b-47e4-a6e0-a306230f4ec6default-END-9bf7a22c-ae80-4214-ae2e-28a5d7e83d81default" } ], "viewport": { diff --git a/docs/nodes/VISUALIZERS/PLOTLY/SURFACE3D/examples/EX1/app.txt b/docs/nodes/VISUALIZERS/PLOTLY/SURFACE3D/examples/EX1/app.txt index 4bf5cb72aa..b438a7afd9 100644 --- a/docs/nodes/VISUALIZERS/PLOTLY/SURFACE3D/examples/EX1/app.txt +++ b/docs/nodes/VISUALIZERS/PLOTLY/SURFACE3D/examples/EX1/app.txt @@ -5,12 +5,12 @@ "width": 150, "height": 150, "id": "PLOTLY_DATASET-5a7231e7-7fa7-480f-9562-c117499c99cd", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "data": { "id": "PLOTLY_DATASET-5a7231e7-7fa7-480f-9562-c117499c99cd", "label": "PLOTLY DATASET", "func": "PLOTLY_DATASET", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "ctrls": { "dataset_key": { "type": "select", @@ -57,12 +57,12 @@ "width": 150, "height": 150, "id": "DF_2_ORDEREDTRIPLE-c2918872-5cb8-4469-b2c7-3e2ab878d204", - "type": "TYPE_CASTING", + "type": "TRANSFORMERS", "data": { "id": "DF_2_ORDEREDTRIPLE-c2918872-5cb8-4469-b2c7-3e2ab878d204", "label": "DF 2 ORDEREDTRIPLE", "func": "DF_2_ORDEREDTRIPLE", - "type": "TYPE_CASTING", + "type": "TRANSFORMERS", "ctrls": { "x": { "type": "int", @@ -119,12 +119,12 @@ "width": 150, "height": 150, "id": "ORDERED_TRIPLE_2_SURFACE-810534da-2e75-4d23-b28a-d07602ab0cf3", - "type": "TYPE_CASTING", + "type": "TRANSFORMERS", "data": { "id": "ORDERED_TRIPLE_2_SURFACE-810534da-2e75-4d23-b28a-d07602ab0cf3", "label": "ORDERED TRIPLE 2 SURFACE", "func": "ORDERED_TRIPLE_2_SURFACE", - "type": "TYPE_CASTING", + "type": "TRANSFORMERS", "ctrls": {}, "inputs": [ { @@ -155,49 +155,16 @@ }, "dragging": true }, - { - "width": 210, - "height": 130, - "id": "END-27d70d41-6ff3-4222-9fa6-7278850d6cff", - "type": "TERMINATORS", - "data": { - "id": "END-27d70d41-6ff3-4222-9fa6-7278850d6cff", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", - "selected": false - }, - "position": { - "x": 1588.466529442917, - "y": 230.5106635506924 - }, - "selected": false, - "positionAbsolute": { - "x": 1588.466529442917, - "y": 230.5106635506924 - }, - "dragging": true - }, { "width": 130, "height": 130, "id": "MATRIX-a7f20c72-1c4e-4e31-9b3f-94cf1f228fd5", - "type": "SIMULATIONS", + "type": "GENERATORS", "data": { "id": "MATRIX-a7f20c72-1c4e-4e31-9b3f-94cf1f228fd5", "label": "MATRIX", "func": "MATRIX", - "type": "SIMULATIONS", + "type": "GENERATORS", "ctrls": { "row": { "type": "int", @@ -239,12 +206,12 @@ "width": 380, "height": 293, "id": "SURFACE3D-62cf3ecc-359b-4cd4-ad49-bd0e6995a522", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "SURFACE3D-62cf3ecc-359b-4cd4-ad49-bd0e6995a522", "label": "SURFACE3D 1", "func": "SURFACE3D", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -279,12 +246,12 @@ "width": 380, "height": 293, "id": "SURFACE3D-8be10741-50fe-4df3-b2a5-afdcf56c1035", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "SURFACE3D-8be10741-50fe-4df3-b2a5-afdcf56c1035", "label": "SURFACE3D 2", "func": "SURFACE3D", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -319,12 +286,12 @@ "width": 380, "height": 293, "id": "SURFACE3D-19305f4e-d1e0-489b-adc7-383816dd5f49", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "SURFACE3D-19305f4e-d1e0-489b-adc7-383816dd5f49", "label": "SURFACE3D 3", "func": "SURFACE3D", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -359,12 +326,12 @@ "width": 380, "height": 293, "id": "SURFACE3D-f4e1f4c2-c6fe-4a06-b7ad-89ffab8a1c01", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "SURFACE3D-f4e1f4c2-c6fe-4a06-b7ad-89ffab8a1c01", "label": "SURFACE3D 3", "func": "SURFACE3D", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -432,26 +399,12 @@ "targetHandle": "default", "id": "reactflow__edge-DF_2_ORDEREDTRIPLE-c2918872-5cb8-4469-b2c7-3e2ab878d204default-SURFACE3D-62cf3ecc-359b-4cd4-ad49-bd0e6995a522default" }, - { - "source": "SURFACE3D-8be10741-50fe-4df3-b2a5-afdcf56c1035", - "sourceHandle": "default", - "target": "END-27d70d41-6ff3-4222-9fa6-7278850d6cff", - "targetHandle": "default", - "id": "reactflow__edge-SURFACE3D-8be10741-50fe-4df3-b2a5-afdcf56c1035default-END-27d70d41-6ff3-4222-9fa6-7278850d6cffdefault" - }, { "source": "ORDERED_TRIPLE_2_SURFACE-810534da-2e75-4d23-b28a-d07602ab0cf3", "sourceHandle": "default", "target": "SURFACE3D-f4e1f4c2-c6fe-4a06-b7ad-89ffab8a1c01", "targetHandle": "default", "id": "reactflow__edge-ORDERED_TRIPLE_2_SURFACE-810534da-2e75-4d23-b28a-d07602ab0cf3default-SURFACE3D-f4e1f4c2-c6fe-4a06-b7ad-89ffab8a1c01default" - }, - { - "source": "SURFACE3D-f4e1f4c2-c6fe-4a06-b7ad-89ffab8a1c01", - "sourceHandle": "default", - "target": "END-27d70d41-6ff3-4222-9fa6-7278850d6cff", - "targetHandle": "default", - "id": "reactflow__edge-SURFACE3D-f4e1f4c2-c6fe-4a06-b7ad-89ffab8a1c01default-END-27d70d41-6ff3-4222-9fa6-7278850d6cffdefault" } ], "viewport": { diff --git a/docs/nodes/VISUALIZERS/PLOTLY/TABLE/examples/EX1/app.txt b/docs/nodes/VISUALIZERS/PLOTLY/TABLE/examples/EX1/app.txt index 6d5a7da965..87eedd42eb 100644 --- a/docs/nodes/VISUALIZERS/PLOTLY/TABLE/examples/EX1/app.txt +++ b/docs/nodes/VISUALIZERS/PLOTLY/TABLE/examples/EX1/app.txt @@ -59,12 +59,12 @@ "width": 150, "height": 150, "id": "R_DATASET-44eaa566-97ed-4dca-a9c5-0bcb7f680ad8", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "data": { "id": "R_DATASET-44eaa566-97ed-4dca-a9c5-0bcb7f680ad8", "label": "R DATASET", "func": "R_DATASET", - "type": "SAMPLE_DATASETS", + "type": "GENERATORS", "ctrls": { "dataset_key": { "type": "select", @@ -188,12 +188,12 @@ "width": 380, "height": 293, "id": "TABLE-41e3d344-1ece-4eb2-adb8-dc944c80b49b", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "TABLE-41e3d344-1ece-4eb2-adb8-dc944c80b49b", "label": "TABLE", "func": "TABLE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -228,12 +228,12 @@ "width": 225, "height": 226, "id": "TABLE-57c89935-c3df-4ba4-a8a5-f53534c47ee9", - "type": "PLOTLY", + "type": "VISUALIZERS", "data": { "id": "TABLE-57c89935-c3df-4ba4-a8a5-f53534c47ee9", "label": "TABLE 1", "func": "TABLE", - "type": "PLOTLY", + "type": "VISUALIZERS", "ctrls": {}, "inputs": [ { @@ -263,39 +263,6 @@ "y": 379.87310163004656 }, "dragging": true - }, - { - "width": 210, - "height": 130, - "id": "END-d43f4851-88ee-4a28-9c4f-e9db6f5e16fd", - "type": "TERMINATORS", - "data": { - "id": "END-d43f4851-88ee-4a28-9c4f-e9db6f5e16fd", - "label": "END", - "func": "END", - "type": "TERMINATORS", - "ctrls": {}, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "Any", - "multiple": false - } - ], - "path": "PYTHON/nodes\\LOGIC_GATES\\TERMINATORS\\END\\END.py", - "selected": true - }, - "position": { - "x": 1068.5159374760876, - "y": 275.58738734433257 - }, - "selected": true, - "positionAbsolute": { - "x": 1068.5159374760876, - "y": 275.58738734433257 - }, - "dragging": true } ], "edges": [ @@ -312,20 +279,6 @@ "target": "TABLE-41e3d344-1ece-4eb2-adb8-dc944c80b49b", "targetHandle": "default", "id": "reactflow__edge-LINSPACE-96f418c8-14ed-4457-abea-9520da6d5078default-TABLE-41e3d344-1ece-4eb2-adb8-dc944c80b49bdefault" - }, - { - "source": "TABLE-41e3d344-1ece-4eb2-adb8-dc944c80b49b", - "sourceHandle": "default", - "target": "END-d43f4851-88ee-4a28-9c4f-e9db6f5e16fd", - "targetHandle": "default", - "id": "reactflow__edge-TABLE-41e3d344-1ece-4eb2-adb8-dc944c80b49bdefault-END-d43f4851-88ee-4a28-9c4f-e9db6f5e16fddefault" - }, - { - "source": "TABLE-57c89935-c3df-4ba4-a8a5-f53534c47ee9", - "sourceHandle": "default", - "target": "END-d43f4851-88ee-4a28-9c4f-e9db6f5e16fd", - "targetHandle": "default", - "id": "reactflow__edge-TABLE-57c89935-c3df-4ba4-a8a5-f53534c47ee9default-END-d43f4851-88ee-4a28-9c4f-e9db6f5e16fddefault" } ], "viewport": { diff --git a/nodeSidebar.json b/nodeSidebar.json index 9809ea591c..6b3e23150e 100644 --- a/nodeSidebar.json +++ b/nodeSidebar.json @@ -37,7 +37,8 @@ "nodes/GENERATORS/SIMULATIONS/RAND/RAND", "nodes/GENERATORS/SIMULATIONS/SECOND_ORDER_SYSTEM/SECOND_ORDER_SYSTEM", "nodes/GENERATORS/SIMULATIONS/SINE/SINE", - "nodes/GENERATORS/SIMULATIONS/TIMESERIES/TIMESERIES" + "nodes/GENERATORS/SIMULATIONS/TIMESERIES/TIMESERIES", + "nodes/GENERATORS/SIMULATIONS/WAVEPACKET/WAVEPACKET" ], "Data > Generate > Synthetic Data > DATAFRAMES": [ "nodes/GENERATORS/SAMPLE_DATASETS/PLOTLY_DATASET/PLOTLY_DATASET", @@ -49,7 +50,8 @@ ], "Data > Visualize > Data Structure": [ "nodes/VISUALIZERS/DATA_STRUCTURE/ARRAY_VIEW/ARRAY_VIEW", - "nodes/VISUALIZERS/DATA_STRUCTURE/MATRIX_VIEW/MATRIX_VIEW" + "nodes/VISUALIZERS/DATA_STRUCTURE/MATRIX_VIEW/MATRIX_VIEW", + "nodes/VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/TEXT_VIEW" ], "Data > Visualize > Plotly": [ "nodes/VISUALIZERS/PLOTLY/BAR/BAR",