diff --git a/docs/nodes/GENERATORS/SIMULATIONS/POPULATE/POPULATE.md b/docs/nodes/GENERATORS/SIMULATIONS/POPULATE/POPULATE.md new file mode 100644 index 0000000000..3faf5d95f3 --- /dev/null +++ b/docs/nodes/GENERATORS/SIMULATIONS/POPULATE/POPULATE.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/GENERATORS/SIMULATIONS/POPULATE/a1-[autogen]/docstring.txt b/docs/nodes/GENERATORS/SIMULATIONS/POPULATE/a1-[autogen]/docstring.txt new file mode 100644 index 0000000000..9b3910a111 --- /dev/null +++ b/docs/nodes/GENERATORS/SIMULATIONS/POPULATE/a1-[autogen]/docstring.txt @@ -0,0 +1,27 @@ +The POPULATE node generates random numbers, depending on the distribution selected and the input data. + + Inputs + ------ + default : OrderedPair|Vector + Input to use as the x-axis for the random samples. + + Parameters + ---------- + distribution : select + the distribution over the random samples + lower_bound : float + the lower bound of the output interval + upper_bound : float + the upper bound of the output interval + normal_mean : float + the mean or "center" of the normal distribution + normal_standard_deviation : float + the spread or "width" of the normal distribution + poisson_events : float + the expected number of events occurring in a fixed time-interval when distribution is poisson + + Returns + ------- + OrderedPair + x: provided from input data + y: the random samples diff --git a/docs/nodes/GENERATORS/SIMULATIONS/POPULATE/a1-[autogen]/python_code.txt b/docs/nodes/GENERATORS/SIMULATIONS/POPULATE/a1-[autogen]/python_code.txt new file mode 100644 index 0000000000..cb65e8388e --- /dev/null +++ b/docs/nodes/GENERATORS/SIMULATIONS/POPULATE/a1-[autogen]/python_code.txt @@ -0,0 +1,58 @@ +import random +import numpy as np +from flojoy import flojoy, OrderedPair, Vector, display +from typing import Literal, Optional + + +@flojoy +def POPULATE( + default: OrderedPair | Vector, + distribution: Literal["normal", "uniform", "poisson"] = "normal", + lower_bound: float = 0, + upper_bound: float = 1, + normal_mean: float = 0, + normal_standard_deviation: float = 1, + poisson_events: float = 1, +) -> OrderedPair: + + + if upper_bound < lower_bound: + upper_bound, lower_bound = lower_bound, upper_bound + + seed = random.randint(1, 10000) + my_generator = np.random.default_rng(seed) + + match default: + case OrderedPair(): + size = len(default.x) + x = default.x + case Vector(): + size = len(default.v) + x = default.v + + match distribution: + case "uniform": + y = my_generator.uniform(low=lower_bound, high=upper_bound, size=size) + case "normal": + y = my_generator.normal( + loc=normal_mean, scale=normal_standard_deviation, size=size + ) + case "poisson": + y = my_generator.poisson(lam=poisson_events, size=size) + + return OrderedPair(x=x, y=y) + + +@display +def OVERLOAD(lower_bound, upper_bound, distribution="uniform") -> None: + return None + + +@display +def OVERLOAD(normal_mean, normal_standard_deviation, distribution="normal") -> None: + return None + + +@display +def OVERLOAD(poisson_events, distribution="poisson") -> None: + return None diff --git a/docs/nodes/GENERATORS/SIMULATIONS/POPULATE/appendix/hardware.md b/docs/nodes/GENERATORS/SIMULATIONS/POPULATE/appendix/hardware.md new file mode 100644 index 0000000000..7f78a555c4 --- /dev/null +++ b/docs/nodes/GENERATORS/SIMULATIONS/POPULATE/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/GENERATORS/SIMULATIONS/POPULATE/appendix/media.md b/docs/nodes/GENERATORS/SIMULATIONS/POPULATE/appendix/media.md new file mode 100644 index 0000000000..8bcee9be90 --- /dev/null +++ b/docs/nodes/GENERATORS/SIMULATIONS/POPULATE/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/GENERATORS/SIMULATIONS/POPULATE/appendix/notes.md b/docs/nodes/GENERATORS/SIMULATIONS/POPULATE/appendix/notes.md new file mode 100644 index 0000000000..04aded2ec9 --- /dev/null +++ b/docs/nodes/GENERATORS/SIMULATIONS/POPULATE/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/GENERATORS/SIMULATIONS/POPULATE/examples/EX1/app.json b/docs/nodes/GENERATORS/SIMULATIONS/POPULATE/examples/EX1/app.json new file mode 100644 index 0000000000..786ebde992 --- /dev/null +++ b/docs/nodes/GENERATORS/SIMULATIONS/POPULATE/examples/EX1/app.json @@ -0,0 +1,444 @@ +{ + "rfInstance": { + "nodes": [ + { + "width": 380, + "height": 293, + "id": "HISTOGRAM-c5469532-dd28-4465-b8b0-524174db86e4", + "type": "VISUALIZERS", + "data": { + "id": "HISTOGRAM-c5469532-dd28-4465-b8b0-524174db86e4", + "label": "HISTOGRAM", + "func": "HISTOGRAM", + "type": "VISUALIZERS", + "ctrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair|DataFrame|Matrix", + "multiple": false + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "Plotly" + } + ], + "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/HISTOGRAM/HISTOGRAM.py", + "selected": false + }, + "position": { + "x": 794.6062406107221, + "y": -355.5689772430068 + }, + "selected": false, + "positionAbsolute": { + "x": 794.6062406107221, + "y": -355.5689772430068 + }, + "dragging": true + }, + { + "width": 208, + "height": 96, + "id": "LINSPACE-14e316a4-dcdb-47ac-868d-d829b0c30678", + "type": "GENERATORS", + "data": { + "id": "LINSPACE-14e316a4-dcdb-47ac-868d-d829b0c30678", + "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": 10 + }, + "end": { + "type": "float", + "default": 0, + "desc": "The end point of the data.", + "overload": null, + "functionName": "LINSPACE", + "param": "end", + "value": 0 + }, + "step": { + "type": "int", + "default": 1000, + "desc": "The number of points in the vector.", + "overload": null, + "functionName": "LINSPACE", + "param": "step", + "value": 1000 + } + }, + "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 a 'step' number of points." + } + ], + "path": "GENERATORS/SIMULATIONS/LINSPACE/LINSPACE.py", + "selected": false + }, + "position": { + "x": 60.78604888475641, + "y": -72.26608171130152 + }, + "selected": false, + "positionAbsolute": { + "x": 60.78604888475641, + "y": -72.26608171130152 + }, + "dragging": true + }, + { + "width": 208, + "height": 96, + "id": "POPULATE-b27a1155-ccd8-4e60-a0ca-3a0744f6f19c", + "type": "GENERATORS", + "data": { + "id": "POPULATE-b27a1155-ccd8-4e60-a0ca-3a0744f6f19c", + "label": "POPULATE", + "func": "POPULATE", + "type": "GENERATORS", + "ctrls": { + "distribution": { + "type": "select", + "options": [ + "normal", + "uniform", + "poisson" + ], + "default": "normal", + "desc": "the distribution over the random samples", + "overload": { + "uniform": [ + "lower_bound", + "upper_bound" + ], + "normal": [ + "normal_mean", + "normal_standard_deviation" + ], + "poisson": [ + "poisson_events" + ] + }, + "functionName": "POPULATE", + "param": "distribution", + "value": "normal" + }, + "lower_bound": { + "type": "float", + "default": 0, + "desc": "the lower bound of the output interval", + "overload": null, + "functionName": "POPULATE", + "param": "lower_bound", + "value": 0 + }, + "upper_bound": { + "type": "float", + "default": 1, + "desc": "the upper bound of the output interval", + "overload": null, + "functionName": "POPULATE", + "param": "upper_bound", + "value": 1 + }, + "normal_mean": { + "type": "float", + "default": 0, + "desc": "the mean or \"center\" of the normal distribution", + "overload": null, + "functionName": "POPULATE", + "param": "normal_mean", + "value": 0 + }, + "normal_standard_deviation": { + "type": "float", + "default": 1, + "desc": "the spread or \"width\" of the normal distribution", + "overload": null, + "functionName": "POPULATE", + "param": "normal_standard_deviation", + "value": 1 + }, + "poisson_events": { + "type": "float", + "default": 1, + "desc": "the expected number of events occurring in a fixed time-interval when distribution is poisson", + "overload": null, + "functionName": "POPULATE", + "param": "poisson_events", + "value": 1 + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair|Vector", + "multiple": false, + "desc": "Input to use as the x-axis for the random samples." + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair", + "desc": "x: provided from input data\ny: the random samples" + } + ], + "path": "GENERATORS/SIMULATIONS/POPULATE/POPULATE.py", + "selected": false + }, + "position": { + "x": 428.99358191180903, + "y": -258.88112365217773 + }, + "selected": false, + "positionAbsolute": { + "x": 428.99358191180903, + "y": -258.88112365217773 + }, + "dragging": true + }, + { + "width": 208, + "height": 96, + "id": "POPULATE-fb436d2a-9db1-4de7-8e25-97b7c56a9f29", + "type": "GENERATORS", + "data": { + "id": "POPULATE-fb436d2a-9db1-4de7-8e25-97b7c56a9f29", + "label": "POPULATE 1", + "func": "POPULATE", + "type": "GENERATORS", + "ctrls": { + "distribution": { + "type": "select", + "options": [ + "normal", + "uniform", + "poisson" + ], + "default": "normal", + "desc": "the distribution over the random samples", + "overload": { + "uniform": [ + "lower_bound", + "upper_bound" + ], + "normal": [ + "normal_mean", + "normal_standard_deviation" + ], + "poisson": [ + "poisson_events" + ] + }, + "functionName": "POPULATE", + "param": "distribution", + "value": "poisson" + }, + "lower_bound": { + "type": "float", + "default": 0, + "desc": "the lower bound of the output interval", + "overload": null, + "functionName": "POPULATE", + "param": "lower_bound", + "value": 0 + }, + "upper_bound": { + "type": "float", + "default": 1, + "desc": "the upper bound of the output interval", + "overload": null, + "functionName": "POPULATE", + "param": "upper_bound", + "value": 1 + }, + "normal_mean": { + "type": "float", + "default": 0, + "desc": "the mean or \"center\" of the normal distribution", + "overload": null, + "functionName": "POPULATE", + "param": "normal_mean", + "value": 0 + }, + "normal_standard_deviation": { + "type": "float", + "default": 1, + "desc": "the spread or \"width\" of the normal distribution", + "overload": null, + "functionName": "POPULATE", + "param": "normal_standard_deviation", + "value": 1 + }, + "poisson_events": { + "type": "float", + "default": 1, + "desc": "the expected number of events occurring in a fixed time-interval when distribution is poisson", + "overload": null, + "functionName": "POPULATE", + "param": "poisson_events", + "value": 1 + } + }, + "initCtrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair|Vector", + "multiple": false, + "desc": "Input to use as the x-axis for the random samples." + } + ], + "outputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair", + "desc": "x: provided from input data\ny: the random samples" + } + ], + "path": "GENERATORS/SIMULATIONS/POPULATE/POPULATE.py", + "selected": false + }, + "position": { + "x": 423.735359873562, + "y": 61.2094115519848 + }, + "selected": false, + "positionAbsolute": { + "x": 423.735359873562, + "y": 61.2094115519848 + }, + "dragging": true + }, + { + "width": 380, + "height": 293, + "id": "HISTOGRAM-e426b844-934e-4b27-983f-68afc25b5659", + "type": "VISUALIZERS", + "data": { + "id": "HISTOGRAM-e426b844-934e-4b27-983f-68afc25b5659", + "label": "HISTOGRAM 1", + "func": "HISTOGRAM", + "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 the Plotly Histogram visualization" + } + ], + "path": "VISUALIZERS/PLOTLY/HISTOGRAM/HISTOGRAM.py", + "selected": false + }, + "position": { + "x": 792.6069096920073, + "y": -29.88744351696306 + }, + "selected": false, + "positionAbsolute": { + "x": 792.6069096920073, + "y": -29.88744351696306 + }, + "dragging": true + } + ], + "edges": [ + { + "source": "LINSPACE-14e316a4-dcdb-47ac-868d-d829b0c30678", + "sourceHandle": "default", + "target": "POPULATE-b27a1155-ccd8-4e60-a0ca-3a0744f6f19c", + "targetHandle": "default", + "id": "reactflow__edge-LINSPACE-14e316a4-dcdb-47ac-868d-d829b0c30678default-POPULATE-b27a1155-ccd8-4e60-a0ca-3a0744f6f19cdefault" + }, + { + "source": "POPULATE-b27a1155-ccd8-4e60-a0ca-3a0744f6f19c", + "sourceHandle": "default", + "target": "HISTOGRAM-c5469532-dd28-4465-b8b0-524174db86e4", + "targetHandle": "default", + "id": "reactflow__edge-POPULATE-b27a1155-ccd8-4e60-a0ca-3a0744f6f19cdefault-HISTOGRAM-c5469532-dd28-4465-b8b0-524174db86e4default" + }, + { + "source": "LINSPACE-14e316a4-dcdb-47ac-868d-d829b0c30678", + "sourceHandle": "default", + "target": "POPULATE-fb436d2a-9db1-4de7-8e25-97b7c56a9f29", + "targetHandle": "default", + "id": "reactflow__edge-LINSPACE-14e316a4-dcdb-47ac-868d-d829b0c30678default-POPULATE-fb436d2a-9db1-4de7-8e25-97b7c56a9f29default" + }, + { + "source": "POPULATE-fb436d2a-9db1-4de7-8e25-97b7c56a9f29", + "sourceHandle": "default", + "target": "HISTOGRAM-e426b844-934e-4b27-983f-68afc25b5659", + "targetHandle": "default", + "id": "reactflow__edge-POPULATE-fb436d2a-9db1-4de7-8e25-97b7c56a9f29default-HISTOGRAM-e426b844-934e-4b27-983f-68afc25b5659default" + } + ], + "viewport": { + "x": -373.4542219202399, + "y": 120.20973884288571, + "zoom": 1.101977389476256 + } + }, + "ctrlsManifest": [ + { + "type": "input", + "name": "Slider", + "id": "INPUT_PLACEHOLDER", + "hidden": false, + "minHeight": 1, + "minWidth": 2, + "layout": { + "x": 0, + "y": 0, + "h": 2, + "w": 2, + "minH": 1, + "minW": 2, + "i": "INPUT_PLACEHOLDER" + } + } + ] +} \ No newline at end of file diff --git a/docs/nodes/GENERATORS/SIMULATIONS/POPULATE/examples/EX1/example.md b/docs/nodes/GENERATORS/SIMULATIONS/POPULATE/examples/EX1/example.md new file mode 100644 index 0000000000..b172aefe60 --- /dev/null +++ b/docs/nodes/GENERATORS/SIMULATIONS/POPULATE/examples/EX1/example.md @@ -0,0 +1,6 @@ +In this example, `LINSPACE` is used to generate a list of 1000 samples, it is then passed into two `POPULATE` nodes, which randomizes the values within the list with a normal (or Gaussian) distribution and a Poisson distribution. + +The distribution is then plotted with `HISTOGRAM` and as expected of a Gaussian distribution, +the output of the `HISTOGRAM` node converges towards a bell curve. The Poisson distribution results in more of a step function. + +The `POPULATE` node requires an input `Vector` or `OrderedPair` to function. diff --git a/docs/nodes/GENERATORS/SIMULATIONS/RAND/a1-[autogen]/docstring.txt b/docs/nodes/GENERATORS/SIMULATIONS/RAND/a1-[autogen]/docstring.txt index 77fa907315..55e1ceeb71 100644 --- a/docs/nodes/GENERATORS/SIMULATIONS/RAND/a1-[autogen]/docstring.txt +++ b/docs/nodes/GENERATORS/SIMULATIONS/RAND/a1-[autogen]/docstring.txt @@ -1,32 +1,32 @@ - The RAND node generates a random number or a list of random numbers, depending on the distribution selected. -Inputs ------- -default : OrderedPair|Vector - Optional input to use as the x-axis for the random samples. + Inputs + ------ + default : DataContainer + unused in this node -Parameters ----------- -distribution : select - the distribution over the random samples -lower_bound : float - the lower bound of the output interval -upper_bound : float - the upper bound of the output interval -normal_mean : float - the mean or "center" of the normal distribution -normal_standard_deviation : float - the spread or "width" of the normal distribution -poisson_events : float - the expected number of events occurring in a fixed time-interval when distribution is poisson + Parameters + ---------- + distribution : select + the distribution over the random samples + size : int + the size of the output. =1 outputs Scalar, >1 outputs Vector + lower_bound : float + the lower bound of the output interval + upper_bound : float + the upper bound of the output interval + normal_mean : float + the mean or "center" of the normal distribution + normal_standard_deviation : float + the spread or "width" of the normal distribution + poisson_events : float + the expected number of events occurring in a fixed time-interval when distribution is poisson -Returns -------- -OrderedPair|Scalar - OrderedPair if there is an input. - x: the x-axis of the input - y: the random samples + Returns + ------- + Scalar|Vector + Vector if size > 1 + v: the random samples - Scalar if there is no input. - c: the random number + Scalar if size = 1 + c: the random number diff --git a/docs/nodes/GENERATORS/SIMULATIONS/RAND/a1-[autogen]/python_code.txt b/docs/nodes/GENERATORS/SIMULATIONS/RAND/a1-[autogen]/python_code.txt index 05c0109177..33ed2bd37e 100644 --- a/docs/nodes/GENERATORS/SIMULATIONS/RAND/a1-[autogen]/python_code.txt +++ b/docs/nodes/GENERATORS/SIMULATIONS/RAND/a1-[autogen]/python_code.txt @@ -1,37 +1,30 @@ import random import numpy as np -from flojoy import flojoy, OrderedPair, Scalar, Vector, display +from flojoy import flojoy, Scalar, Vector, display, DataContainer from typing import Literal, Optional @flojoy def RAND( - default: Optional[OrderedPair | Vector] = None, + default: Optional[DataContainer] = None, distribution: Literal["normal", "uniform", "poisson"] = "normal", + size: int = 1000, lower_bound: float = 0, upper_bound: float = 1, normal_mean: float = 0, normal_standard_deviation: float = 1, poisson_events: float = 1, -) -> OrderedPair | Scalar: +) -> Vector | Scalar: + assert size >= 1, "Size must be greater than or equal to than 1" + if upper_bound < lower_bound: upper_bound, lower_bound = lower_bound, upper_bound seed = random.randint(1, 10000) my_generator = np.random.default_rng(seed) - match default: - case OrderedPair(): - size = len(default.x) - x = default.x - case Vector(): - size = len(default.v) - x = default.v - case _: - size = 1 - match distribution: case "uniform": y = my_generator.uniform(low=lower_bound, high=upper_bound, size=size) @@ -42,19 +35,24 @@ def RAND( case "poisson": y = my_generator.poisson(lam=poisson_events, size=size) - return OrderedPair(x=x, y=y) if default else Scalar(c=y) + if size > 1: + return Vector(v=y) + + return Scalar(c=float(y[0])) @display -def OVERLOAD(lower_bound, upper_bound, distribution="uniform") -> None: +def OVERLOAD(size, lower_bound, upper_bound, distribution="uniform") -> None: return None @display -def OVERLOAD(normal_mean, normal_standard_deviation, distribution="normal") -> None: +def OVERLOAD( + size, normal_mean, normal_standard_deviation, distribution="normal" +) -> None: return None @display -def OVERLOAD(poisson_events, distribution="poisson") -> None: +def OVERLOAD(size, poisson_events, distribution="poisson") -> None: return None diff --git a/docs/nodes/GENERATORS/SIMULATIONS/RAND/examples/EX1/app.json b/docs/nodes/GENERATORS/SIMULATIONS/RAND/examples/EX1/app.json index cc4910b1e8..b4ad89dd4c 100644 --- a/docs/nodes/GENERATORS/SIMULATIONS/RAND/examples/EX1/app.json +++ b/docs/nodes/GENERATORS/SIMULATIONS/RAND/examples/EX1/app.json @@ -2,75 +2,90 @@ "rfInstance": { "nodes": [ { - "width": 150, - "height": 150, - "id": "LINSPACE-cc55781a-14c8-4405-8fd1-0157351b3486", - "type": "default", + "width": 380, + "height": 293, + "id": "HISTOGRAM-c5469532-dd28-4465-b8b0-524174db86e4", + "type": "VISUALIZERS", "data": { - "id": "LINSPACE-cc55781a-14c8-4405-8fd1-0157351b3486", - "label": "LINSPACE", - "func": "LINSPACE", - "type": "default", - "ctrls": { - "start": { - "type": "float", - "default": 10, - "functionName": "LINSPACE", - "param": "start", - "value": "0" - }, - "end": { - "type": "float", - "default": 0, - "functionName": "LINSPACE", - "param": "end", - "value": "2000" - }, - "step": { - "type": "int", - "default": 1000, - "functionName": "LINSPACE", - "param": "step", - "value": "2000" + "id": "HISTOGRAM-c5469532-dd28-4465-b8b0-524174db86e4", + "label": "HISTOGRAM", + "func": "HISTOGRAM", + "type": "VISUALIZERS", + "ctrls": {}, + "inputs": [ + { + "name": "default", + "id": "default", + "type": "OrderedPair|DataFrame|Matrix", + "multiple": false } - }, + ], "outputs": [ { "name": "default", "id": "default", - "type": "OrderedPair" + "type": "Plotly" } ], - "path": "PYTHON/nodes/GENERATORS/SIMULATIONS/LINSPACE/LINSPACE.py", + "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/HISTOGRAM/HISTOGRAM.py", "selected": false }, "position": { - "x": 71.58328955005041, - "y": -121.19469825521614 + "x": 811.2928245068351, + "y": -146.0596461029216 }, "selected": false, "positionAbsolute": { - "x": 71.58328955005041, - "y": -121.19469825521614 + "x": 811.2928245068351, + "y": -146.0596461029216 }, "dragging": true }, { - "width": 250, - "height": 159, - "id": "HISTOGRAM-c5469532-dd28-4465-b8b0-524174db86e4", + "width": 380, + "height": 293, + "id": "BIG_NUMBER-59ecc8d4-f674-4af7-869f-f429f0b1c266", "type": "VISUALIZERS", "data": { - "id": "HISTOGRAM-c5469532-dd28-4465-b8b0-524174db86e4", - "label": "HISTOGRAM", - "func": "HISTOGRAM", + "id": "BIG_NUMBER-59ecc8d4-f674-4af7-869f-f429f0b1c266", + "label": "BIG NUMBER", + "func": "BIG_NUMBER", "type": "VISUALIZERS", - "ctrls": {}, + "ctrls": { + "suffix": { + "type": "str", + "default": null, + "functionName": "BIG_NUMBER", + "param": "suffix", + "value": "" + }, + "prefix": { + "type": "str", + "default": null, + "functionName": "BIG_NUMBER", + "param": "prefix", + "value": "" + }, + "title": { + "type": "str", + "default": null, + "functionName": "BIG_NUMBER", + "param": "title", + "value": "" + }, + "relative_delta": { + "type": "bool", + "default": true, + "functionName": "BIG_NUMBER", + "param": "relative_delta", + "value": true + } + }, "inputs": [ { "name": "default", "id": "default", - "type": "OrderedPair|DataFrame|Matrix", + "type": "OrderedPair", "multiple": false } ], @@ -81,134 +96,201 @@ "type": "Plotly" } ], - "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/HISTOGRAM/HISTOGRAM.py", + "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/BIG_NUMBER/BIG_NUMBER.py", "selected": false }, "position": { - "x": 807.1730016964145, - "y": -111.45313449538975 + "x": 815.0077637293098, + "y": 255.69966488030104 }, "selected": false, "positionAbsolute": { - "x": 807.1730016964145, - "y": -111.45313449538975 + "x": 815.0077637293098, + "y": 255.69966488030104 }, "dragging": true }, { - "width": 130, - "height": 130, - "id": "RAND-1fe43d0a-6b15-49d0-b6e0-35c61744a60a", + "width": 208, + "height": 96, + "id": "RAND-110a9abb-d0df-4b06-9555-6b9e38cdd237", "type": "GENERATORS", "data": { - "id": "RAND-1fe43d0a-6b15-49d0-b6e0-35c61744a60a", + "id": "RAND-110a9abb-d0df-4b06-9555-6b9e38cdd237", "label": "RAND", "func": "RAND", "type": "GENERATORS", "ctrls": { "distribution": { "type": "select", - "default": "normal", "options": [ "normal", "uniform", "poisson" ], + "default": "normal", + "desc": "the distribution over the random samples", + "overload": { + "uniform": [ + "size", + "lower_bound", + "upper_bound" + ], + "normal": [ + "size", + "normal_mean", + "normal_standard_deviation" + ], + "poisson": [ + "size", + "poisson_events" + ] + }, "functionName": "RAND", "param": "distribution", "value": "normal" }, + "size": { + "type": "int", + "default": 1000, + "desc": "the size of the output. =1 outputs Scalar, >1 outputs Vector", + "overload": null, + "functionName": "RAND", + "param": "size", + "value": 1000 + }, "lower_bound": { "type": "float", "default": 0, + "desc": "the lower bound of the output interval", + "overload": null, "functionName": "RAND", "param": "lower_bound", - "value": "0" + "value": 0 }, "upper_bound": { "type": "float", "default": 1, + "desc": "the upper bound of the output interval", + "overload": null, "functionName": "RAND", "param": "upper_bound", - "value": "1" + "value": 1 }, "normal_mean": { "type": "float", "default": 0, + "desc": "the mean or \"center\" of the normal distribution", + "overload": null, "functionName": "RAND", "param": "normal_mean", - "value": "0" + "value": 0 }, "normal_standard_deviation": { "type": "float", "default": 1, + "desc": "the spread or \"width\" of the normal distribution", + "overload": null, "functionName": "RAND", "param": "normal_standard_deviation", - "value": "5" + "value": 1 }, "poisson_events": { "type": "float", "default": 1, + "desc": "the expected number of events occurring in a fixed time-interval when distribution is poisson", + "overload": null, "functionName": "RAND", "param": "poisson_events", - "value": "1" + "value": 1 } }, + "initCtrls": {}, "inputs": [ { "name": "default", "id": "default", - "type": "OrderedPair", - "multiple": false + "type": "Any", + "multiple": false, + "desc": "unused in this node" } ], "outputs": [ { "name": "default", "id": "default", - "type": "OrderedPair|Scalar" + "type": "Vector|Scalar", + "desc": "Vector if size > 1\nv: the random samples\n\nScalar if size = 1\nc: the random number" } ], - "path": "PYTHON/nodes/GENERATORS/SIMULATIONS/RAND/RAND.py", + "path": "GENERATORS/SIMULATIONS/RAND/RAND.py", "selected": false }, "position": { - "x": 454.43802731096747, - "y": -117.22102655068787 + "x": 428.5700838695367, + "y": -49.13895270504895 }, "selected": false, "positionAbsolute": { - "x": 454.43802731096747, - "y": -117.22102655068787 + "x": 428.5700838695367, + "y": -49.13895270504895 }, "dragging": true }, { - "width": 130, - "height": 130, - "id": "RAND-e09e675f-ccaf-44b3-8842-6cea418c4b00", + "width": 208, + "height": 96, + "id": "RAND-d9a6b7da-5ef2-4bb6-bf6d-cd92baca5f7d", "type": "GENERATORS", "data": { - "id": "RAND-e09e675f-ccaf-44b3-8842-6cea418c4b00", + "id": "RAND-d9a6b7da-5ef2-4bb6-bf6d-cd92baca5f7d", "label": "RAND 1", "func": "RAND", "type": "GENERATORS", "ctrls": { "distribution": { "type": "select", - "default": "normal", "options": [ "normal", "uniform", "poisson" ], + "default": "normal", + "desc": "the distribution over the random samples", + "overload": { + "uniform": [ + "size", + "lower_bound", + "upper_bound" + ], + "normal": [ + "size", + "normal_mean", + "normal_standard_deviation" + ], + "poisson": [ + "size", + "poisson_events" + ] + }, "functionName": "RAND", "param": "distribution", "value": "normal" }, + "size": { + "type": "int", + "default": 1000, + "desc": "the size of the output. =1 outputs Scalar, >1 outputs Vector", + "overload": null, + "functionName": "RAND", + "param": "size", + "value": 1 + }, "lower_bound": { "type": "float", "default": 0, + "desc": "the lower bound of the output interval", + "overload": null, "functionName": "RAND", "param": "lower_bound", "value": 0 @@ -216,6 +298,8 @@ "upper_bound": { "type": "float", "default": 1, + "desc": "the upper bound of the output interval", + "overload": null, "functionName": "RAND", "param": "upper_bound", "value": 1 @@ -223,145 +307,78 @@ "normal_mean": { "type": "float", "default": 0, + "desc": "the mean or \"center\" of the normal distribution", + "overload": null, "functionName": "RAND", "param": "normal_mean", - "value": "30" + "value": 0 }, "normal_standard_deviation": { "type": "float", "default": 1, + "desc": "the spread or \"width\" of the normal distribution", + "overload": null, "functionName": "RAND", "param": "normal_standard_deviation", - "value": "50" + "value": 1 }, "poisson_events": { "type": "float", "default": 1, + "desc": "the expected number of events occurring in a fixed time-interval when distribution is poisson", + "overload": null, "functionName": "RAND", "param": "poisson_events", "value": 1 } }, + "initCtrls": {}, "inputs": [ { "name": "default", "id": "default", - "type": "OrderedPair|Vector", - "multiple": false + "type": "Any", + "multiple": false, + "desc": "unused in this node" } ], "outputs": [ { "name": "default", "id": "default", - "type": "OrderedPair|Scalar" + "type": "Vector|Scalar", + "desc": "Vector if size > 1\nv: the random samples\n\nScalar if size = 1\nc: the random number" } ], - "path": "PYTHON/nodes/GENERATORS/SIMULATIONS/RAND/RAND.py", + "path": "GENERATORS/SIMULATIONS/RAND/RAND.py", "selected": false }, "position": { - "x": 385.163294287524, - "y": 328.61362457174704 + "x": 424.11613231809054, + "y": 352.35894002884334 }, "selected": false, "positionAbsolute": { - "x": 385.163294287524, - "y": 328.61362457174704 - }, - "dragging": true - }, - { - "width": 225, - "height": 226, - "id": "BIG_NUMBER-59ecc8d4-f674-4af7-869f-f429f0b1c266", - "type": "VISUALIZERS", - "data": { - "id": "BIG_NUMBER-59ecc8d4-f674-4af7-869f-f429f0b1c266", - "label": "BIG NUMBER", - "func": "BIG_NUMBER", - "type": "VISUALIZERS", - "ctrls": { - "suffix": { - "type": "str", - "default": null, - "functionName": "BIG_NUMBER", - "param": "suffix", - "value": "" - }, - "prefix": { - "type": "str", - "default": null, - "functionName": "BIG_NUMBER", - "param": "prefix", - "value": "" - }, - "title": { - "type": "str", - "default": null, - "functionName": "BIG_NUMBER", - "param": "title", - "value": "" - }, - "relative_delta": { - "type": "bool", - "default": true, - "functionName": "BIG_NUMBER", - "param": "relative_delta", - "value": true - } - }, - "inputs": [ - { - "name": "default", - "id": "default", - "type": "OrderedPair", - "multiple": false - } - ], - "outputs": [ - { - "name": "default", - "id": "default", - "type": "Plotly" - } - ], - "path": "PYTHON/nodes/VISUALIZERS/PLOTLY/BIG_NUMBER/BIG_NUMBER.py", - "selected": false - }, - "position": { - "x": 818.3036219776461, - "y": 287.8342828015806 - }, - "selected": false, - "positionAbsolute": { - "x": 818.3036219776461, - "y": 287.8342828015806 + "x": 424.11613231809054, + "y": 352.35894002884334 }, "dragging": true } ], "edges": [ { - "source": "LINSPACE-cc55781a-14c8-4405-8fd1-0157351b3486", - "sourceHandle": "default", - "target": "RAND-1fe43d0a-6b15-49d0-b6e0-35c61744a60a", - "targetHandle": "default", - "id": "reactflow__edge-LINSPACE-cc55781a-14c8-4405-8fd1-0157351b3486default-RAND-1fe43d0a-6b15-49d0-b6e0-35c61744a60adefault" - }, - { - "source": "RAND-1fe43d0a-6b15-49d0-b6e0-35c61744a60a", + "source": "RAND-110a9abb-d0df-4b06-9555-6b9e38cdd237", "sourceHandle": "default", "target": "HISTOGRAM-c5469532-dd28-4465-b8b0-524174db86e4", "targetHandle": "default", - "id": "reactflow__edge-RAND-1fe43d0a-6b15-49d0-b6e0-35c61744a60adefault-HISTOGRAM-c5469532-dd28-4465-b8b0-524174db86e4default" + "id": "reactflow__edge-RAND-110a9abb-d0df-4b06-9555-6b9e38cdd237default-HISTOGRAM-c5469532-dd28-4465-b8b0-524174db86e4default" }, { - "source": "RAND-e09e675f-ccaf-44b3-8842-6cea418c4b00", + "source": "RAND-d9a6b7da-5ef2-4bb6-bf6d-cd92baca5f7d", "sourceHandle": "default", "target": "BIG_NUMBER-59ecc8d4-f674-4af7-869f-f429f0b1c266", "targetHandle": "default", - "id": "reactflow__edge-RAND-e09e675f-ccaf-44b3-8842-6cea418c4b00default-BIG_NUMBER-59ecc8d4-f674-4af7-869f-f429f0b1c266default" + "id": "reactflow__edge-RAND-d9a6b7da-5ef2-4bb6-bf6d-cd92baca5f7ddefault-BIG_NUMBER-59ecc8d4-f674-4af7-869f-f429f0b1c266default" } ], "viewport": { 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/nodeSidebar.json b/nodeSidebar.json index 6b4da632bc..ad1769fa69 100644 --- a/nodeSidebar.json +++ b/nodeSidebar.json @@ -33,6 +33,7 @@ "nodes/GENERATORS/SIMULATIONS/FEEDBACK/FEEDBACK", "nodes/GENERATORS/SIMULATIONS/LINSPACE/LINSPACE", "nodes/GENERATORS/SIMULATIONS/MATRIX/MATRIX", + "nodes/GENERATORS/SIMULATIONS/POPULATE/POPULATE", "nodes/GENERATORS/SIMULATIONS/RAND/RAND", "nodes/GENERATORS/SIMULATIONS/SCALAR/SCALAR", "nodes/GENERATORS/SIMULATIONS/SECOND_ORDER_SYSTEM/SECOND_ORDER_SYSTEM",