Skip to content

numpy operations with multiple arrays #493

Closed Answered by AdamGlustein
bournejt asked this question in Q&A
Discussion options

You must be logged in to vote

If you just remove the Union annotation, it works off of the current 0.8.0 release. The bug is with the handling of the type annotation only.

from typing import Union
import numpy as np
from datetime import datetime

import csp

@csp.node
def clip_v1(x: csp.ts[Union[float, np.ndarray]],
             up_limit: csp.ts[np.ndarray] = None,
             dn_limit: csp.ts[np.ndarray] = None) -> csp.ts[np.ndarray]:

    return np.clip(x, dn_limit, up_limit)

@csp.graph
def g() -> csp.ts[np.ndarray]:
    a = csp.curve(np.ndarray, [(datetime(2020,1,1), np.array([1.,2.]))])
    lower = csp.curve(np.ndarray, [(datetime(2020,1,1), np.array([2.,3.]))])
    upper = csp.curve(np.ndarray, [(datetime(2020,1,1

Replies: 3 comments 9 replies

Comment options

You must be logged in to vote
2 replies
@bournejt
Comment options

@bournejt
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
7 replies
@bournejt
Comment options

@AdamGlustein
Comment options

@bournejt
Comment options

@AdamGlustein
Comment options

Answer selected by bournejt
@AdamGlustein
Comment options

@bournejt
Comment options

@AdamGlustein
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants