Hi,
The reason I've didn't send an example, is that in order to reproduce this 
issue - you'll need to have a meter that uses Modbus communication protocol in 
order to get a valid response object.
(it's the output of "read_holding_registers" function on pymodbus3, which is 
has almost no documentation AT ALL)

Is there a way to "export" an object so I'll be able to send it here?
One of the parameters in this object is a regular list, but when I replace it 
with a list of my own (same values same everything) - the issue is not 
reproduced.
(when looking in the watch list of the PyCharm - both are registered as <class 
'list'>)
That's why I figured I'll ask without example and maybe this is a simple or 
known issue that can be answered without it.

To answer your questions:
1. Dtype is float32
2. shape is <class 'tuple'>: (4,)
3. difference between values are: 
        [  2.25699615e+02   5.51561475e-01   3.81394744e+00   1.03807904e-01]
        Instead of:
        [225.69961547851562, 0.5515614748001099, 3.8139474391937256, 
0.10380790382623672]
4. I've only used the word "list" in the mail example and not in my code..

Anyway, the basic code looks like this:
def func():
        Input = [17249, 45850, 16141, 13090, 16500, 6071, 15828, 39229] 
#usually this would be: Input = payload.registers
        Result = np.array(Input, dtype='>u2')
        Result = np.frombuffer(Result.data, dtype='>u4')
        Result = np.array(Result, dtype='<u4')
        Result = np.frombuffer(Result.data, dtype='f4')
        Return Result

Now, this is where it gets even more strange:
I'm calling this function from another *.py file.
If I'll print it here - no matter with or without [] - it will give these 
values:
[  2.25699615e+02   5.51561475e-01   3.81394744e+00   1.03807904e-01] 
But if I'll print it like this: print(Result.tolist()) - it'll give the correct 
values:
[225.69961547851562, 0.5515614748001099, 3.8139474391937256, 
0.10380790382623672]

But when I copied the function to the same file I called it before - 
print(Result[0::]) also return the correct values...

I know it's not the most specific and detailed problem, so any ideas as to how 
to make it more so will be much appreciated..

Thanks again,
Nissim.




 

-----Original Message-----
From: NumPy-Discussion 
[mailto:numpy-discussion-bounces+nissimd=elspec-ltd....@python.org] On Behalf 
Of numpy-discussion-requ...@python.org
Sent: Wednesday, October 18, 2017 7:00 PM
To: numpy-discussion@python.org
Subject: NumPy-Discussion Digest, Vol 133, Issue 13

Send NumPy-Discussion mailing list submissions to
        numpy-discussion@python.org

To subscribe or unsubscribe via the World Wide Web, visit
        https://mail.python.org/mailman/listinfo/numpy-discussion
or, via email, send a message with subject or body 'help' to
        numpy-discussion-requ...@python.org

You can reach the person managing the list at
        numpy-discussion-ow...@python.org

When replying, please edit your Subject line so it is more specific than "Re: 
Contents of NumPy-Discussion digest..."


Today's Topics:

   1. different values for ndarray when printed with or without [ ]
      (Nissim Derdiger)
   2. Re: different values for ndarray when printed with or without
      [ ] (Andras Deak)
   3. Re: different values for ndarray when printed with or without
      [ ] (Nicholas Nadeau)
   4. Github overview change (Sebastian Berg)


----------------------------------------------------------------------

Message: 1
Date: Wed, 18 Oct 2017 10:44:22 +0000
From: Nissim Derdiger <niss...@elspec-ltd.com>
To: "numpy-discussion@python.org" <numpy-discussion@python.org>
Subject: [Numpy-discussion] different values for ndarray when printed
        with or without [ ]
Message-ID:
        <9EFE3345170EF24DB67C61C1B05EEEDB407E0A02@EX10.Elspec.local>
Content-Type: text/plain; charset="us-ascii"

Hi all,
I have a ndarray, that shows different values when called like that: print(arr) 
or like that print(arr[0::]).
When changing it back to a python string (with list = arr.tolist()) - both 
prints return same value, but when converting that list back to np array 
(arr=np.array(list)) - the printing issue returns.
Any ideas what may cause that?
Thanks,
Nissim.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.python.org/pipermail/numpy-discussion/attachments/20171018/7f206b66/attachment-0001.html>

------------------------------

Message: 2
Date: Wed, 18 Oct 2017 14:25:44 +0200
From: Andras Deak <deak.and...@gmail.com>
To: Discussion of Numerical Python <numpy-discussion@python.org>
Subject: Re: [Numpy-discussion] different values for ndarray when
        printed with or without [ ]
Message-ID:
        <CAMEWA4O_n2oFUXGiqa=OFif8XhC7=s4_cacqu8gwzb2svkh...@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

On Wed, Oct 18, 2017 at 12:44 PM, Nissim Derdiger <niss...@elspec-ltd.com> 
wrote:
> Hi all,
>
> I have a ndarray, that shows different values when called like that:
> print(arr) or like that print(arr[0::]).
>
> When changing it back to a python string (with list = arr.tolist()) ? 
> both prints return same value, but when converting that list back to 
> np array
> (arr=np.array(list)) ? the printing issue returns.
>
> Any ideas what may cause that?

Hi Nissim,

I suggest adding some specifics. What is the shape and dtype of your array? 
What are the differences in values? In what way are they different? The best 
would be if you could provide a minimal, reproducible example.
Regards,

Andr?s


------------------------------

Message: 3
Date: Wed, 18 Oct 2017 08:39:01 -0400
From: Nicholas Nadeau <nicholas.nad...@gmail.com>
To: Discussion of Numerical Python <numpy-discussion@python.org>
Subject: Re: [Numpy-discussion] different values for ndarray when
        printed with or without [ ]
Message-ID:
        <cah-pdf-gagjmyev-p8h09tzpqnpveuhjtv9gz8l9q046gqy...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hi Nissim,

While a working example will be helpful, I just wanted to confirm that you're 
not assigning a value to `list`, as you did in your message (e.g., ` list = 
arr.tolist()`).

Because if that's the case, then you may run into issues, as `list` is a 
built-in Python keyword (for the `list` class).

Cheers,

--
Nicholas Nadeau, P.Eng., AVS

On 18 October 2017 at 06:44, Nissim Derdiger <niss...@elspec-ltd.com> wrote:

> Hi all,
>
> I have a ndarray, that shows different values when called like that:
> print(arr) or like that print(arr[0::]).
>
> When changing it back to a python string (with list = arr.tolist()) ? 
> both prints return same value, but when converting that list back to 
> np array
> (arr=np.array(list)) ? the printing issue returns.
>
> Any ideas what may cause that?
>
> Thanks,
>
> Nissim.
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://mail.python.org/pipermail/numpy-discussion/attachments/20171018/214ffa1e/attachment-0001.html>

------------------------------

Message: 4
Date: Wed, 18 Oct 2017 15:23:27 +0200
From: Sebastian Berg <sebast...@sipsolutions.net>
To: Discussion of Numerical Python <numpy-discussion@python.org>
Subject: [Numpy-discussion] Github overview change
Message-ID: <1508333007.27279.2.ca...@sipsolutions.net>
Content-Type: text/plain; charset="utf-8"

Hi all,

probably silly, but is anyone else annoyed at not seeing comments anymore in 
the github overview/start page? I stopped getting everything as mails and had a 
(bad) habit of glancing at them which would spot at least bigger discussions 
going on, but now it only shows actual commits, which honestly are less 
interesting to me.

Probably just me, was just wondering if anyone knew a setting or so?

- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part
URL: 
<http://mail.python.org/pipermail/numpy-discussion/attachments/20171018/262aa661/attachment-0001.sig>

------------------------------

Subject: Digest Footer

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion


------------------------------

End of NumPy-Discussion Digest, Vol 133, Issue 13
*************************************************
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion

Reply via email to