[Numpy-discussion] Proposal - Making ndarray object JSON serializable via standardized JData annotations

2021-11-25 Thread Qianqian Fang
Dear numpy developers, I would like to share a proposal on making ndarray JSON serializable by default, as detailed in this github issue: https://github.com/numpy/numpy/issues/20461 briefly, my group and collaborators are working on a new NIH (National Institute of Health) funded initiative

[Numpy-discussion] Re: Proposal - Making ndarray object JSON serializable via standardized JData annotations

2021-11-25 Thread Stephan Hoyer
Hi Qianqian, What is your concrete proposal for NumPy here? Are you suggesting new methods or functions like to_json/from_json in NumPy itself? As far as I can tell, reading/writing in your custom JSON format already works with your jdata library. Best, Stephan On Thu, Nov 25, 2021 at 2:35 PM Q

[Numpy-discussion] Re: Allow for callable in indexing

2021-11-25 Thread Juan Nunez-Iglesias
I have to say I like this! Together with partial functions / toolz currying [1] it could make for some rather elegant code: result = gaussian_filter(image)[greater_than(t)] Juan. ..[1]: https://toolz.readthedocs.io/en/latest/curry.html On Wed, 24 Nov 2021, at 9:37 AM, cameron.pinne...@gmail.co

[Numpy-discussion] Re: Proposal - Making ndarray object JSON serializable via standardized JData annotations

2021-11-25 Thread Qianqian Fang
On 11/25/21 17:05, Stephan Hoyer wrote: Hi Qianqian, What is your concrete proposal for NumPy here? Are you suggesting new methods or functions like to_json/from_json in NumPy itself? that would work - either define a subclass of JSONEncoder to serialize ndarray and allow users to pass it

[Numpy-discussion] Re: Proposal - Making ndarray object JSON serializable via standardized JData annotations

2021-11-25 Thread Robert Kern
On Thu, Nov 25, 2021 at 10:21 PM Qianqian Fang wrote: > On 11/25/21 17:05, Stephan Hoyer wrote: > > Hi Qianqian, > > What is your concrete proposal for NumPy here? > > Are you suggesting new methods or functions like to_json/from_json in > NumPy itself? > > > that would work - either define a sub

[Numpy-discussion] Re: Proposal - Making ndarray object JSON serializable via standardized JData annotations

2021-11-25 Thread Qianqian Fang
On 11/25/21 23:00, Robert Kern wrote: We could also provide a JSONEncoder/JSONDecoder pair, too, but as I mention in one of the Github issues you link to, there are a number of different expectations that people could have for what the JSON representation of an array is. Some will want to use t

[Numpy-discussion] Re: Proposal - Making ndarray object JSON serializable via standardized JData annotations

2021-11-25 Thread Robert Kern
On Thu, Nov 25, 2021 at 11:58 PM Qianqian Fang wrote: > from my limited experience, as long as the "TypeError" from json keeps > popping up, requests like this ( #12481, #16432, #18994, > pallets/flask#4012, openmm/openmm#3202, zarr-developers/zarr-python#354) > will unlikely to cease (and mainta