diff --git a/docs/nodes/GAMES/GAMES_MATRIX/SNAKE_GAME/SNAKE_GAME.md b/docs/nodes/GAMES/GAMES_MATRIX/SNAKE_GAME/SNAKE_GAME.md new file mode 100644 index 0000000000..79609742ec --- /dev/null +++ b/docs/nodes/GAMES/GAMES_MATRIX/SNAKE_GAME/SNAKE_GAME.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.json'; + + + + + {App1} + + + + + + + + +[//]: # (Appendix) + +import Notes from './appendix/notes.md'; +import Hardware from './appendix/hardware.md'; +import Media from './appendix/media.md'; + +## Appendix + + + + + + diff --git a/docs/nodes/GAMES/GAMES_MATRIX/SNAKE_GAME/a1-[autogen]/docstring.txt b/docs/nodes/GAMES/GAMES_MATRIX/SNAKE_GAME/a1-[autogen]/docstring.txt new file mode 100644 index 0000000000..cce7f28959 --- /dev/null +++ b/docs/nodes/GAMES/GAMES_MATRIX/SNAKE_GAME/a1-[autogen]/docstring.txt @@ -0,0 +1,2 @@ +The SNAKE_GAME node is a specialized node that iterates through the body nodes for a given number of times. + To ensure proper functionality, the SNAKE_GAME node relies on a companion node called the `GOTO` node. diff --git a/docs/nodes/GAMES/GAMES_MATRIX/SNAKE_GAME/a1-[autogen]/python_code.txt b/docs/nodes/GAMES/GAMES_MATRIX/SNAKE_GAME/a1-[autogen]/python_code.txt new file mode 100644 index 0000000000..3840561013 --- /dev/null +++ b/docs/nodes/GAMES/GAMES_MATRIX/SNAKE_GAME/a1-[autogen]/python_code.txt @@ -0,0 +1,183 @@ +import json +import random +from flojoy import flojoy, DataContainer +import numpy as np + +from flojoy.small_memory import SmallMemory + + +memory_key = "snake_game_info" +snake_dimension = 22 + + +class SnakeData: + def __init__( + self, + node_id, + x_coords=[int(snake_dimension / 2)], + y_coords=[int(snake_dimension / 2)], + delta_x=0, + delta_y=1, + is_finished=False, + food_x=int(snake_dimension / 2), + food_y=snake_dimension - 4, + to_grow=False, + ) -> None: + self.node_id = node_id + self.x_coords = x_coords + self.y_coords = y_coords + self.delta_x = delta_x + self.delta_y = delta_y + self.is_finished = bool(is_finished) + self.food_x = food_x + self.food_y = food_y + self.to_grow = to_grow + + def get_data(self): + return self.__dict__ + + @staticmethod + def from_data(node_id, data: dict): + if len(data) == 0: + return SnakeData(node_id) + snake_data = SnakeData(**data) + return snake_data + + def print(self, prefix=""): + print(f"{prefix}snake Data:", json.dumps(self.get_data(), indent=2)) + + +@flojoy +def SNAKE_GAME(dc_inputs: list[DataContainer], params: dict) -> dict: + + + # get snake game data + control_input = dc_inputs[0] + + if control_input.type != "ordered_pair": + raise ValueError( + f"unsupported DataContainer type passed for SNAKE_GAME: {control_input.type}" + ) + + node_id = params.get( + "node_id", 0 + ) # WARNING: special case, it gets the node id from the params despite not being specified + print("NODE ID IS: ", node_id) + snake_data: SnakeData = load_data(node_id) + + # get control inputs + delta_x = snake_data.delta_x + delta_y = snake_data.delta_y + if control_input.y[8]: + delta_x += -1 + delta_y = 0 + elif control_input.y[9]: + delta_x += 1 + delta_y = 0 + elif control_input.y[6]: + delta_y += -1 + delta_x = 0 + elif control_input.y[7]: + delta_y += 1 + delta_x = 0 + + if delta_x + delta_y != 0: + snake_data.delta_x = int(delta_x / (abs(delta_x)) if delta_x != 0 else 0) + snake_data.delta_y = int(delta_y / (abs(delta_y)) if delta_y != 0 else 0) + + # update snake position + snake_data.x_coords.insert(0, snake_data.x_coords[0] + snake_data.delta_x) + snake_data.y_coords.insert(0, snake_data.y_coords[0] + snake_data.delta_y) + if not snake_data.to_grow: + snake_data.x_coords.pop() + snake_data.y_coords.pop() + else: + snake_data.to_grow = False + + # check if out of bounds + if ( + snake_data.x_coords[0] < 0 + or snake_data.x_coords[0] > snake_dimension - 1 + or snake_data.y_coords[0] < 0 + or snake_data.y_coords[0] > snake_dimension - 1 + ): + snake_data.is_finished = True + + # check if snake is eating itself + for i in range(len(snake_data.x_coords)): + if i == 0: + continue + if ( + snake_data.x_coords[0] == snake_data.x_coords[i] + and snake_data.y_coords[0] == snake_data.y_coords[i] + ): + snake_data.is_finished = True + + if snake_data.is_finished: + print("GAME OVER, RESETTING") + snake_data = SnakeData(node_id) + store_data(node_id, snake_data) + return output_game(snake_data) + + # check if snake is eating food + if ( + snake_data.x_coords[0] == snake_data.food_x + and snake_data.y_coords[0] == snake_data.food_y + ): + snake_data.to_grow = True + next_x, next_y = get_next_food_spot(snake_data) + snake_data.food_x = next_x + snake_data.food_y = next_y + + # store snake game data + store_data(node_id, snake_data) + + # output game + return output_game(snake_data) + + +def load_data(node_id) -> SnakeData: + data = SmallMemory().read_memory(node_id, memory_key) or {} + print("LOAD DATA IS ", data) + snake_data = SnakeData.from_data(node_id=node_id, data=data) + return snake_data + + +def store_data(node_id, snake_data: SnakeData): + SmallMemory().write_to_memory(node_id, memory_key, snake_data.get_data()) + snake_data.print("store snake game data") + + +def get_next_food_spot(snake_data): + taken = set() + for i in range(len(snake_data.x_coords)): + taken.add((snake_data.x_coords[i], snake_data.y_coords[i])) + + free = set() + for i in range(snake_dimension): + for j in range(snake_dimension): + if (i, j) not in taken: + free.add((i, j)) + + return random.choice(list(free)) + + +# def delete_data(node_id): +# SmallMemory().delete_object(node_id, memory_key) +# print("delete snake game data") + + +def output_game(snake_data): + r = [[10 for i in range(snake_dimension)] for j in range(snake_dimension)] + g = [[10 for i in range(snake_dimension)] for j in range(snake_dimension)] + b = [[10 for i in range(snake_dimension)] for j in range(snake_dimension)] + for i in range(len(snake_data.x_coords)): + x_coord = snake_data.x_coords[i] + y_coord = snake_data.y_coords[i] + g[y_coord][x_coord] = 255 + r[snake_data.food_y][snake_data.food_x] = 255 + dc = DataContainer( + type="image", r=np.array(r), g=np.array(g), b=np.array(b), a=None + ) + print("OUTPUT GAME IS ", dc) + return dc diff --git a/docs/nodes/GAMES/GAMES_MATRIX/SNAKE_GAME/appendix/hardware.md b/docs/nodes/GAMES/GAMES_MATRIX/SNAKE_GAME/appendix/hardware.md new file mode 100644 index 0000000000..7f78a555c4 --- /dev/null +++ b/docs/nodes/GAMES/GAMES_MATRIX/SNAKE_GAME/appendix/hardware.md @@ -0,0 +1 @@ +This node does not require any peripheral hardware to operate. Please see INSTRUMENTS for nodes that interact with the physical world through connected hardware. \ No newline at end of file diff --git a/docs/nodes/GAMES/GAMES_MATRIX/SNAKE_GAME/appendix/media.md b/docs/nodes/GAMES/GAMES_MATRIX/SNAKE_GAME/appendix/media.md new file mode 100644 index 0000000000..8bcee9be90 --- /dev/null +++ b/docs/nodes/GAMES/GAMES_MATRIX/SNAKE_GAME/appendix/media.md @@ -0,0 +1 @@ +No supporting screenshots, photos, or videos have been added to the media.md file for this node. \ No newline at end of file diff --git a/docs/nodes/GAMES/GAMES_MATRIX/SNAKE_GAME/appendix/notes.md b/docs/nodes/GAMES/GAMES_MATRIX/SNAKE_GAME/appendix/notes.md new file mode 100644 index 0000000000..04aded2ec9 --- /dev/null +++ b/docs/nodes/GAMES/GAMES_MATRIX/SNAKE_GAME/appendix/notes.md @@ -0,0 +1 @@ +No theory or technical notes have been contributed for this node yet. \ No newline at end of file diff --git a/docs/nodes/INSTRUMENTS/CONTROLLER/GAMEPAD/GAMEPAD.md b/docs/nodes/INSTRUMENTS/CONTROLLER/GAMEPAD/GAMEPAD.md new file mode 100644 index 0000000000..7cc1a71897 --- /dev/null +++ b/docs/nodes/INSTRUMENTS/CONTROLLER/GAMEPAD/GAMEPAD.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.json'; + + + + + {App1} + + + + + + + + +[//]: # (Appendix) + +import Notes from './appendix/notes.md'; +import Hardware from './appendix/hardware.md'; +import Media from './appendix/media.md'; + +## Appendix + + + + + + diff --git a/docs/nodes/INSTRUMENTS/CONTROLLER/GAMEPAD/a1-[autogen]/docstring.txt b/docs/nodes/INSTRUMENTS/CONTROLLER/GAMEPAD/a1-[autogen]/docstring.txt new file mode 100644 index 0000000000..5e7bfcf2cc --- /dev/null +++ b/docs/nodes/INSTRUMENTS/CONTROLLER/GAMEPAD/a1-[autogen]/docstring.txt @@ -0,0 +1,5 @@ + +The GAMEPAD node reads the input from a gamepad and returns a DataContainer with the following structure: +- it is of type ordered pair +- the x value indicates how many buttons are available +- the y value is a numpy array of booleans indicating which buttons are pressed diff --git a/docs/nodes/INSTRUMENTS/CONTROLLER/GAMEPAD/a1-[autogen]/python_code.txt b/docs/nodes/INSTRUMENTS/CONTROLLER/GAMEPAD/a1-[autogen]/python_code.txt new file mode 100644 index 0000000000..f013479d68 --- /dev/null +++ b/docs/nodes/INSTRUMENTS/CONTROLLER/GAMEPAD/a1-[autogen]/python_code.txt @@ -0,0 +1,74 @@ +from typing import Optional +import hid +import numpy as np +from flojoy import OrderedPair, flojoy, DataContainer + + +@flojoy +def GAMEPAD(default: Optional[OrderedPair], params: dict) -> DataContainer: + + + gamepad_device = None + clicked_buttons = [False] * 12 + + for device in hid.enumerate(): + if "gamepad" in device["product_string"].lower(): + gamepad_device = device + + if gamepad_device is None: + print("ERROR: No gamepad found") + return OrderedPair(x=np.array([]), y=np.array(clicked_buttons)) + + gamepad = hid.device() + gamepad.open(gamepad_device["vendor_id"], gamepad_device["product_id"]) + + report = gamepad.read(64) + + + check backside buttons + + if report[6] & 1: + clicked_buttons[0] = True + if report[6] & 2: + clicked_buttons[1] = True + + + check rightside buttons + + if report[5] & 0b01000000: + clicked_buttons[2] = True + + if report[5] & 0b00100000: + clicked_buttons[3] = True + + if report[5] & 0b10000000: + clicked_buttons[4] = True + + if report[5] & 0b00010000: + clicked_buttons[5] = True + + + check leftside buttons + + if report[4] & 0b10000000: + clicked_buttons[6] = True + + if report[4] == 0b00000000: + clicked_buttons[7] = True + + if report[3] & 0b10000000: + clicked_buttons[8] = True + + if report[3] == 0b00000000: + clicked_buttons[9] = True + + + check center buttons + + if report[6] & 0b00010000: + clicked_buttons[10] = True + +if report[6] & 0b00100000: + clicked_buttons[11] = True + + return OrderedPair(x=np.array([11]), y=np.array(clicked_buttons)) diff --git a/docs/nodes/INSTRUMENTS/CONTROLLER/GAMEPAD/appendix/hardware.md b/docs/nodes/INSTRUMENTS/CONTROLLER/GAMEPAD/appendix/hardware.md new file mode 100644 index 0000000000..7f78a555c4 --- /dev/null +++ b/docs/nodes/INSTRUMENTS/CONTROLLER/GAMEPAD/appendix/hardware.md @@ -0,0 +1 @@ +This node does not require any peripheral hardware to operate. Please see INSTRUMENTS for nodes that interact with the physical world through connected hardware. \ No newline at end of file diff --git a/docs/nodes/INSTRUMENTS/CONTROLLER/GAMEPAD/appendix/media.md b/docs/nodes/INSTRUMENTS/CONTROLLER/GAMEPAD/appendix/media.md new file mode 100644 index 0000000000..8bcee9be90 --- /dev/null +++ b/docs/nodes/INSTRUMENTS/CONTROLLER/GAMEPAD/appendix/media.md @@ -0,0 +1 @@ +No supporting screenshots, photos, or videos have been added to the media.md file for this node. \ No newline at end of file diff --git a/docs/nodes/INSTRUMENTS/CONTROLLER/GAMEPAD/appendix/notes.md b/docs/nodes/INSTRUMENTS/CONTROLLER/GAMEPAD/appendix/notes.md new file mode 100644 index 0000000000..04aded2ec9 --- /dev/null +++ b/docs/nodes/INSTRUMENTS/CONTROLLER/GAMEPAD/appendix/notes.md @@ -0,0 +1 @@ +No theory or technical notes have been contributed for this node yet. \ No newline at end of file diff --git a/docs/nodes/INSTRUMENTS/LED/LED_MATRIX_WS2812B/LED_MATRIX_WS2812B.md b/docs/nodes/INSTRUMENTS/LED/LED_MATRIX_WS2812B/LED_MATRIX_WS2812B.md new file mode 100644 index 0000000000..e9218a673e --- /dev/null +++ b/docs/nodes/INSTRUMENTS/LED/LED_MATRIX_WS2812B/LED_MATRIX_WS2812B.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.json'; + + + + + {App1} + + + + + + + + +[//]: # (Appendix) + +import Notes from './appendix/notes.md'; +import Hardware from './appendix/hardware.md'; +import Media from './appendix/media.md'; + +## Appendix + + + + + + diff --git a/docs/nodes/INSTRUMENTS/LED/LED_MATRIX_WS2812B/a1-[autogen]/docstring.txt b/docs/nodes/INSTRUMENTS/LED/LED_MATRIX_WS2812B/a1-[autogen]/docstring.txt new file mode 100644 index 0000000000..b918b9fb81 --- /dev/null +++ b/docs/nodes/INSTRUMENTS/LED/LED_MATRIX_WS2812B/a1-[autogen]/docstring.txt @@ -0,0 +1,8 @@ + +The LED_MATRIX_WS2812B node takes an image as an input and sends signals to the LED Matrix to light up specific +LEDs accoring to the image input + +Parameters: +- port: the port to which the LED Matrix is connected +- width: the width of the LED Matrix +- height: the height of the LED Matrix diff --git a/docs/nodes/INSTRUMENTS/LED/LED_MATRIX_WS2812B/a1-[autogen]/python_code.txt b/docs/nodes/INSTRUMENTS/LED/LED_MATRIX_WS2812B/a1-[autogen]/python_code.txt new file mode 100644 index 0000000000..14e8973579 --- /dev/null +++ b/docs/nodes/INSTRUMENTS/LED/LED_MATRIX_WS2812B/a1-[autogen]/python_code.txt @@ -0,0 +1,37 @@ +from flojoy import Image, flojoy, DataContainer +import serial + + +@flojoy +def LED_MATRIX_WS2812B(default: Image, params: dict) -> dict: + + input = default + port = params.get("port") + width = params.get("width") # width of the LED matrix, not the image + height = params.get("height") + + arduino = serial.Serial(port, 115200) + + cmd = "" + # Use the function to light up the LED + for i in range(len(input.r)): + for j in range(len(input.r[0])): + # the LED matrix is a strand of LEDs that is folded into a matrix. + # So, for a 5x5 LED, we have 25 LEDs in consecutive order, and after the 5th LED + # on the first row, the 6th LED starts at the end of the second row, then after the 10th LED, + # the 11th LED starts at the beginning of the third row, and so on. Here is a drawing of how the + # LEDs are aligned: + if input.r[i][j] == 0 and input.g[i][j] == 0 and input.b[i][j] == 0: + continue + + led_position = i * width + if i % 2 == 0: + led_position += j + else: + led_position += width - j - 1 + + cmd += f"{led_position},{input.r[i][j]},{input.g[i][j]},{input.b[i][j]}," + + arduino.write((cmd[:-1] + "\n").encode()) + # arduino.close() + return input # return the input so that the next node can use it diff --git a/docs/nodes/INSTRUMENTS/LED/LED_MATRIX_WS2812B/appendix/hardware.md b/docs/nodes/INSTRUMENTS/LED/LED_MATRIX_WS2812B/appendix/hardware.md new file mode 100644 index 0000000000..7f78a555c4 --- /dev/null +++ b/docs/nodes/INSTRUMENTS/LED/LED_MATRIX_WS2812B/appendix/hardware.md @@ -0,0 +1 @@ +This node does not require any peripheral hardware to operate. Please see INSTRUMENTS for nodes that interact with the physical world through connected hardware. \ No newline at end of file diff --git a/docs/nodes/INSTRUMENTS/LED/LED_MATRIX_WS2812B/appendix/media.md b/docs/nodes/INSTRUMENTS/LED/LED_MATRIX_WS2812B/appendix/media.md new file mode 100644 index 0000000000..8bcee9be90 --- /dev/null +++ b/docs/nodes/INSTRUMENTS/LED/LED_MATRIX_WS2812B/appendix/media.md @@ -0,0 +1 @@ +No supporting screenshots, photos, or videos have been added to the media.md file for this node. \ No newline at end of file diff --git a/docs/nodes/INSTRUMENTS/LED/LED_MATRIX_WS2812B/appendix/notes.md b/docs/nodes/INSTRUMENTS/LED/LED_MATRIX_WS2812B/appendix/notes.md new file mode 100644 index 0000000000..04aded2ec9 --- /dev/null +++ b/docs/nodes/INSTRUMENTS/LED/LED_MATRIX_WS2812B/appendix/notes.md @@ -0,0 +1 @@ +No theory or technical notes have been contributed for this node yet. \ No newline at end of file diff --git a/docs/nodes/LOADERS/REDIS_SYSTEM/REDIS_LOAD/REDIS_LOAD.md b/docs/nodes/LOADERS/REDIS_SYSTEM/REDIS_LOAD/REDIS_LOAD.md new file mode 100644 index 0000000000..0100271648 --- /dev/null +++ b/docs/nodes/LOADERS/REDIS_SYSTEM/REDIS_LOAD/REDIS_LOAD.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.json'; + + + + + {App1} + + + + + + + + +[//]: # (Appendix) + +import Notes from './appendix/notes.md'; +import Hardware from './appendix/hardware.md'; +import Media from './appendix/media.md'; + +## Appendix + + + + + + diff --git a/docs/nodes/LOADERS/REDIS_SYSTEM/REDIS_LOAD/a1-[autogen]/docstring.txt b/docs/nodes/LOADERS/REDIS_SYSTEM/REDIS_LOAD/a1-[autogen]/docstring.txt new file mode 100644 index 0000000000..b5436826fa --- /dev/null +++ b/docs/nodes/LOADERS/REDIS_SYSTEM/REDIS_LOAD/a1-[autogen]/docstring.txt @@ -0,0 +1,11 @@ +The REDIS_LOAD node loads data directly from REDIS. + + Parameters + ---------- + referred_node: list of str + The node where REDIS data will be loaded from. + + Returns + ------- + dataframe + The dataframe loaded from Redis. Ordered pair. diff --git a/docs/nodes/LOADERS/REDIS_SYSTEM/REDIS_LOAD/a1-[autogen]/python_code.txt b/docs/nodes/LOADERS/REDIS_SYSTEM/REDIS_LOAD/a1-[autogen]/python_code.txt new file mode 100644 index 0000000000..7a74957633 --- /dev/null +++ b/docs/nodes/LOADERS/REDIS_SYSTEM/REDIS_LOAD/a1-[autogen]/python_code.txt @@ -0,0 +1,42 @@ +from flojoy import flojoy, JobResultBuilder, DataContainer +import os +from redis import Redis +from rq.job import Job, NoSuchJobError +import traceback +from flojoy.small_memory import SmallMemory +import numpy as np + +REDIS_HOST = os.environ.get("REDIS_HOST", "localhost") +REDIS_PORT = os.environ.get("REDIS_PORT", 6379) + + +@flojoy +def REDIS_LOAD(dc_inputs: list[DataContainer], params: dict) -> DataContainer: + + referred_node = params["referred_node"] + x = dc_inputs[0].y + if referred_node != "": + referred_node_key = referred_node.split("-")[0] + try: + y = SmallMemory().read_memory(referred_node, referred_node_key) + print( + "-" * 72 + + "\n" * 5 + + f"{y.size-1} iterations" + + f" for {referred_node_key} , " + + str([i for i in y]) + + "\n" * 5 + + "-" * 72 + ) + + except (Exception, NoSuchJobError): + y = x if len(dc_inputs) > 0 else [1, 3, 2] + print(traceback.format_exc()) + pass + return ( + JobResultBuilder() + .from_inputs([DataContainer(x=np.arange(0, len(y), 1), y=y)]) + .build() + ) + else: + return JobResultBuilder().from_inputs(dc_inputs).build() diff --git a/docs/nodes/LOADERS/REDIS_SYSTEM/REDIS_LOAD/appendix/hardware.md b/docs/nodes/LOADERS/REDIS_SYSTEM/REDIS_LOAD/appendix/hardware.md new file mode 100644 index 0000000000..7f78a555c4 --- /dev/null +++ b/docs/nodes/LOADERS/REDIS_SYSTEM/REDIS_LOAD/appendix/hardware.md @@ -0,0 +1 @@ +This node does not require any peripheral hardware to operate. Please see INSTRUMENTS for nodes that interact with the physical world through connected hardware. \ No newline at end of file diff --git a/docs/nodes/LOADERS/REDIS_SYSTEM/REDIS_LOAD/appendix/media.md b/docs/nodes/LOADERS/REDIS_SYSTEM/REDIS_LOAD/appendix/media.md new file mode 100644 index 0000000000..8bcee9be90 --- /dev/null +++ b/docs/nodes/LOADERS/REDIS_SYSTEM/REDIS_LOAD/appendix/media.md @@ -0,0 +1 @@ +No supporting screenshots, photos, or videos have been added to the media.md file for this node. \ No newline at end of file diff --git a/docs/nodes/LOADERS/REDIS_SYSTEM/REDIS_LOAD/appendix/notes.md b/docs/nodes/LOADERS/REDIS_SYSTEM/REDIS_LOAD/appendix/notes.md new file mode 100644 index 0000000000..04aded2ec9 --- /dev/null +++ b/docs/nodes/LOADERS/REDIS_SYSTEM/REDIS_LOAD/appendix/notes.md @@ -0,0 +1 @@ +No theory or technical notes have been contributed for this node yet. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/REPLACE_SUBSET/REPLACE_SUBSET.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/REPLACE_SUBSET/REPLACE_SUBSET.md new file mode 100644 index 0000000000..5fc65b0339 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/REPLACE_SUBSET/REPLACE_SUBSET.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.json'; + + + + + {App1} + + + + + + + + +[//]: # (Appendix) + +import Notes from './appendix/notes.md'; +import Hardware from './appendix/hardware.md'; +import Media from './appendix/media.md'; + +## Appendix + + + + + + diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/REPLACE_SUBSET/a1-[autogen]/docstring.txt b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/REPLACE_SUBSET/a1-[autogen]/docstring.txt new file mode 100644 index 0000000000..f0ba24495f --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/REPLACE_SUBSET/a1-[autogen]/docstring.txt @@ -0,0 +1,22 @@ +The REPLACE_SUBSET node returns a new Vector with subset of elements replaced. + + Inputs + ------ + v : Vector + The input vector to replace subset from + + Parameters + ---------- + indices: Array + specified indices to replace values at from the input vector + + values: Array + subset of values to replace the specified indices + + length: int + number of elements to replace from the input vector, default is 1 (this only applies when one index is specified for indices parameter) + + Returns + ------- + Vector + The new vector with subset of elements replaced from the input vector diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/REPLACE_SUBSET/a1-[autogen]/python_code.txt b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/REPLACE_SUBSET/a1-[autogen]/python_code.txt new file mode 100644 index 0000000000..fcdf3a6c67 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/REPLACE_SUBSET/a1-[autogen]/python_code.txt @@ -0,0 +1,37 @@ +from numpy import any, array, arange, put +from flojoy import flojoy, Vector, Array + + +@flojoy +def REPLACE_SUBSET( + default: Vector, indices: Array, values: Array, length: int = 1 +) -> Vector: + + + # unwrap the indices first + indices = array(indices.unwrap(), dtype=int) + # unwrap the values next + values = array(values.unwrap(), dtype=int) + + assert len(default.v) > len( + indices + ), "The length of indices parameter must be less than the length of the Vector." + assert any(indices >= 0), "The indices must be greater than zero." + + if len(indices) == 1: + assert (indices[0] + (length - 1)) < len( + default.v + ), "The length of items to delete starting from index parameter must not exceed the length of the Vector." + + if len(indices) > 1: + assert len(indices) == len( + values + ), "The number of indices and the number of correpsonding elements must be equal." + put(default.v, indices, values) + else: + assert length == len( + values + ), "The number of indices and the number of correpsonding elements must be equal." + indices = arange(indices[0], length) + put(default.v, indices, values) + return Vector(v=default.v) diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/REPLACE_SUBSET/appendix/hardware.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/REPLACE_SUBSET/appendix/hardware.md new file mode 100644 index 0000000000..7f78a555c4 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/REPLACE_SUBSET/appendix/hardware.md @@ -0,0 +1 @@ +This node does not require any peripheral hardware to operate. Please see INSTRUMENTS for nodes that interact with the physical world through connected hardware. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/REPLACE_SUBSET/appendix/media.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/REPLACE_SUBSET/appendix/media.md new file mode 100644 index 0000000000..8bcee9be90 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/REPLACE_SUBSET/appendix/media.md @@ -0,0 +1 @@ +No supporting screenshots, photos, or videos have been added to the media.md file for this node. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/REPLACE_SUBSET/appendix/notes.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/REPLACE_SUBSET/appendix/notes.md new file mode 100644 index 0000000000..04aded2ec9 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/REPLACE_SUBSET/appendix/notes.md @@ -0,0 +1 @@ +No theory or technical notes have been contributed for this node yet. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/REPLACE_SUBSET/examples/EX1/app.json b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/REPLACE_SUBSET/examples/EX1/app.json new file mode 100644 index 0000000000..2da285bbb2 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/REPLACE_SUBSET/examples/EX1/app.json @@ -0,0 +1,314 @@ +{ + "rfInstance": { + "nodes": [ + { + "width": 160, + "height": 160, + "id": "REPLACE_SUBSET-1ceabec0-02a8-481d-bb7d-4b2ae7f0c643", + "type": "TRANSFORMERS", + "data": { + "id": "REPLACE_SUBSET-1ceabec0-02a8-481d-bb7d-4b2ae7f0c643", + "label": "REPLACE SUBSET", + "func": "REPLACE_SUBSET", + "type": "TRANSFORMERS", + "ctrls": { + "indices": { + "type": "Array", + "default": null, + "desc": "specified indices to replace values at from the input vector", + "overload": null, + "functionName": "REPLACE_SUBSET", + "param": "indices", + "value": "1,4,6" + }, + "values": { + "type": "Array", + "default": null, + "desc": "subset of values to replace the specified indices", + "overload": null, + "functionName": "REPLACE_SUBSET", + "param": "values", + "value": "-5,22,13" + }, + "length": { + "type": "int", + "default": 1, + "desc": "number of elements to replace from the input vector, default is 1 (this only applies when one index is specified for indices parameter)", + "overload": null, + "functionName": "REPLACE_SUBSET", + "param": "length", + "value": 3 + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "desc": "The new vector with subset of elements replaced from the input vector" + } + ], + "path": "TRANSFORMERS/VECTOR_MANIPULATION/REPLACE_SUBSET/REPLACE_SUBSET.py", + "selected": false + }, + "position": { + "x": 46.292395321543836, + "y": -191.62402629147334 + }, + "selected": false, + "positionAbsolute": { + "x": 46.292395321543836, + "y": -191.62402629147334 + }, + "dragging": true + }, + { + "width": 208, + "height": 96, + "id": "LINSPACE-773b378b-53c4-41db-a6e0-62bd9a366bcb", + "type": "GENERATORS", + "data": { + "id": "LINSPACE-773b378b-53c4-41db-a6e0-62bd9a366bcb", + "label": "LINSPACE", + "func": "LINSPACE", + "type": "GENERATORS", + "ctrls": { + "start": { + "type": "float", + "default": 10, + "desc": "The start point of the data.", + "overload": null, + "functionName": "LINSPACE", + "param": "start", + "value": 0 + }, + "end": { + "type": "float", + "default": 0, + "desc": "The end point of the data.", + "overload": null, + "functionName": "LINSPACE", + "param": "end", + "value": 10 + }, + "step": { + "type": "int", + "default": 1000, + "desc": "The number of points in the vector.", + "overload": null, + "functionName": "LINSPACE", + "param": "step", + "value": 10 + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Vector|OrderedPair", + "multiple": false, + "desc": "Optional input in case LINSPACE is used in a loop. Not used." + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "desc": "v: the vector between start and end with step number of points." + } + ], + "path": "GENERATORS/SIMULATIONS/LINSPACE/LINSPACE.py", + "selected": false + }, + "position": { + "x": -259.1040792489622, + "y": -159.2030807433828 + }, + "selected": false, + "positionAbsolute": { + "x": -259.1040792489622, + "y": -159.2030807433828 + }, + "dragging": true + }, + { + "width": 380, + "height": 293, + "id": "SCATTER-ac863ad4-e233-40ac-a67e-239e7cf8acb5", + "type": "VISUALIZERS", + "data": { + "id": "SCATTER-ac863ad4-e233-40ac-a67e-239e7cf8acb5", + "label": "SCATTER", + "func": "SCATTER", + "type": "VISUALIZERS", + "ctrls": {}, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair|DataFrame|Matrix|Vector", + "multiple": false, + "desc": "the DataContainer to be visualized" + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": "the DataContainer containing Plotly Scatter visualization" + } + ], + "path": "VISUALIZERS/PLOTLY/SCATTER/SCATTER.py", + "selected": false + }, + "position": { + "x": 337.9370892627744, + "y": -261.0285656908869 + }, + "selected": false, + "positionAbsolute": { + "x": 337.9370892627744, + "y": -261.0285656908869 + }, + "dragging": true + }, + { + "width": 208, + "height": 96, + "id": "TEXT-f7ac9b15-5256-41be-8944-6622466175bc", + "type": "GENERATORS", + "data": { + "id": "TEXT-f7ac9b15-5256-41be-8944-6622466175bc", + "label": "TEXT", + "func": "TEXT", + "type": "GENERATORS", + "ctrls": { + "value": { + "type": "str", + "default": "Hello World!", + "desc": "The value set in Parameters", + "overload": null, + "functionName": "TEXT", + "param": "value", + "value": "This app replaces the subsets of the input vector according to the values and corresponding indices specified. In this example, elements -5, 22, and 13 have been specified to replace the elements in indices 1, 4, and 6. " + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "_", + "id": "_", + "type": "Any", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "TextBlob", + "desc": "text_blob: return the value being set in Parameters" + } + ], + "path": "GENERATORS/SIMULATIONS/TEXT/TEXT.py", + "selected": true + }, + "position": { + "x": 884.1369074495883, + "y": -162.24699099748312 + }, + "selected": true, + "positionAbsolute": { + "x": 884.1369074495883, + "y": -162.24699099748312 + }, + "dragging": true + }, + { + "width": 384, + "height": 288, + "id": "TEXT_VIEW-477492c2-b628-4289-9a51-528af5e09d70", + "type": "VISUALIZERS", + "data": { + "id": "TEXT_VIEW-477492c2-b628-4289-9a51-528af5e09d70", + "label": "TEXT VIEW", + "func": "TEXT_VIEW", + "type": "VISUALIZERS", + "ctrls": {}, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "TextBlob", + "multiple": false, + "desc": "the DataContainer to be visualized in text format" + } + ], + "path": "VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/TEXT_VIEW.py", + "selected": false + }, + "position": { + "x": 784.046104132004, + "y": -520.1653348334285 + }, + "selected": false, + "positionAbsolute": { + "x": 784.046104132004, + "y": -520.1653348334285 + }, + "dragging": true + } + ], + "edges": [ + { + "source": "LINSPACE-773b378b-53c4-41db-a6e0-62bd9a366bcb", + "sourceHandle": "default", + "target": "REPLACE_SUBSET-1ceabec0-02a8-481d-bb7d-4b2ae7f0c643", + "targetHandle": "default", + "id": "reactflow__edge-LINSPACE-773b378b-53c4-41db-a6e0-62bd9a366bcbdefault-REPLACE_SUBSET-1ceabec0-02a8-481d-bb7d-4b2ae7f0c643default" + }, + { + "source": "REPLACE_SUBSET-1ceabec0-02a8-481d-bb7d-4b2ae7f0c643", + "sourceHandle": "default", + "target": "SCATTER-ac863ad4-e233-40ac-a67e-239e7cf8acb5", + "targetHandle": "default", + "id": "reactflow__edge-REPLACE_SUBSET-1ceabec0-02a8-481d-bb7d-4b2ae7f0c643default-SCATTER-ac863ad4-e233-40ac-a67e-239e7cf8acb5default" + }, + { + "source": "SCATTER-ac863ad4-e233-40ac-a67e-239e7cf8acb5", + "sourceHandle": "default", + "target": "TEXT-f7ac9b15-5256-41be-8944-6622466175bc", + "targetHandle": "_", + "id": "reactflow__edge-SCATTER-ac863ad4-e233-40ac-a67e-239e7cf8acb5default-TEXT-f7ac9b15-5256-41be-8944-6622466175bc_" + }, + { + "source": "TEXT-f7ac9b15-5256-41be-8944-6622466175bc", + "sourceHandle": "default", + "target": "TEXT_VIEW-477492c2-b628-4289-9a51-528af5e09d70", + "targetHandle": "default", + "id": "reactflow__edge-TEXT-f7ac9b15-5256-41be-8944-6622466175bcdefault-TEXT_VIEW-477492c2-b628-4289-9a51-528af5e09d70default" + } + ], + "viewport": { + "x": 637.654905587641, + "y": 363.60612546109087, + "zoom": 0.7111497425822767 + } + } +} \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/REPLACE_SUBSET/examples/EX1/example.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/REPLACE_SUBSET/examples/EX1/example.md new file mode 100644 index 0000000000..7e7b7a33fd --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/REPLACE_SUBSET/examples/EX1/example.md @@ -0,0 +1 @@ +In this example, we generate a vector by using a `LINSPACE` node. Then indices 1, 4, 6 are replaced with values -5, 22, 13 respectively using `REPLACE_SUBSET`. The resulting vector is visualized with `SCATTER` node. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/SHIFT_VECTOR.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/SHIFT_VECTOR.md new file mode 100644 index 0000000000..955f448172 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/SHIFT_VECTOR.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.json'; + + + + + {App1} + + + + + + + + +[//]: # (Appendix) + +import Notes from './appendix/notes.md'; +import Hardware from './appendix/hardware.md'; +import Media from './appendix/media.md'; + +## Appendix + + + + + + diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/a1-[autogen]/docstring.txt b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/a1-[autogen]/docstring.txt new file mode 100644 index 0000000000..695dcb0121 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/a1-[autogen]/docstring.txt @@ -0,0 +1,16 @@ +The SHIFT_VECTOR node shifts the elements in the vector by the amount specified + + Inputs + ------ + v : Vector + The input vector to shift elements from + + Parameters + ---------- + shift: int + the number of places in which elements are moved (negative values will shift them to the left) + + Returns + ------- + Vector + The new vector with elements shifted diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/a1-[autogen]/python_code.txt b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/a1-[autogen]/python_code.txt new file mode 100644 index 0000000000..da35195590 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/a1-[autogen]/python_code.txt @@ -0,0 +1,10 @@ +from numpy import roll +from flojoy import flojoy, Vector + + +@flojoy +def SHIFT_VECTOR(default: Vector, shift: int = 1) -> Vector: + + + v = roll(default.v, shift) + return Vector(v=v) diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/appendix/hardware.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/appendix/hardware.md new file mode 100644 index 0000000000..7f78a555c4 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/appendix/hardware.md @@ -0,0 +1 @@ +This node does not require any peripheral hardware to operate. Please see INSTRUMENTS for nodes that interact with the physical world through connected hardware. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/appendix/media.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/appendix/media.md new file mode 100644 index 0000000000..8bcee9be90 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/appendix/media.md @@ -0,0 +1 @@ +No supporting screenshots, photos, or videos have been added to the media.md file for this node. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/appendix/notes.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/appendix/notes.md new file mode 100644 index 0000000000..04aded2ec9 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/appendix/notes.md @@ -0,0 +1 @@ +No theory or technical notes have been contributed for this node yet. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/examples/EX1/app.json b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/examples/EX1/app.json new file mode 100644 index 0000000000..1da935c49c --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/examples/EX1/app.json @@ -0,0 +1,520 @@ +{ + "rfInstance": { + "nodes": [ + { + "width": 208, + "height": 96, + "id": "LINSPACE-e379dbbd-8e84-49d0-a55a-73c7bb83a9d0", + "type": "GENERATORS", + "data": { + "id": "LINSPACE-e379dbbd-8e84-49d0-a55a-73c7bb83a9d0", + "label": "LINSPACE", + "func": "LINSPACE", + "type": "GENERATORS", + "ctrls": { + "start": { + "type": "float", + "default": 10, + "desc": "The start point of the data.", + "overload": null, + "functionName": "LINSPACE", + "param": "start", + "value": 0 + }, + "end": { + "type": "float", + "default": 0, + "desc": "The end point of the data.", + "overload": null, + "functionName": "LINSPACE", + "param": "end", + "value": 10 + }, + "step": { + "type": "int", + "default": 1000, + "desc": "The number of points in the vector.", + "overload": null, + "functionName": "LINSPACE", + "param": "step", + "value": 10 + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Vector|OrderedPair", + "multiple": false, + "desc": "Optional input in case LINSPACE is used in a loop. Not used." + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "desc": "v: the vector between start and end with step number of points." + } + ], + "path": "GENERATORS/SIMULATIONS/LINSPACE/LINSPACE.py", + "selected": false + }, + "position": { + "x": -223.86517863731433, + "y": 120.02433306680166 + }, + "selected": false, + "positionAbsolute": { + "x": -223.86517863731433, + "y": 120.02433306680166 + }, + "dragging": true + }, + { + "width": 380, + "height": 293, + "id": "SCATTER-fc390cc7-cd39-478c-b149-44510a1abc55", + "type": "VISUALIZERS", + "data": { + "id": "SCATTER-fc390cc7-cd39-478c-b149-44510a1abc55", + "label": "SCATTER", + "func": "SCATTER", + "type": "VISUALIZERS", + "ctrls": {}, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair|DataFrame|Matrix|Vector", + "multiple": false, + "desc": "the DataContainer to be visualized" + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": "the DataContainer containing Plotly Scatter visualization" + } + ], + "path": "VISUALIZERS/PLOTLY/SCATTER/SCATTER.py", + "selected": false + }, + "position": { + "x": 467.0975797559655, + "y": -172.3190063382396 + }, + "selected": false, + "positionAbsolute": { + "x": 467.0975797559655, + "y": -172.3190063382396 + }, + "dragging": true + }, + { + "width": 380, + "height": 293, + "id": "SCATTER-c4aaa4eb-367d-49f9-944a-de4aa7b5eab7", + "type": "VISUALIZERS", + "data": { + "id": "SCATTER-c4aaa4eb-367d-49f9-944a-de4aa7b5eab7", + "label": "SCATTER 1", + "func": "SCATTER", + "type": "VISUALIZERS", + "ctrls": {}, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair|DataFrame|Matrix|Vector", + "multiple": false, + "desc": "the DataContainer to be visualized" + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": "the DataContainer containing Plotly Scatter visualization" + } + ], + "path": "VISUALIZERS/PLOTLY/SCATTER/SCATTER.py", + "selected": false + }, + "position": { + "x": 443.10500366948986, + "y": 179.3090438343204 + }, + "selected": false, + "positionAbsolute": { + "x": 443.10500366948986, + "y": 179.3090438343204 + }, + "dragging": true + }, + { + "width": 208, + "height": 96, + "id": "LINSPACE-a3ecb471-ef0c-4af6-9b42-8b85d63aa15b", + "type": "GENERATORS", + "data": { + "id": "LINSPACE-a3ecb471-ef0c-4af6-9b42-8b85d63aa15b", + "label": "LINSPACE 1", + "func": "LINSPACE", + "type": "GENERATORS", + "ctrls": { + "start": { + "type": "float", + "default": 10, + "desc": "The start point of the data.", + "overload": null, + "functionName": "LINSPACE", + "param": "start", + "value": 0 + }, + "end": { + "type": "float", + "default": 0, + "desc": "The end point of the data.", + "overload": null, + "functionName": "LINSPACE", + "param": "end", + "value": 10 + }, + "step": { + "type": "int", + "default": 1000, + "desc": "The number of points in the vector.", + "overload": null, + "functionName": "LINSPACE", + "param": "step", + "value": 10 + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Vector|OrderedPair", + "multiple": false, + "desc": "Optional input in case LINSPACE is used in a loop. Not used." + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "desc": "v: the vector between start and end with step number of points." + } + ], + "path": "GENERATORS/SIMULATIONS/LINSPACE/LINSPACE.py", + "selected": false + }, + "position": { + "x": -223.96114622718932, + "y": 707.270566627652 + }, + "selected": false, + "positionAbsolute": { + "x": -223.96114622718932, + "y": 707.270566627652 + }, + "dragging": true + }, + { + "width": 380, + "height": 293, + "id": "SCATTER-4cd82265-65b6-462c-9523-286c65163e01", + "type": "VISUALIZERS", + "data": { + "id": "SCATTER-4cd82265-65b6-462c-9523-286c65163e01", + "label": "SCATTER 2", + "func": "SCATTER", + "type": "VISUALIZERS", + "ctrls": {}, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair|DataFrame|Matrix|Vector", + "multiple": false, + "desc": "the DataContainer to be visualized" + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": "the DataContainer containing Plotly Scatter visualization" + } + ], + "path": "VISUALIZERS/PLOTLY/SCATTER/SCATTER.py", + "selected": false + }, + "position": { + "x": 461.85436957217325, + "y": 633.327989002352 + }, + "selected": false, + "positionAbsolute": { + "x": 461.85436957217325, + "y": 633.327989002352 + }, + "dragging": true + }, + { + "width": 208, + "height": 96, + "id": "TEXT-3c162e78-3b90-4392-9ef6-8988c48bac83", + "type": "GENERATORS", + "data": { + "id": "TEXT-3c162e78-3b90-4392-9ef6-8988c48bac83", + "label": "TEXT", + "func": "TEXT", + "type": "GENERATORS", + "ctrls": { + "value": { + "type": "str", + "default": "Hello World!", + "desc": "The value set in Parameters", + "overload": null, + "functionName": "TEXT", + "param": "value", + "value": "This app shows elements in the vector can be rotated (i.e shifted) in both directions. The one on the top shows elements that are shifted to the right by 3. The one on the bottom shows the elements that are shifted to the left by 3." + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "_", + "id": "_", + "type": "Any", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "TextBlob", + "desc": "text_blob: return the value being set in Parameters" + } + ], + "path": "GENERATORS/SIMULATIONS/TEXT/TEXT.py", + "selected": false + }, + "position": { + "x": 931.0391647029419, + "y": 248.74566673722245 + }, + "selected": false, + "positionAbsolute": { + "x": 931.0391647029419, + "y": 248.74566673722245 + }, + "dragging": true + }, + { + "width": 384, + "height": 288, + "id": "TEXT_VIEW-e7df43bd-4f8a-45d5-8b38-ee14fa4d26ef", + "type": "VISUALIZERS", + "data": { + "id": "TEXT_VIEW-e7df43bd-4f8a-45d5-8b38-ee14fa4d26ef", + "label": "TEXT VIEW", + "func": "TEXT_VIEW", + "type": "VISUALIZERS", + "ctrls": {}, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "TextBlob", + "multiple": false, + "desc": "the DataContainer to be visualized in text format" + } + ], + "path": "VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/TEXT_VIEW.py", + "selected": false + }, + "position": { + "x": 1353.5947356865488, + "y": 172.47563144496644 + }, + "selected": false, + "positionAbsolute": { + "x": 1353.5947356865488, + "y": 172.47563144496644 + }, + "dragging": true + }, + { + "width": 160, + "height": 160, + "id": "SHIFT_VECTOR-19f0b259-c5c9-4691-bb1d-266f00b6bb8c", + "type": "TRANSFORMERS", + "data": { + "id": "SHIFT_VECTOR-19f0b259-c5c9-4691-bb1d-266f00b6bb8c", + "label": "SHIFT VECTOR", + "func": "SHIFT_VECTOR", + "type": "TRANSFORMERS", + "ctrls": { + "shift": { + "type": "int", + "default": 1, + "desc": "the number of places in which elements are moved (negative values will shift them to the left)", + "overload": null, + "functionName": "SHIFT_VECTOR", + "param": "shift", + "value": 3 + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "desc": "The new vector with elements shifted" + } + ], + "path": "TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/SHIFT_VECTOR.py", + "selected": false + }, + "position": { + "x": 132.48736880826465, + "y": -42.665656394050814 + }, + "selected": false, + "positionAbsolute": { + "x": 132.48736880826465, + "y": -42.665656394050814 + }, + "dragging": true + }, + { + "width": 160, + "height": 160, + "id": "SHIFT_VECTOR-344524df-0eae-49bf-ad50-c5dfcae04ca0", + "type": "TRANSFORMERS", + "data": { + "id": "SHIFT_VECTOR-344524df-0eae-49bf-ad50-c5dfcae04ca0", + "label": "SHIFT VECTOR 1", + "func": "SHIFT_VECTOR", + "type": "TRANSFORMERS", + "ctrls": { + "shift": { + "type": "int", + "default": 1, + "desc": "the number of places in which elements are moved (negative values will shift them to the left)", + "overload": null, + "functionName": "SHIFT_VECTOR", + "param": "shift", + "value": -3 + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "desc": "The new vector with elements shifted" + } + ], + "path": "TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/SHIFT_VECTOR.py", + "selected": false + }, + "position": { + "x": 124.56549480602405, + "y": 654.762527395164 + }, + "selected": false, + "positionAbsolute": { + "x": 124.56549480602405, + "y": 654.762527395164 + }, + "dragging": true + } + ], + "edges": [ + { + "source": "LINSPACE-e379dbbd-8e84-49d0-a55a-73c7bb83a9d0", + "sourceHandle": "default", + "target": "SCATTER-c4aaa4eb-367d-49f9-944a-de4aa7b5eab7", + "targetHandle": "default", + "id": "reactflow__edge-LINSPACE-e379dbbd-8e84-49d0-a55a-73c7bb83a9d0default-SCATTER-c4aaa4eb-367d-49f9-944a-de4aa7b5eab7default" + }, + { + "source": "TEXT-3c162e78-3b90-4392-9ef6-8988c48bac83", + "sourceHandle": "default", + "target": "TEXT_VIEW-e7df43bd-4f8a-45d5-8b38-ee14fa4d26ef", + "targetHandle": "default", + "id": "reactflow__edge-TEXT-3c162e78-3b90-4392-9ef6-8988c48bac83default-TEXT_VIEW-e7df43bd-4f8a-45d5-8b38-ee14fa4d26efdefault" + }, + { + "source": "SHIFT_VECTOR-19f0b259-c5c9-4691-bb1d-266f00b6bb8c", + "sourceHandle": "default", + "target": "SCATTER-fc390cc7-cd39-478c-b149-44510a1abc55", + "targetHandle": "default", + "id": "reactflow__edge-SHIFT_VECTOR-19f0b259-c5c9-4691-bb1d-266f00b6bb8cdefault-SCATTER-fc390cc7-cd39-478c-b149-44510a1abc55default" + }, + { + "source": "LINSPACE-e379dbbd-8e84-49d0-a55a-73c7bb83a9d0", + "sourceHandle": "default", + "target": "SHIFT_VECTOR-19f0b259-c5c9-4691-bb1d-266f00b6bb8c", + "targetHandle": "default", + "id": "reactflow__edge-LINSPACE-e379dbbd-8e84-49d0-a55a-73c7bb83a9d0default-SHIFT_VECTOR-19f0b259-c5c9-4691-bb1d-266f00b6bb8cdefault" + }, + { + "source": "LINSPACE-a3ecb471-ef0c-4af6-9b42-8b85d63aa15b", + "sourceHandle": "default", + "target": "SHIFT_VECTOR-344524df-0eae-49bf-ad50-c5dfcae04ca0", + "targetHandle": "default", + "id": "reactflow__edge-LINSPACE-a3ecb471-ef0c-4af6-9b42-8b85d63aa15bdefault-SHIFT_VECTOR-344524df-0eae-49bf-ad50-c5dfcae04ca0default" + }, + { + "source": "SHIFT_VECTOR-344524df-0eae-49bf-ad50-c5dfcae04ca0", + "sourceHandle": "default", + "target": "SCATTER-4cd82265-65b6-462c-9523-286c65163e01", + "targetHandle": "default", + "id": "reactflow__edge-SHIFT_VECTOR-344524df-0eae-49bf-ad50-c5dfcae04ca0default-SCATTER-4cd82265-65b6-462c-9523-286c65163e01default" + } + ], + "viewport": { + "x": 637.654905587641, + "y": 363.60612546109087, + "zoom": 0.7111497425822767 + } + } +} \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/examples/EX1/example.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/examples/EX1/example.md new file mode 100644 index 0000000000..14fa488195 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SHIFT_VECTOR/examples/EX1/example.md @@ -0,0 +1 @@ +In this example, we generate a vector by using a `LINSPACE` node. Then specify the amount to shift in the vector with `ROTATE_VECTOR` node. In this case, we are only shifting 3 places to the right. The resulting vector is visualized with `SCATTER` node. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/docstring.txt b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/docstring.txt index e0b1d3fc15..bb1385bc85 100644 --- a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/docstring.txt +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/docstring.txt @@ -5,6 +5,11 @@ The SORT_VECTOR node returns the input Vector that is sorted default : Vector The input vector + Parameters + ---------- + reverse : bool + If False, sort in ascending order. If True, descending order. + Returns ------- Vector diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/python_code.txt b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/python_code.txt index e908201a23..147351de6d 100644 --- a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/python_code.txt +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/SORT_VECTOR/a1-[autogen]/python_code.txt @@ -4,7 +4,7 @@ from flojoy import flojoy, Vector @flojoy def SORT_VECTOR( default: Vector, + reverse: bool = False, ) -> Vector: - - return Vector(v=sorted(default.v)) + return Vector(v=sorted(default.v, reverse=reverse)) diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_DELETE/VECTOR_DELETE.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_DELETE/VECTOR_DELETE.md new file mode 100644 index 0000000000..269905c29d --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_DELETE/VECTOR_DELETE.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.json'; + + + + + {App1} + + + + + + + + +[//]: # (Appendix) + +import Notes from './appendix/notes.md'; +import Hardware from './appendix/hardware.md'; +import Media from './appendix/media.md'; + +## Appendix + + + + + + diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_DELETE/a1-[autogen]/docstring.txt b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_DELETE/a1-[autogen]/docstring.txt new file mode 100644 index 0000000000..4c401b6c4b --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_DELETE/a1-[autogen]/docstring.txt @@ -0,0 +1,19 @@ +The VECTOR_DELETE node returns a new Vector with elements deleted from requested indices + + Inputs + ------ + v : Vector + The input vector to delete from + + Parameters + ---------- + indices: Array + specified indices to delete value(s) at from the input vector + + length: int + number of elements to delete from the input vector, default is 1 (this only applies when one index is specified for indices parameter) + + Returns + ------- + Vector + The new vector with element(s) deleted from the input vector diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_DELETE/a1-[autogen]/python_code.txt b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_DELETE/a1-[autogen]/python_code.txt new file mode 100644 index 0000000000..07ced89bc1 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_DELETE/a1-[autogen]/python_code.txt @@ -0,0 +1,27 @@ +from numpy import any, array, delete, arange +from flojoy import flojoy, Vector, Array + + +@flojoy +def VECTOR_DELETE(default: Vector, indices: Array, length: int = 1) -> Vector: + + + # unwrap the indices first + indices = array(indices.unwrap(), dtype=int) + + assert len(default.v) > len( + indices + ), "The length of indices parameter must be less than the length of the Vector." + assert any(indices >= 0), "The indices must be greater than zero." + + if len(indices) == 1: + assert (indices[0] + (length - 1)) < len( + default.v + ), "The length of items to delete starting from index parameter must not exceed the length of the Vector." + + if len(indices) > 1: + v = delete(default.v, indices, None) + else: + indices = arange(indices[0], length) + v = delete(default.v, indices, None) + return Vector(v=v) diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_DELETE/appendix/hardware.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_DELETE/appendix/hardware.md new file mode 100644 index 0000000000..7f78a555c4 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_DELETE/appendix/hardware.md @@ -0,0 +1 @@ +This node does not require any peripheral hardware to operate. Please see INSTRUMENTS for nodes that interact with the physical world through connected hardware. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_DELETE/appendix/media.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_DELETE/appendix/media.md new file mode 100644 index 0000000000..8bcee9be90 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_DELETE/appendix/media.md @@ -0,0 +1 @@ +No supporting screenshots, photos, or videos have been added to the media.md file for this node. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_DELETE/appendix/notes.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_DELETE/appendix/notes.md new file mode 100644 index 0000000000..04aded2ec9 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_DELETE/appendix/notes.md @@ -0,0 +1 @@ +No theory or technical notes have been contributed for this node yet. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_DELETE/examples/EX1/app.json b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_DELETE/examples/EX1/app.json new file mode 100644 index 0000000000..788f604430 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_DELETE/examples/EX1/app.json @@ -0,0 +1,255 @@ +{ + "rfInstance": { + "nodes": [ + { + "width": 208, + "height": 96, + "id": "LINSPACE-f80c30e0-eb44-4a25-94bb-f95afa92ad12", + "type": "GENERATORS", + "data": { + "id": "LINSPACE-f80c30e0-eb44-4a25-94bb-f95afa92ad12", + "label": "LINSPACE", + "func": "LINSPACE", + "type": "GENERATORS", + "ctrls": { + "start": { + "type": "float", + "default": 10, + "desc": "The start point of the data.", + "overload": null, + "functionName": "LINSPACE", + "param": "start", + "value": 0 + }, + "end": { + "type": "float", + "default": 0, + "desc": "The end point of the data.", + "overload": null, + "functionName": "LINSPACE", + "param": "end", + "value": 5 + }, + "step": { + "type": "int", + "default": 1000, + "desc": "The number of points in the vector.", + "overload": null, + "functionName": "LINSPACE", + "param": "step", + "value": 10 + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Vector|OrderedPair", + "multiple": false, + "desc": "Optional input in case LINSPACE is used in a loop. Not used." + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "desc": "v: the vector between start and end with step number of points." + } + ], + "path": "GENERATORS/SIMULATIONS/LINSPACE/LINSPACE.py", + "selected": false + }, + "position": { + "x": -158.11513318068995, + "y": 2.8433502380470372 + }, + "selected": false, + "positionAbsolute": { + "x": -158.11513318068995, + "y": 2.8433502380470372 + }, + "dragging": true + }, + { + "width": 160, + "height": 160, + "id": "VECTOR_DELETE-454ae648-0ca5-4e30-8f6e-56edfee71ff0", + "type": "TRANSFORMERS", + "data": { + "id": "VECTOR_DELETE-454ae648-0ca5-4e30-8f6e-56edfee71ff0", + "label": "VECTOR DELETE", + "func": "VECTOR_DELETE", + "type": "TRANSFORMERS", + "ctrls": { + "indices": { + "type": "Array", + "default": null, + "desc": "specified indices to delete value(s) at from the input vector", + "overload": null, + "functionName": "VECTOR_DELETE", + "param": "indices", + "value": "0" + }, + "length": { + "type": "int", + "default": 1, + "desc": "number of elements to delete from the input vector, default is 1 (this only applies when one index is specified for indices parameter)", + "overload": null, + "functionName": "VECTOR_DELETE", + "param": "length", + "value": 2 + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "desc": "The new vector with element(s) deleted from the input vector" + } + ], + "path": "TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_DELETE/VECTOR_DELETE.py", + "selected": false + }, + "position": { + "x": 178.79385899805402, + "y": -68.85894937989926 + }, + "selected": false, + "positionAbsolute": { + "x": 178.79385899805402, + "y": -68.85894937989926 + }, + "dragging": true + }, + { + "width": 380, + "height": 293, + "id": "SCATTER-69115da9-f7af-44a0-ad96-a2ae12da4166", + "type": "VISUALIZERS", + "data": { + "id": "SCATTER-69115da9-f7af-44a0-ad96-a2ae12da4166", + "label": "SCATTER", + "func": "SCATTER", + "type": "VISUALIZERS", + "ctrls": {}, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair|DataFrame|Matrix|Vector", + "multiple": false, + "desc": "the DataContainer to be visualized" + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": "the DataContainer containing Plotly Scatter visualization" + } + ], + "path": "VISUALIZERS/PLOTLY/SCATTER/SCATTER.py", + "selected": false + }, + "position": { + "x": 420.16869133149214, + "y": -252.87031100366278 + }, + "selected": false, + "positionAbsolute": { + "x": 420.16869133149214, + "y": -252.87031100366278 + }, + "dragging": true + }, + { + "width": 380, + "height": 293, + "id": "SCATTER-439c772a-837a-424d-bd07-656245e01cc9", + "type": "VISUALIZERS", + "data": { + "id": "SCATTER-439c772a-837a-424d-bd07-656245e01cc9", + "label": "SCATTER 1", + "func": "SCATTER", + "type": "VISUALIZERS", + "ctrls": {}, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair|DataFrame|Matrix|Vector", + "multiple": false, + "desc": "the DataContainer to be visualized" + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": "the DataContainer containing Plotly Scatter visualization" + } + ], + "path": "VISUALIZERS/PLOTLY/SCATTER/SCATTER.py", + "selected": true + }, + "position": { + "x": 410.27706108811014, + "y": 135.72610592210992 + }, + "selected": true, + "positionAbsolute": { + "x": 410.27706108811014, + "y": 135.72610592210992 + }, + "dragging": true + } + ], + "edges": [ + { + "source": "LINSPACE-f80c30e0-eb44-4a25-94bb-f95afa92ad12", + "sourceHandle": "default", + "target": "VECTOR_DELETE-454ae648-0ca5-4e30-8f6e-56edfee71ff0", + "targetHandle": "default", + "id": "reactflow__edge-LINSPACE-f80c30e0-eb44-4a25-94bb-f95afa92ad12default-VECTOR_DELETE-454ae648-0ca5-4e30-8f6e-56edfee71ff0default", + "selected": false + }, + { + "source": "VECTOR_DELETE-454ae648-0ca5-4e30-8f6e-56edfee71ff0", + "sourceHandle": "default", + "target": "SCATTER-69115da9-f7af-44a0-ad96-a2ae12da4166", + "targetHandle": "default", + "id": "reactflow__edge-VECTOR_DELETE-454ae648-0ca5-4e30-8f6e-56edfee71ff0default-SCATTER-69115da9-f7af-44a0-ad96-a2ae12da4166default" + }, + { + "source": "LINSPACE-f80c30e0-eb44-4a25-94bb-f95afa92ad12", + "sourceHandle": "default", + "target": "SCATTER-439c772a-837a-424d-bd07-656245e01cc9", + "targetHandle": "default", + "id": "reactflow__edge-LINSPACE-f80c30e0-eb44-4a25-94bb-f95afa92ad12default-SCATTER-439c772a-837a-424d-bd07-656245e01cc9default", + "selected": false + } + ], + "viewport": { + "x": 637.654905587641, + "y": 363.60612546109087, + "zoom": 0.7111497425822767 + } + } +} \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_DELETE/examples/EX1/example.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_DELETE/examples/EX1/example.md new file mode 100644 index 0000000000..8d619890da --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_DELETE/examples/EX1/example.md @@ -0,0 +1 @@ +In this example, we generate a vector by using a `LINSPACE` node. Then starting from index 0, 2 elements are deleted using `VECTOR_DELETE`. The resulting vector is visualized with `SCATTER` node, and another node has been connected to `LINSPACE` for comparison. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INDEXING/a1-[autogen]/python_code.txt b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INDEXING/a1-[autogen]/python_code.txt index b0301e125d..873aa60acc 100644 --- a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INDEXING/a1-[autogen]/python_code.txt +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INDEXING/a1-[autogen]/python_code.txt @@ -1,4 +1,3 @@ -import numpy as np from flojoy import flojoy, Vector, Scalar @@ -8,10 +7,11 @@ def VECTOR_INDEXING( index: int = 0, ) -> Scalar: + assert ( len(default.v) > index ), "The index parameter must be less than the length of the Vector." - assert index >= 0, "The index parameter greater than zero." + assert index >= 0, "The index parameter must be greater than zero." c = default.v[index] return Scalar(c=c) diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INSERT/VECTOR_INSERT.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INSERT/VECTOR_INSERT.md new file mode 100644 index 0000000000..4fd865b6f5 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INSERT/VECTOR_INSERT.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.json'; + + + + + {App1} + + + + + + + + +[//]: # (Appendix) + +import Notes from './appendix/notes.md'; +import Hardware from './appendix/hardware.md'; +import Media from './appendix/media.md'; + +## Appendix + + + + + + diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INSERT/a1-[autogen]/docstring.txt b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INSERT/a1-[autogen]/docstring.txt new file mode 100644 index 0000000000..c8ac816d43 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INSERT/a1-[autogen]/docstring.txt @@ -0,0 +1,20 @@ +The VECTOR_INSERT node inserts a value to the Vector at the + specified index. + + Inputs + ------ + v : Vector + The input vector to insert value. + + Parameters + ---------- + element: int + The value to add to the input vector. + + index: int + The index of the vector to insert value. + + Returns + ------- + Vector + The new vector that contains the inserted value diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INSERT/a1-[autogen]/python_code.txt b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INSERT/a1-[autogen]/python_code.txt new file mode 100644 index 0000000000..8cf00d7cb4 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INSERT/a1-[autogen]/python_code.txt @@ -0,0 +1,19 @@ +from numpy import concatenate, array +from flojoy import flojoy, Vector + + +@flojoy +def VECTOR_INSERT(default: Vector, index: int = 0, value: int = 0) -> Vector: + + + assert ( + len(default.v) > index + ), "The index parameter must be less than the length of the Vector." + assert index >= 0, "The index parameter must be greater than zero." + + if index == len(default.v) - 1: + v = concatenate((default.v, [value])) + else: + v = concatenate((default.v[:index], [value], default.v[index:])) + + return Vector(v=v) diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INSERT/appendix/hardware.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INSERT/appendix/hardware.md new file mode 100644 index 0000000000..7f78a555c4 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INSERT/appendix/hardware.md @@ -0,0 +1 @@ +This node does not require any peripheral hardware to operate. Please see INSTRUMENTS for nodes that interact with the physical world through connected hardware. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INSERT/appendix/media.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INSERT/appendix/media.md new file mode 100644 index 0000000000..8bcee9be90 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INSERT/appendix/media.md @@ -0,0 +1 @@ +No supporting screenshots, photos, or videos have been added to the media.md file for this node. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INSERT/appendix/notes.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INSERT/appendix/notes.md new file mode 100644 index 0000000000..04aded2ec9 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INSERT/appendix/notes.md @@ -0,0 +1 @@ +No theory or technical notes have been contributed for this node yet. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INSERT/examples/EX1/app.json b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INSERT/examples/EX1/app.json new file mode 100644 index 0000000000..1652cf0ed4 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INSERT/examples/EX1/app.json @@ -0,0 +1,324 @@ +{ + "rfInstance": { + "nodes": [ + { + "width": 160, + "height": 160, + "id": "VECTOR_INSERT-933e0106-5454-4bef-aa54-33e8537e0c0a", + "type": "TRANSFORMERS", + "data": { + "id": "VECTOR_INSERT-933e0106-5454-4bef-aa54-33e8537e0c0a", + "label": "VECTOR INSERT", + "func": "VECTOR_INSERT", + "type": "TRANSFORMERS", + "ctrls": { + "index": { + "type": "int", + "default": 0, + "desc": "The index of the vector to insert value.", + "overload": null, + "functionName": "VECTOR_INSERT", + "param": "index", + "value": 0 + }, + "value": { + "type": "int", + "default": 0, + "desc": null, + "overload": null, + "functionName": "VECTOR_INSERT", + "param": "value", + "value": 13 + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "desc": "The new vector that contains the inserted value" + } + ], + "path": "TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INSERT/VECTOR_INSERT.py", + "selected": false + }, + "position": { + "x": 132.73363980782221, + "y": -275.2712172943302 + }, + "selected": false, + "positionAbsolute": { + "x": 132.73363980782221, + "y": -275.2712172943302 + }, + "dragging": true + }, + { + "width": 208, + "height": 96, + "id": "LINSPACE-7a9f9fab-e8a8-490e-bb79-11dd2920655e", + "type": "GENERATORS", + "data": { + "id": "LINSPACE-7a9f9fab-e8a8-490e-bb79-11dd2920655e", + "label": "LINSPACE", + "func": "LINSPACE", + "type": "GENERATORS", + "ctrls": { + "start": { + "type": "float", + "default": 10, + "desc": "The start point of the data.", + "overload": null, + "functionName": "LINSPACE", + "param": "start", + "value": 0 + }, + "end": { + "type": "float", + "default": 0, + "desc": "The end point of the data.", + "overload": null, + "functionName": "LINSPACE", + "param": "end", + "value": 10 + }, + "step": { + "type": "int", + "default": 1000, + "desc": "The number of points in the vector.", + "overload": null, + "functionName": "LINSPACE", + "param": "step", + "value": 10 + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Vector|OrderedPair", + "multiple": false, + "desc": "Optional input in case LINSPACE is used in a loop. Not used." + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "desc": "v: the vector between start and end with step number of points." + } + ], + "path": "GENERATORS/SIMULATIONS/LINSPACE/LINSPACE.py", + "selected": false + }, + "position": { + "x": -226.17189847801404, + "y": -236.96939764894648 + }, + "selected": false, + "positionAbsolute": { + "x": -226.17189847801404, + "y": -236.96939764894648 + }, + "dragging": true + }, + { + "width": 380, + "height": 293, + "id": "SCATTER-3cdae249-bfc6-414c-90ca-676c409f63a1", + "type": "VISUALIZERS", + "data": { + "id": "SCATTER-3cdae249-bfc6-414c-90ca-676c409f63a1", + "label": "SCATTER", + "func": "SCATTER", + "type": "VISUALIZERS", + "ctrls": {}, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair|DataFrame|Matrix|Vector", + "multiple": false, + "desc": "the DataContainer to be visualized" + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": "the DataContainer containing Plotly Scatter visualization" + } + ], + "path": "VISUALIZERS/PLOTLY/SCATTER/SCATTER.py", + "selected": false + }, + "position": { + "x": 530.9194383287412, + "y": -298.5003635099639 + }, + "selected": false, + "positionAbsolute": { + "x": 530.9194383287412, + "y": -298.5003635099639 + }, + "dragging": true + }, + { + "width": 208, + "height": 96, + "id": "LINSPACE-c18dd94e-5173-4351-9199-ef26d10df28d", + "type": "GENERATORS", + "data": { + "id": "LINSPACE-c18dd94e-5173-4351-9199-ef26d10df28d", + "label": "LINSPACE 1", + "func": "LINSPACE", + "type": "GENERATORS", + "ctrls": { + "start": { + "type": "float", + "default": 10, + "desc": "The start point of the data.", + "overload": null, + "functionName": "LINSPACE", + "param": "start", + "value": 0 + }, + "end": { + "type": "float", + "default": 0, + "desc": "The end point of the data.", + "overload": null, + "functionName": "LINSPACE", + "param": "end", + "value": 10 + }, + "step": { + "type": "int", + "default": 1000, + "desc": "The number of points in the vector.", + "overload": null, + "functionName": "LINSPACE", + "param": "step", + "value": 10 + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Vector|OrderedPair", + "multiple": false, + "desc": "Optional input in case LINSPACE is used in a loop. Not used." + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "desc": "v: the vector between start and end with step number of points." + } + ], + "path": "GENERATORS/SIMULATIONS/LINSPACE/LINSPACE.py", + "selected": false + }, + "position": { + "x": -238.30662033776346, + "y": 15.672223666923344 + }, + "selected": false, + "positionAbsolute": { + "x": -238.30662033776346, + "y": 15.672223666923344 + }, + "dragging": true + }, + { + "width": 380, + "height": 293, + "id": "SCATTER-cf0df1c2-d8f3-440d-be66-050f14028a73", + "type": "VISUALIZERS", + "data": { + "id": "SCATTER-cf0df1c2-d8f3-440d-be66-050f14028a73", + "label": "SCATTER 1", + "func": "SCATTER", + "type": "VISUALIZERS", + "ctrls": {}, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair|DataFrame|Matrix|Vector", + "multiple": false, + "desc": "the DataContainer to be visualized" + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": "the DataContainer containing Plotly Scatter visualization" + } + ], + "path": "VISUALIZERS/PLOTLY/SCATTER/SCATTER.py", + "selected": true + }, + "position": { + "x": 122.75760249507664, + "y": -19.02508588254443 + }, + "selected": true, + "positionAbsolute": { + "x": 122.75760249507664, + "y": -19.02508588254443 + }, + "dragging": true + } + ], + "edges": [ + { + "source": "LINSPACE-7a9f9fab-e8a8-490e-bb79-11dd2920655e", + "sourceHandle": "default", + "target": "VECTOR_INSERT-933e0106-5454-4bef-aa54-33e8537e0c0a", + "targetHandle": "default", + "id": "reactflow__edge-LINSPACE-7a9f9fab-e8a8-490e-bb79-11dd2920655edefault-VECTOR_INSERT-933e0106-5454-4bef-aa54-33e8537e0c0adefault" + }, + { + "source": "VECTOR_INSERT-933e0106-5454-4bef-aa54-33e8537e0c0a", + "sourceHandle": "default", + "target": "SCATTER-3cdae249-bfc6-414c-90ca-676c409f63a1", + "targetHandle": "default", + "id": "reactflow__edge-VECTOR_INSERT-933e0106-5454-4bef-aa54-33e8537e0c0adefault-SCATTER-3cdae249-bfc6-414c-90ca-676c409f63a1default" + }, + { + "source": "LINSPACE-c18dd94e-5173-4351-9199-ef26d10df28d", + "sourceHandle": "default", + "target": "SCATTER-cf0df1c2-d8f3-440d-be66-050f14028a73", + "targetHandle": "default", + "id": "reactflow__edge-LINSPACE-c18dd94e-5173-4351-9199-ef26d10df28ddefault-SCATTER-cf0df1c2-d8f3-440d-be66-050f14028a73default" + } + ], + "viewport": { + "x": 637.654905587641, + "y": 363.60612546109087, + "zoom": 0.7111497425822767 + } + } +} \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INSERT/examples/EX1/example.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INSERT/examples/EX1/example.md new file mode 100644 index 0000000000..560d9e6876 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_INSERT/examples/EX1/example.md @@ -0,0 +1 @@ +In this example, we generate a vector by using a `LINSPACE` node. Then, a value specified (13) is inserted at index 0 `VECTOR_INSERT`. The value is visualized with `SCATTER` node. Another set of example excluding `VECTOR_INSERT` node has been added for comparison. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/VECTOR_MAX.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/VECTOR_MAX.md new file mode 100644 index 0000000000..1ee225fb68 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/VECTOR_MAX.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.json'; + + + + + {App1} + + + + + + + + +[//]: # (Appendix) + +import Notes from './appendix/notes.md'; +import Hardware from './appendix/hardware.md'; +import Media from './appendix/media.md'; + +## Appendix + + + + + + diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/a1-[autogen]/docstring.txt b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/a1-[autogen]/docstring.txt new file mode 100644 index 0000000000..a05015a675 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/a1-[autogen]/docstring.txt @@ -0,0 +1,11 @@ +The VECTOR_MAX node returns the maximum value from the Vector + + Inputs + ------ + v : Vector + The input vector to use max peration + + Returns + ------- + Scalar + The maximum value found from the input vector diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/a1-[autogen]/python_code.txt b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/a1-[autogen]/python_code.txt new file mode 100644 index 0000000000..8511d82d79 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/a1-[autogen]/python_code.txt @@ -0,0 +1,9 @@ +import numpy as np +from flojoy import flojoy, Vector, Scalar + + +@flojoy +def VECTOR_MAX(default: Vector) -> Scalar: + + + return Scalar(c=np.max(default.v)) diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/appendix/hardware.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/appendix/hardware.md new file mode 100644 index 0000000000..7f78a555c4 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/appendix/hardware.md @@ -0,0 +1 @@ +This node does not require any peripheral hardware to operate. Please see INSTRUMENTS for nodes that interact with the physical world through connected hardware. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/appendix/media.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/appendix/media.md new file mode 100644 index 0000000000..8bcee9be90 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/appendix/media.md @@ -0,0 +1 @@ +No supporting screenshots, photos, or videos have been added to the media.md file for this node. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/appendix/notes.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/appendix/notes.md new file mode 100644 index 0000000000..04aded2ec9 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/appendix/notes.md @@ -0,0 +1 @@ +No theory or technical notes have been contributed for this node yet. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/examples/EX1/app.json b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/examples/EX1/app.json new file mode 100644 index 0000000000..98e1f718db --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/examples/EX1/app.json @@ -0,0 +1,376 @@ +{ + "rfInstance": { + "nodes": [ + { + "width": 160, + "height": 160, + "id": "VECTOR_MAX-a96e94bf-eb75-4fb7-8f6c-f87279b5a6b3", + "type": "TRANSFORMERS", + "data": { + "id": "VECTOR_MAX-a96e94bf-eb75-4fb7-8f6c-f87279b5a6b3", + "label": "VECTOR MAX", + "func": "VECTOR_MAX", + "type": "TRANSFORMERS", + "ctrls": {}, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Scalar", + "desc": "The maximum value found from the input vector" + } + ], + "path": "TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/VECTOR_MAX.py", + "selected": false + }, + "position": { + "x": 130.31981266859236, + "y": -328.83929636806715 + }, + "selected": false, + "positionAbsolute": { + "x": 130.31981266859236, + "y": -328.83929636806715 + }, + "dragging": true + }, + { + "width": 160, + "height": 160, + "id": "VECTOR_MIN-7aab6cdd-c04e-4577-8f9c-b71748fd18ff", + "type": "TRANSFORMERS", + "data": { + "id": "VECTOR_MIN-7aab6cdd-c04e-4577-8f9c-b71748fd18ff", + "label": "VECTOR MIN", + "func": "VECTOR_MIN", + "type": "TRANSFORMERS", + "ctrls": {}, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Scalar", + "desc": "The minimum value found from the input vector" + } + ], + "path": "TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/VECTOR_MIN.py", + "selected": false + }, + "position": { + "x": 145.13349056115274, + "y": 35.87207046216116 + }, + "selected": false, + "positionAbsolute": { + "x": 145.13349056115274, + "y": 35.87207046216116 + }, + "dragging": true + }, + { + "width": 208, + "height": 96, + "id": "LINSPACE-be66f6ee-60ec-4c9e-b7a5-7d637dfd0a48", + "type": "GENERATORS", + "data": { + "id": "LINSPACE-be66f6ee-60ec-4c9e-b7a5-7d637dfd0a48", + "label": "LINSPACE", + "func": "LINSPACE", + "type": "GENERATORS", + "ctrls": { + "start": { + "type": "float", + "default": 10, + "desc": "The start point of the data.", + "overload": null, + "functionName": "LINSPACE", + "param": "start", + "value": 8 + }, + "end": { + "type": "float", + "default": 0, + "desc": "The end point of the data.", + "overload": null, + "functionName": "LINSPACE", + "param": "end", + "value": 50 + }, + "step": { + "type": "int", + "default": 1000, + "desc": "The number of points in the vector.", + "overload": null, + "functionName": "LINSPACE", + "param": "step", + "value": 200 + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Vector|OrderedPair", + "multiple": false, + "desc": "Optional input in case LINSPACE is used in a loop. Not used." + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "desc": "v: the vector between start and end with step number of points." + } + ], + "path": "GENERATORS/SIMULATIONS/LINSPACE/LINSPACE.py", + "selected": false + }, + "position": { + "x": -321.7726099556296, + "y": -142.40389954737725 + }, + "selected": false, + "positionAbsolute": { + "x": -321.7726099556296, + "y": -142.40389954737725 + }, + "dragging": true + }, + { + "width": 380, + "height": 293, + "id": "BIG_NUMBER-4c8e520d-df00-4e5b-8d3b-39fdc20885e5", + "type": "VISUALIZERS", + "data": { + "id": "BIG_NUMBER-4c8e520d-df00-4e5b-8d3b-39fdc20885e5", + "label": "BIG NUMBER", + "func": "BIG_NUMBER", + "type": "VISUALIZERS", + "ctrls": { + "suffix": { + "type": "str", + "default": null, + "desc": "any suffix to show with big number", + "overload": null, + "functionName": "BIG_NUMBER", + "param": "suffix", + "value": "" + }, + "prefix": { + "type": "str", + "default": null, + "desc": "any prefix to show with big number", + "overload": null, + "functionName": "BIG_NUMBER", + "param": "prefix", + "value": "" + }, + "title": { + "type": "str", + "default": null, + "desc": "title of the plot, default \"BIG_NUMBER\"", + "overload": null, + "functionName": "BIG_NUMBER", + "param": "title", + "value": "" + }, + "relative_delta": { + "type": "bool", + "default": true, + "desc": "whether to show relative delta from last run along with big number", + "overload": null, + "functionName": "BIG_NUMBER", + "param": "relative_delta", + "value": true + }, + "scientific_notation": { + "type": "bool", + "default": false, + "desc": null, + "overload": null, + "functionName": "BIG_NUMBER", + "param": "scientific_notation", + "value": false + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair|Scalar|Vector", + "multiple": false, + "desc": "the DataContainer to be visualized" + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": "the DataContainer containing Plotly big number visualization" + } + ], + "path": "VISUALIZERS/PLOTLY/BIG_NUMBER/BIG_NUMBER.py", + "selected": false + }, + "position": { + "x": 523.8297982318611, + "y": -364.2688477798421 + }, + "selected": false, + "positionAbsolute": { + "x": 523.8297982318611, + "y": -364.2688477798421 + }, + "dragging": true + }, + { + "width": 380, + "height": 293, + "id": "BIG_NUMBER-af51f687-5e84-4277-8ab7-452c4debd152", + "type": "VISUALIZERS", + "data": { + "id": "BIG_NUMBER-af51f687-5e84-4277-8ab7-452c4debd152", + "label": "BIG NUMBER 1", + "func": "BIG_NUMBER", + "type": "VISUALIZERS", + "ctrls": { + "suffix": { + "type": "str", + "default": null, + "desc": "any suffix to show with big number", + "overload": null, + "functionName": "BIG_NUMBER", + "param": "suffix", + "value": "" + }, + "prefix": { + "type": "str", + "default": null, + "desc": "any prefix to show with big number", + "overload": null, + "functionName": "BIG_NUMBER", + "param": "prefix", + "value": "" + }, + "title": { + "type": "str", + "default": null, + "desc": "title of the plot, default \"BIG_NUMBER\"", + "overload": null, + "functionName": "BIG_NUMBER", + "param": "title", + "value": "" + }, + "relative_delta": { + "type": "bool", + "default": true, + "desc": "whether to show relative delta from last run along with big number", + "overload": null, + "functionName": "BIG_NUMBER", + "param": "relative_delta", + "value": true + }, + "scientific_notation": { + "type": "bool", + "default": false, + "desc": null, + "overload": null, + "functionName": "BIG_NUMBER", + "param": "scientific_notation", + "value": false + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair|Scalar|Vector", + "multiple": false, + "desc": "the DataContainer to be visualized" + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": "the DataContainer containing Plotly big number visualization" + } + ], + "path": "VISUALIZERS/PLOTLY/BIG_NUMBER/BIG_NUMBER.py", + "selected": false + }, + "position": { + "x": 531.0832930102642, + "y": 7.055164039401802 + }, + "selected": false, + "positionAbsolute": { + "x": 531.0832930102642, + "y": 7.055164039401802 + }, + "dragging": true + } + ], + "edges": [ + { + "source": "LINSPACE-be66f6ee-60ec-4c9e-b7a5-7d637dfd0a48", + "sourceHandle": "default", + "target": "VECTOR_MAX-a96e94bf-eb75-4fb7-8f6c-f87279b5a6b3", + "targetHandle": "default", + "id": "reactflow__edge-LINSPACE-be66f6ee-60ec-4c9e-b7a5-7d637dfd0a48default-VECTOR_MAX-a96e94bf-eb75-4fb7-8f6c-f87279b5a6b3default" + }, + { + "source": "LINSPACE-be66f6ee-60ec-4c9e-b7a5-7d637dfd0a48", + "sourceHandle": "default", + "target": "VECTOR_MIN-7aab6cdd-c04e-4577-8f9c-b71748fd18ff", + "targetHandle": "default", + "id": "reactflow__edge-LINSPACE-be66f6ee-60ec-4c9e-b7a5-7d637dfd0a48default-VECTOR_MIN-7aab6cdd-c04e-4577-8f9c-b71748fd18ffdefault" + }, + { + "source": "VECTOR_MAX-a96e94bf-eb75-4fb7-8f6c-f87279b5a6b3", + "sourceHandle": "default", + "target": "BIG_NUMBER-4c8e520d-df00-4e5b-8d3b-39fdc20885e5", + "targetHandle": "default", + "id": "reactflow__edge-VECTOR_MAX-a96e94bf-eb75-4fb7-8f6c-f87279b5a6b3default-BIG_NUMBER-4c8e520d-df00-4e5b-8d3b-39fdc20885e5default" + }, + { + "source": "VECTOR_MIN-7aab6cdd-c04e-4577-8f9c-b71748fd18ff", + "sourceHandle": "default", + "target": "BIG_NUMBER-af51f687-5e84-4277-8ab7-452c4debd152", + "targetHandle": "default", + "id": "reactflow__edge-VECTOR_MIN-7aab6cdd-c04e-4577-8f9c-b71748fd18ffdefault-BIG_NUMBER-af51f687-5e84-4277-8ab7-452c4debd152default" + } + ], + "viewport": { + "x": 637.654905587641, + "y": 363.60612546109087, + "zoom": 0.7111497425822767 + } + } +} \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/examples/EX1/example.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/examples/EX1/example.md new file mode 100644 index 0000000000..ad5f2b9948 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/examples/EX1/example.md @@ -0,0 +1 @@ +In this example, we generate a vector starting from 8 and ending at 50 by using a `LINSPACE` node. Then a `VECTOR_MAX` node is connected to the example vector where it will find the maximum value and the one below will find the minimum value. The value is visualized with `BIG_NUMBER` node. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/VECTOR_MIN.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/VECTOR_MIN.md new file mode 100644 index 0000000000..6aef5d9dff --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/VECTOR_MIN.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.json'; + + + + + {App1} + + + + + + + + +[//]: # (Appendix) + +import Notes from './appendix/notes.md'; +import Hardware from './appendix/hardware.md'; +import Media from './appendix/media.md'; + +## Appendix + + + + + + diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/a1-[autogen]/docstring.txt b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/a1-[autogen]/docstring.txt new file mode 100644 index 0000000000..d8033d9379 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/a1-[autogen]/docstring.txt @@ -0,0 +1,11 @@ +The VECTOR_MIN node returns the minimum value from the Vector + + Inputs + ------ + v : Vector + The input vector to use min peration + + Returns + ------- + Scalar + The minimum value found from the input vector diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/a1-[autogen]/python_code.txt b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/a1-[autogen]/python_code.txt new file mode 100644 index 0000000000..56563e9a5c --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/a1-[autogen]/python_code.txt @@ -0,0 +1,9 @@ +import numpy as np +from flojoy import flojoy, Vector, Scalar + + +@flojoy +def VECTOR_MIN(default: Vector) -> Scalar: + + + return Scalar(c=np.min(default.v)) diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/appendix/hardware.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/appendix/hardware.md new file mode 100644 index 0000000000..7f78a555c4 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/appendix/hardware.md @@ -0,0 +1 @@ +This node does not require any peripheral hardware to operate. Please see INSTRUMENTS for nodes that interact with the physical world through connected hardware. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/appendix/media.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/appendix/media.md new file mode 100644 index 0000000000..8bcee9be90 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/appendix/media.md @@ -0,0 +1 @@ +No supporting screenshots, photos, or videos have been added to the media.md file for this node. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/appendix/notes.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/appendix/notes.md new file mode 100644 index 0000000000..04aded2ec9 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/appendix/notes.md @@ -0,0 +1 @@ +No theory or technical notes have been contributed for this node yet. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/examples/EX1/app.json b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/examples/EX1/app.json new file mode 100644 index 0000000000..98e1f718db --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/examples/EX1/app.json @@ -0,0 +1,376 @@ +{ + "rfInstance": { + "nodes": [ + { + "width": 160, + "height": 160, + "id": "VECTOR_MAX-a96e94bf-eb75-4fb7-8f6c-f87279b5a6b3", + "type": "TRANSFORMERS", + "data": { + "id": "VECTOR_MAX-a96e94bf-eb75-4fb7-8f6c-f87279b5a6b3", + "label": "VECTOR MAX", + "func": "VECTOR_MAX", + "type": "TRANSFORMERS", + "ctrls": {}, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Scalar", + "desc": "The maximum value found from the input vector" + } + ], + "path": "TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MAX/VECTOR_MAX.py", + "selected": false + }, + "position": { + "x": 130.31981266859236, + "y": -328.83929636806715 + }, + "selected": false, + "positionAbsolute": { + "x": 130.31981266859236, + "y": -328.83929636806715 + }, + "dragging": true + }, + { + "width": 160, + "height": 160, + "id": "VECTOR_MIN-7aab6cdd-c04e-4577-8f9c-b71748fd18ff", + "type": "TRANSFORMERS", + "data": { + "id": "VECTOR_MIN-7aab6cdd-c04e-4577-8f9c-b71748fd18ff", + "label": "VECTOR MIN", + "func": "VECTOR_MIN", + "type": "TRANSFORMERS", + "ctrls": {}, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Scalar", + "desc": "The minimum value found from the input vector" + } + ], + "path": "TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/VECTOR_MIN.py", + "selected": false + }, + "position": { + "x": 145.13349056115274, + "y": 35.87207046216116 + }, + "selected": false, + "positionAbsolute": { + "x": 145.13349056115274, + "y": 35.87207046216116 + }, + "dragging": true + }, + { + "width": 208, + "height": 96, + "id": "LINSPACE-be66f6ee-60ec-4c9e-b7a5-7d637dfd0a48", + "type": "GENERATORS", + "data": { + "id": "LINSPACE-be66f6ee-60ec-4c9e-b7a5-7d637dfd0a48", + "label": "LINSPACE", + "func": "LINSPACE", + "type": "GENERATORS", + "ctrls": { + "start": { + "type": "float", + "default": 10, + "desc": "The start point of the data.", + "overload": null, + "functionName": "LINSPACE", + "param": "start", + "value": 8 + }, + "end": { + "type": "float", + "default": 0, + "desc": "The end point of the data.", + "overload": null, + "functionName": "LINSPACE", + "param": "end", + "value": 50 + }, + "step": { + "type": "int", + "default": 1000, + "desc": "The number of points in the vector.", + "overload": null, + "functionName": "LINSPACE", + "param": "step", + "value": 200 + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Vector|OrderedPair", + "multiple": false, + "desc": "Optional input in case LINSPACE is used in a loop. Not used." + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "desc": "v: the vector between start and end with step number of points." + } + ], + "path": "GENERATORS/SIMULATIONS/LINSPACE/LINSPACE.py", + "selected": false + }, + "position": { + "x": -321.7726099556296, + "y": -142.40389954737725 + }, + "selected": false, + "positionAbsolute": { + "x": -321.7726099556296, + "y": -142.40389954737725 + }, + "dragging": true + }, + { + "width": 380, + "height": 293, + "id": "BIG_NUMBER-4c8e520d-df00-4e5b-8d3b-39fdc20885e5", + "type": "VISUALIZERS", + "data": { + "id": "BIG_NUMBER-4c8e520d-df00-4e5b-8d3b-39fdc20885e5", + "label": "BIG NUMBER", + "func": "BIG_NUMBER", + "type": "VISUALIZERS", + "ctrls": { + "suffix": { + "type": "str", + "default": null, + "desc": "any suffix to show with big number", + "overload": null, + "functionName": "BIG_NUMBER", + "param": "suffix", + "value": "" + }, + "prefix": { + "type": "str", + "default": null, + "desc": "any prefix to show with big number", + "overload": null, + "functionName": "BIG_NUMBER", + "param": "prefix", + "value": "" + }, + "title": { + "type": "str", + "default": null, + "desc": "title of the plot, default \"BIG_NUMBER\"", + "overload": null, + "functionName": "BIG_NUMBER", + "param": "title", + "value": "" + }, + "relative_delta": { + "type": "bool", + "default": true, + "desc": "whether to show relative delta from last run along with big number", + "overload": null, + "functionName": "BIG_NUMBER", + "param": "relative_delta", + "value": true + }, + "scientific_notation": { + "type": "bool", + "default": false, + "desc": null, + "overload": null, + "functionName": "BIG_NUMBER", + "param": "scientific_notation", + "value": false + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair|Scalar|Vector", + "multiple": false, + "desc": "the DataContainer to be visualized" + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": "the DataContainer containing Plotly big number visualization" + } + ], + "path": "VISUALIZERS/PLOTLY/BIG_NUMBER/BIG_NUMBER.py", + "selected": false + }, + "position": { + "x": 523.8297982318611, + "y": -364.2688477798421 + }, + "selected": false, + "positionAbsolute": { + "x": 523.8297982318611, + "y": -364.2688477798421 + }, + "dragging": true + }, + { + "width": 380, + "height": 293, + "id": "BIG_NUMBER-af51f687-5e84-4277-8ab7-452c4debd152", + "type": "VISUALIZERS", + "data": { + "id": "BIG_NUMBER-af51f687-5e84-4277-8ab7-452c4debd152", + "label": "BIG NUMBER 1", + "func": "BIG_NUMBER", + "type": "VISUALIZERS", + "ctrls": { + "suffix": { + "type": "str", + "default": null, + "desc": "any suffix to show with big number", + "overload": null, + "functionName": "BIG_NUMBER", + "param": "suffix", + "value": "" + }, + "prefix": { + "type": "str", + "default": null, + "desc": "any prefix to show with big number", + "overload": null, + "functionName": "BIG_NUMBER", + "param": "prefix", + "value": "" + }, + "title": { + "type": "str", + "default": null, + "desc": "title of the plot, default \"BIG_NUMBER\"", + "overload": null, + "functionName": "BIG_NUMBER", + "param": "title", + "value": "" + }, + "relative_delta": { + "type": "bool", + "default": true, + "desc": "whether to show relative delta from last run along with big number", + "overload": null, + "functionName": "BIG_NUMBER", + "param": "relative_delta", + "value": true + }, + "scientific_notation": { + "type": "bool", + "default": false, + "desc": null, + "overload": null, + "functionName": "BIG_NUMBER", + "param": "scientific_notation", + "value": false + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair|Scalar|Vector", + "multiple": false, + "desc": "the DataContainer to be visualized" + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": "the DataContainer containing Plotly big number visualization" + } + ], + "path": "VISUALIZERS/PLOTLY/BIG_NUMBER/BIG_NUMBER.py", + "selected": false + }, + "position": { + "x": 531.0832930102642, + "y": 7.055164039401802 + }, + "selected": false, + "positionAbsolute": { + "x": 531.0832930102642, + "y": 7.055164039401802 + }, + "dragging": true + } + ], + "edges": [ + { + "source": "LINSPACE-be66f6ee-60ec-4c9e-b7a5-7d637dfd0a48", + "sourceHandle": "default", + "target": "VECTOR_MAX-a96e94bf-eb75-4fb7-8f6c-f87279b5a6b3", + "targetHandle": "default", + "id": "reactflow__edge-LINSPACE-be66f6ee-60ec-4c9e-b7a5-7d637dfd0a48default-VECTOR_MAX-a96e94bf-eb75-4fb7-8f6c-f87279b5a6b3default" + }, + { + "source": "LINSPACE-be66f6ee-60ec-4c9e-b7a5-7d637dfd0a48", + "sourceHandle": "default", + "target": "VECTOR_MIN-7aab6cdd-c04e-4577-8f9c-b71748fd18ff", + "targetHandle": "default", + "id": "reactflow__edge-LINSPACE-be66f6ee-60ec-4c9e-b7a5-7d637dfd0a48default-VECTOR_MIN-7aab6cdd-c04e-4577-8f9c-b71748fd18ffdefault" + }, + { + "source": "VECTOR_MAX-a96e94bf-eb75-4fb7-8f6c-f87279b5a6b3", + "sourceHandle": "default", + "target": "BIG_NUMBER-4c8e520d-df00-4e5b-8d3b-39fdc20885e5", + "targetHandle": "default", + "id": "reactflow__edge-VECTOR_MAX-a96e94bf-eb75-4fb7-8f6c-f87279b5a6b3default-BIG_NUMBER-4c8e520d-df00-4e5b-8d3b-39fdc20885e5default" + }, + { + "source": "VECTOR_MIN-7aab6cdd-c04e-4577-8f9c-b71748fd18ff", + "sourceHandle": "default", + "target": "BIG_NUMBER-af51f687-5e84-4277-8ab7-452c4debd152", + "targetHandle": "default", + "id": "reactflow__edge-VECTOR_MIN-7aab6cdd-c04e-4577-8f9c-b71748fd18ffdefault-BIG_NUMBER-af51f687-5e84-4277-8ab7-452c4debd152default" + } + ], + "viewport": { + "x": 637.654905587641, + "y": 363.60612546109087, + "zoom": 0.7111497425822767 + } + } +} \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/examples/EX1/example.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/examples/EX1/example.md new file mode 100644 index 0000000000..e4bde7f1a9 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_MIN/examples/EX1/example.md @@ -0,0 +1 @@ +In this example, we generate a vector starting from 8 and ending at 50 by using a `LINSPACE` node. Then a `VECTOR_MIN` node is connected to the example vector where it will find the minimum value and the one above will find the maximum value. The value is visualized with `BIG_NUMBER` node. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_SUBSET/VECTOR_SUBSET.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_SUBSET/VECTOR_SUBSET.md new file mode 100644 index 0000000000..71e2facd9f --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_SUBSET/VECTOR_SUBSET.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.json'; + + + + + {App1} + + + + + + + + +[//]: # (Appendix) + +import Notes from './appendix/notes.md'; +import Hardware from './appendix/hardware.md'; +import Media from './appendix/media.md'; + +## Appendix + + + + + + diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_SUBSET/a1-[autogen]/docstring.txt b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_SUBSET/a1-[autogen]/docstring.txt new file mode 100644 index 0000000000..2c57320766 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_SUBSET/a1-[autogen]/docstring.txt @@ -0,0 +1,18 @@ +The VECTOR_SUBSET node returns the subset of values from requested indices + Inputs + ------ + v : Vector + The input vector to return subset of values from + + Parameters + ---------- + indices: Array + specified indices to extract values at from the input vector + + length: int + number of elements to extract from the input vector, default is 1 (this only applies when one index is specified for indices parameter) + + Returns + ------- + Vector + The new vector with subset of elements extracted from the input vector diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_SUBSET/a1-[autogen]/python_code.txt b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_SUBSET/a1-[autogen]/python_code.txt new file mode 100644 index 0000000000..3e2844347f --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_SUBSET/a1-[autogen]/python_code.txt @@ -0,0 +1,27 @@ +from numpy import any, array, arange, take +from flojoy import flojoy, Vector, Array + + +@flojoy +def VECTOR_SUBSET(default: Vector, indices: Array, length: int = 1) -> Vector: + + + # unwrap the indices first + indices = array(indices.unwrap(), dtype=int) + + assert len(default.v) > len( + indices + ), "The length of indices parameter must be less than the length of the Vector." + assert any(indices >= 0), "The indices must be greater than zero." + + if len(indices) == 1: + assert (indices[0] + (length - 1)) < len( + default.v + ), "The length of items to delete starting from index parameter must not exceed the length of the Vector." + + if len(indices) > 1: + v = take(default.v, indices) + else: + indices = arange(indices[0], length) + v = take(default.v, indices) + return Vector(v=v) diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_SUBSET/appendix/hardware.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_SUBSET/appendix/hardware.md new file mode 100644 index 0000000000..7f78a555c4 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_SUBSET/appendix/hardware.md @@ -0,0 +1 @@ +This node does not require any peripheral hardware to operate. Please see INSTRUMENTS for nodes that interact with the physical world through connected hardware. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_SUBSET/appendix/media.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_SUBSET/appendix/media.md new file mode 100644 index 0000000000..8bcee9be90 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_SUBSET/appendix/media.md @@ -0,0 +1 @@ +No supporting screenshots, photos, or videos have been added to the media.md file for this node. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_SUBSET/appendix/notes.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_SUBSET/appendix/notes.md new file mode 100644 index 0000000000..04aded2ec9 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_SUBSET/appendix/notes.md @@ -0,0 +1 @@ +No theory or technical notes have been contributed for this node yet. \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_SUBSET/examples/EX1/app.json b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_SUBSET/examples/EX1/app.json new file mode 100644 index 0000000000..ca4db7e0a3 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_SUBSET/examples/EX1/app.json @@ -0,0 +1,305 @@ +{ + "rfInstance": { + "nodes": [ + { + "width": 160, + "height": 160, + "id": "VECTOR_SUBSET-e808198b-5507-406c-816b-edfa5cd67c65", + "type": "TRANSFORMERS", + "data": { + "id": "VECTOR_SUBSET-e808198b-5507-406c-816b-edfa5cd67c65", + "label": "VECTOR SUBSET", + "func": "VECTOR_SUBSET", + "type": "TRANSFORMERS", + "ctrls": { + "indices": { + "type": "Array", + "default": null, + "desc": "specified indices to extract values at from the input vector", + "overload": null, + "functionName": "VECTOR_SUBSET", + "param": "indices", + "value": "3, 1, 9" + }, + "length": { + "type": "int", + "default": 1, + "desc": "number of elements to extract from the input vector, default is 1 (this only applies when one index is specified for indices parameter)", + "overload": null, + "functionName": "VECTOR_SUBSET", + "param": "length", + "value": 1 + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "desc": "The new vector with subset of elements extracted from the input vector" + } + ], + "path": "TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_SUBSET/VECTOR_SUBSET.py", + "selected": false + }, + "position": { + "x": 104.03576804813667, + "y": -249.72160283864238 + }, + "selected": false, + "positionAbsolute": { + "x": 104.03576804813667, + "y": -249.72160283864238 + }, + "dragging": true + }, + { + "width": 208, + "height": 96, + "id": "LINSPACE-d585a7bc-2746-403c-a11d-8e126f184986", + "type": "GENERATORS", + "data": { + "id": "LINSPACE-d585a7bc-2746-403c-a11d-8e126f184986", + "label": "LINSPACE", + "func": "LINSPACE", + "type": "GENERATORS", + "ctrls": { + "start": { + "type": "float", + "default": 10, + "desc": "The start point of the data.", + "overload": null, + "functionName": "LINSPACE", + "param": "start", + "value": 0 + }, + "end": { + "type": "float", + "default": 0, + "desc": "The end point of the data.", + "overload": null, + "functionName": "LINSPACE", + "param": "end", + "value": 10 + }, + "step": { + "type": "int", + "default": 1000, + "desc": "The number of points in the vector.", + "overload": null, + "functionName": "LINSPACE", + "param": "step", + "value": 10 + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "Vector|OrderedPair", + "multiple": false, + "desc": "Optional input in case LINSPACE is used in a loop. Not used." + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Vector", + "desc": "v: the vector between start and end with step number of points." + } + ], + "path": "GENERATORS/SIMULATIONS/LINSPACE/LINSPACE.py", + "selected": false + }, + "position": { + "x": -228.13999483234682, + "y": -219.17458038428336 + }, + "selected": false, + "positionAbsolute": { + "x": -228.13999483234682, + "y": -219.17458038428336 + }, + "dragging": true + }, + { + "width": 380, + "height": 293, + "id": "SCATTER-ab4ed575-e472-4057-a8aa-15f49220d247", + "type": "VISUALIZERS", + "data": { + "id": "SCATTER-ab4ed575-e472-4057-a8aa-15f49220d247", + "label": "SCATTER", + "func": "SCATTER", + "type": "VISUALIZERS", + "ctrls": {}, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair|DataFrame|Matrix|Vector", + "multiple": false, + "desc": "the DataContainer to be visualized" + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly", + "desc": "the DataContainer containing Plotly Scatter visualization" + } + ], + "path": "VISUALIZERS/PLOTLY/SCATTER/SCATTER.py", + "selected": false + }, + "position": { + "x": 428.99358461694226, + "y": -314.5602635329144 + }, + "selected": false, + "positionAbsolute": { + "x": 428.99358461694226, + "y": -314.5602635329144 + }, + "dragging": true + }, + { + "width": 208, + "height": 96, + "id": "TEXT-8b9ff74a-8faa-4e7d-b66a-b1c757520398", + "type": "GENERATORS", + "data": { + "id": "TEXT-8b9ff74a-8faa-4e7d-b66a-b1c757520398", + "label": "TEXT", + "func": "TEXT", + "type": "GENERATORS", + "ctrls": { + "value": { + "type": "str", + "default": "Hello World!", + "desc": "The value set in Parameters", + "overload": null, + "functionName": "TEXT", + "param": "value", + "value": "This is an app that extracts the values from the input vector given the indices to locate the values from." + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "_", + "id": "_", + "type": "Any", + "multiple": false, + "desc": null + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "TextBlob", + "desc": "text_blob: return the value being set in Parameters" + } + ], + "path": "GENERATORS/SIMULATIONS/TEXT/TEXT.py", + "selected": false + }, + "position": { + "x": 936.9816915983375, + "y": -214.31949084904693 + }, + "selected": false, + "positionAbsolute": { + "x": 936.9816915983375, + "y": -214.31949084904693 + }, + "dragging": true + }, + { + "width": 384, + "height": 288, + "id": "TEXT_VIEW-51dabb17-f619-4f5b-963e-a84f3dec216e", + "type": "VISUALIZERS", + "data": { + "id": "TEXT_VIEW-51dabb17-f619-4f5b-963e-a84f3dec216e", + "label": "TEXT VIEW", + "func": "TEXT_VIEW", + "type": "VISUALIZERS", + "ctrls": {}, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "TextBlob", + "multiple": false, + "desc": "the DataContainer to be visualized in text format" + } + ], + "path": "VISUALIZERS/DATA_STRUCTURE/TEXT_VIEW/TEXT_VIEW.py", + "selected": true + }, + "position": { + "x": 840.4770466400951, + "y": -598.4440869703409 + }, + "selected": true, + "positionAbsolute": { + "x": 840.4770466400951, + "y": -598.4440869703409 + }, + "dragging": true + } + ], + "edges": [ + { + "source": "LINSPACE-d585a7bc-2746-403c-a11d-8e126f184986", + "sourceHandle": "default", + "target": "VECTOR_SUBSET-e808198b-5507-406c-816b-edfa5cd67c65", + "targetHandle": "default", + "id": "reactflow__edge-LINSPACE-d585a7bc-2746-403c-a11d-8e126f184986default-VECTOR_SUBSET-e808198b-5507-406c-816b-edfa5cd67c65default" + }, + { + "source": "VECTOR_SUBSET-e808198b-5507-406c-816b-edfa5cd67c65", + "sourceHandle": "default", + "target": "SCATTER-ab4ed575-e472-4057-a8aa-15f49220d247", + "targetHandle": "default", + "id": "reactflow__edge-VECTOR_SUBSET-e808198b-5507-406c-816b-edfa5cd67c65default-SCATTER-ab4ed575-e472-4057-a8aa-15f49220d247default" + }, + { + "source": "SCATTER-ab4ed575-e472-4057-a8aa-15f49220d247", + "sourceHandle": "default", + "target": "TEXT-8b9ff74a-8faa-4e7d-b66a-b1c757520398", + "targetHandle": "_", + "id": "reactflow__edge-SCATTER-ab4ed575-e472-4057-a8aa-15f49220d247default-TEXT-8b9ff74a-8faa-4e7d-b66a-b1c757520398_" + }, + { + "source": "TEXT-8b9ff74a-8faa-4e7d-b66a-b1c757520398", + "sourceHandle": "default", + "target": "TEXT_VIEW-51dabb17-f619-4f5b-963e-a84f3dec216e", + "targetHandle": "default", + "id": "reactflow__edge-TEXT-8b9ff74a-8faa-4e7d-b66a-b1c757520398default-TEXT_VIEW-51dabb17-f619-4f5b-963e-a84f3dec216edefault" + } + ], + "viewport": { + "x": 637.654905587641, + "y": 363.60612546109087, + "zoom": 0.7111497425822767 + } + } +} \ No newline at end of file diff --git a/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_SUBSET/examples/EX1/example.md b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_SUBSET/examples/EX1/example.md new file mode 100644 index 0000000000..d99a6d8e66 --- /dev/null +++ b/docs/nodes/TRANSFORMERS/VECTOR_MANIPULATION/VECTOR_SUBSET/examples/EX1/example.md @@ -0,0 +1 @@ +In this example, we generate a vector by using a `LINSPACE` node. Then the values located at indices 3, 1, 9 are extracted using `VECTOR_SUBSET`. The resulting vector is visualized with `SCATTER` node. \ No newline at end of file diff --git a/docs/nodes/VISUALIZERS/PLOTLY/IMAGE/a1-[autogen]/python_code.txt b/docs/nodes/VISUALIZERS/PLOTLY/IMAGE/a1-[autogen]/python_code.txt index a74700229e..da9209a098 100644 --- a/docs/nodes/VISUALIZERS/PLOTLY/IMAGE/a1-[autogen]/python_code.txt +++ b/docs/nodes/VISUALIZERS/PLOTLY/IMAGE/a1-[autogen]/python_code.txt @@ -4,9 +4,10 @@ import numpy as np from nodes.VISUALIZERS.template import plot_layout -@flojoy +@flojoy(inject_node_metadata=True) def IMAGE(default: Image | Grayscale) -> Plotly: + layout = plot_layout(title="IMAGE") if isinstance(default, Image): @@ -23,7 +24,9 @@ def IMAGE(default: Image | Grayscale) -> Plotly: else: img = default.m - rgb_image = np.zeros((*img.shape, 3), dtype=np.uint8) #only generated for plotting + rgb_image = np.zeros( + (*img.shape, 3), dtype=np.uint8 + ) # only generated for plotting rgb_image[..., 0] = img * 255 # Red channel rgb_image[..., 1] = img * 255 # Green channel rgb_image[..., 2] = img * 255 # Blue channel