Re: Pickle caching objects?

2019-12-16 Thread Inada Naoki
Would you try the pull request in this issue?
https://bugs.python.org/issue36694

I'm not sure this issue is relating to you because I don't know about your data.

Regards,

On Sun, Dec 1, 2019 at 10:14 AM José María Mateos  wrote:
>
> Hi,
>
> I just asked this question on the IRC channel but didn't manage to get a
> response, though some people replied with suggestions that expanded this
> question a bit.
>
> I have a program that has to read some pickle files, perform some
> operations on them, and then return. The pickle objects I am reading all
> have the same structure, which consists of a single list with two
> elements: the first one is a long list, the second one is a numpy
> object.
>
> I found out that, after calling that function, the memory taken by the
> Python executable (monitored using htop -- the entire thing runs on
> Python 3.6 on an Ubuntu 16.04, pretty standard conda installation with a
> few packages installed directly using `conda install`) increases in
> proportion to the size of the pickle object being read. My intuition is
> that that memory should be free upon exiting.
>
> Does pickle keep a cache of objects in memory after they have been
> returned? I thought that could be the answer, but then someone suggested
> to measure the time it takes to load the objects. This is a script I
> wrote to test this; nothing(filepath) just loads the pickle file,
> doesn't do anything with the output and returns how long it took to
> perform the load operation.
>
> ---
> import glob
> import pickle
> import timeit
> import os
> import psutil
>
> def nothing(filepath):
> start = timeit.default_timer()
> with open(filepath, 'rb') as f:
> _ = pickle.load(f)
> return timeit.default_timer() - start
>
> if __name__ == "__main__":
>
> filelist = glob.glob('/tmp/test/*.pk')
>
> for i, filepath in enumerate(filelist):
> print("Size of file {}: {}".format(i, os.path.getsize(filepath)))
> print("First call:", nothing(filepath))
> print("Second call:", nothing(filepath))
> print("Memory usage:", psutil.Process(os.getpid()).memory_info().rss)
> print()
> ---
>
> This is the output of the second time the script was run, to avoid any
> effects of potential IO caches:
>
> ---
> Size of file 0: 11280531
> First call: 0.1466723980847746
> Second call: 0.10044755204580724
> Memory usage: 49418240
>
> Size of file 1: 8955825
> First call: 0.07904054620303214
> Second call: 0.07996074995025992
> Memory usage: 49831936
>
> Size of file 2: 43727266
> First call: 0.37741047400049865
> Second call: 0.38176894187927246
> Memory usage: 49758208
>
> Size of file 3: 31122090
> First call: 0.271301960805431
> Second call: 0.27462846506386995
> Memory usage: 49991680
>
> Size of file 4: 634456686
> First call: 5.526095286011696
> Second call: 5.558765463065356
> Memory usage: 539324416
>
> Size of file 5: 3349952658
> First call: 29.50982437795028
> Second call: 29.461691531119868
> Memory usage: 3443597312
>
> Size of file 6: 9384929
> First call: 0.0826977719552815
> Second call: 0.08362263604067266
> Memory usage: 3443597312
>
> Size of file 7: 422137
> First call: 0.0057482069823890924
> Second call: 0.005949910031631589
> Memory usage: 3443597312
>
> Size of file 8: 409458799
> First call: 3.562588643981144
> Second call: 3.6001368327997625
> Memory usage: 3441451008
>
> Size of file 9: 44843816
> First call: 0.3913297887245
> Second call: 0.398518088972196
> Memory usage: 3441451008
> ---
>
> Notice that memory usage increases noticeably specially on files 4 and
> 5, the biggest ones, and doesn't come down as I would expect it to. But
> the loading time is constant, so I think I can disregard any pickle
> caching mechanisms.
>
> So I guess now my question is: can anyone give me any pointers as to why
> is this happening? Any help is appreciated.
>
> Thanks,
>
> --
> José María (Chema) Mateos || https://rinzewind.org/
> --
> https://mail.python.org/mailman/listinfo/python-list



-- 
Inada Naoki  
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Pickle caching objects?

2019-12-16 Thread Peter J. Holzer
On 2019-12-16 08:56:26 +0100, dieter wrote:
> Note also that Python memeory management is quite elaborate:
> not every memory block is immediately obtained from and released
> to the operating system: Python has its own memory management
> data structures (to fill the gap between the fine grained
> memory requirements of a Python application and the mostly crude memory
> management services the operating system supports out of hand).
> This means that usually, a memory block freed by the Python application
> is not returned to the operating system but maintained by Python's
> memory management to be reused later. As a consequence, operating system
> tools for memory monitoring usually cannot tell the amount of memory
> really used by the application.

This is all true even if python does nothing special[1]: The C library
itself manages memory like this. So if python just calls malloc and
free you will see this behaviour. In particular the GNU C library (used
on most Linux systems) serves all "small" allocations from a common
pool (called the "heap") which can only grow and shrink at one end and
requests "large" allocations directly from the OS. Since the python
interpreter tends to use lots of small objects, most of the allocations
come from the heap which can't be returned to the OS unless there is a
large unused chunk right at the end.

hp

[1] I haven't looked at the source code, but ltrace reveals a lot of
small mallocs, so it probably doesn't.

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: The file method read does not "see" CR

2019-12-16 Thread Peter J. Holzer
On 2019-12-10 10:15:45 +, Stephen Tucker wrote:
> I am running Python 2.7.10 on a Windows 10 machine.

Unless you have a really good reason to stick with Python 2.7, don't:
https://pythonclock.org/

The current version of Python is 3.8, and there have been quite a few
changes between 2.x and 3.x, especially in the treatment of byte and
character strings.

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


distinguishable matplotlib colours / symbols / line styles

2019-12-16 Thread duncan smith
Hello,
  Not really specific to Python or matplotlib (but that's what I'm
using). I'm looking for a good combination of colours and symbols for
scatter plots, and combination of colours and line styles for line
plots. Too often I find myself producing these when I don't know whether
they will end up being printed in colour or greyscale. It would be a lot
easier if I could produce decent plots that would work well in either
case. I can find various stuff on colour palettes, but pretty much
nothing on symbols or line styles. Is anybody aware of an approach that
works well? I'm aware of issues with colour blindness and RGB versus
CMYK. Ideally I'd have something that I could just use that would deal
with all these issues. TIA.

Duncan
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: distinguishable matplotlib colours / symbols / line styles

2019-12-16 Thread Chris Angelico
On Tue, Dec 17, 2019 at 3:16 AM duncan smith  wrote:
>
> Hello,
>   Not really specific to Python or matplotlib (but that's what I'm
> using). I'm looking for a good combination of colours and symbols for
> scatter plots, and combination of colours and line styles for line
> plots. Too often I find myself producing these when I don't know whether
> they will end up being printed in colour or greyscale. It would be a lot
> easier if I could produce decent plots that would work well in either
> case. I can find various stuff on colour palettes, but pretty much
> nothing on symbols or line styles. Is anybody aware of an approach that
> works well? I'm aware of issues with colour blindness and RGB versus
> CMYK. Ideally I'd have something that I could just use that would deal
> with all these issues. TIA.
>

I'd recommend looking at the Web Content Accessibility Guidelines
published by the W3C; there are a number of tools out there that are
designed to help you pick colours for a web page, and the same sorts
of rules will apply here, I think.

Also, thank you for even *thinking* about this. A lot of people don't. :)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Problem Running Python

2019-12-16 Thread Patrick Igwilo via Python-list

Hello,I downloaded and tried installing Python 3.8.0 on my windows 8.1 PC from 
the websitewww.python.org/downloadsAfter the 32-bit version was automatically 
downloaded and I successfully installed same (even though my PC has a 64-bit 
CPU), I tried opening the installed program and I got an error message 
essentially saying that a certain “ms crt file” with a dll extension was 
missing from my computer and as a result the program would not run.
kindly assist me through the proper download and installation procedure as I 
really need to start learning coding with the Python programming language.
Many thanks for the good work.

Patrick.


  
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Problem Running Python

2019-12-16 Thread MRAB

On 2019-12-15 14:54, Patrick Igwilo via Python-list wrote:


Hello,I downloaded and tried installing Python 3.8.0 on my windows 8.1 PC from 
the websitewww.python.org/downloadsAfter the 32-bit version was automatically 
downloaded and I successfully installed same (even though my PC has a 64-bit 
CPU), I tried opening the installed program and I got an error message 
essentially saying that a certain “ms crt file” with a dll extension was 
missing from my computer and as a result the program would not run.
kindly assist me through the proper download and installation procedure as I 
really need to start learning coding with the Python programming language.
Many thanks for the good work.


If it's complaining about this "api-ms-win-crt-runtime-l1-1-0.dll", then
you need the Windows Universal C Runtime:

http://www.microsoft.com/en-us/download/details.aspx?id=48234
--
https://mail.python.org/mailman/listinfo/python-list


Re: Setting Pythonpath programmatic

2019-12-16 Thread Barry Scott



> On 14 Dec 2019, at 16:00, Prasad Rajassekaran 
>  wrote:
> 
> 0
> 
> 
> Aim:-
> 
> I would want to set python path programmatic in my project. So that, all 
> other directories files can be imported without any issues.
> 
> Problem statement:-
> 
> I used to add all the folders & sub-folders in environment variables under 
> PYTHONPATH but this has two constrains.
> 
> 1, Any new folders created need to be added in environment variables all the 
> times. After certain limit, environment variables will not be accepted new 
> path reference due to characters limitaion.
> 
> - Error: This environment variable is too large. This dialog allows setting 
> values up to 2047 characters long.
> 
> 2, Secondly, all the team members in my team need to perform the same 
> activity manually all the times.
> 
> Tried self solution:-
> 
> Created a sample folder and added the below code before main import files and 
> ran from command prompt which worked perfectly fine.
> 
> **FilePath: foo/Python/Learning&Development/Pratice/Directory1/File1.py**
> 
> class File1():
> 
>def parent(self):
>return "I am from File1"
> 
> **FilePath: foo/Python/Learning&Development/Pratice/Directory2/File2.py**
> 
>import sys
> try:
>sys.path.index('foo/Python/Learning&Development')
>sys.path.index('foo/Python/Learning&Development/Pratice')
>sys.path.index('foo/Python/Learning&Development/Pratice/Directory1')
>sys.path.index('foo/Python/Learning&Development/Pratice/Directory2')
> except ValueError:
>sys.path.append('foo/Python/Learning&Development')

That's your top folder.

> sys.path.append('foo/Python/Learning&Development/Pratice')
>sys.path.append('foo/Python/Learning&Development/Pratice/Directory1')
>sys.path.append('foo/Python/Learning&Development/Pratice/Directory2')

But what are these? Do you have modules so can access from the top folder?

> 
> from Pratice.Directory1.File1 import File1 as f

Only works if you have created modules on the disk.

Do you have __init__.py in Pratice, Practice/Directot1 etc?

Barry


> 
> 
> class File2():
> 
>def child(self):
>return f.parent(self)
> Results:
> 
> I am from File1
> 
> Now I wish to convert the sys.path as a single method and call automatically 
> before running any .py file in the project folder.
> 
> So, on trail basis, I created 'init.py' file added the same piece (sys.path) 
> of code, commented the same code in File2.py and run it but ended up with 
> file import error.
> 
> **FilePath: foo/Python/Learning&Development/Pratice/Directory2/__init__.py**
> 
> import sys
> try:
>sys.path.index('foo/Automation/Python/Learning&Development')
>sys.path.index('foo/Automation/Python/Learning&Development/Pratice')
>
> sys.path.index('foo/Automation/Python/Learning&Development/Pratice/Directory1')
>
> sys.path.index('foo/Automation/Python/Learning&Development/Pratice/Directory2')
> except ValueError:
>sys.path.append('foo/Automation/Python/Learning&Development')
>sys.path.append('foo/Automation/Python/Learning&Development/Pratice')
> sys.path.append('foo/Automation/Python/Learning&Development/Pratice/Directory1')
>  
> sys.path.append('foo/Automation/Python/Learning&Development/Pratice/Directory2')
> 
> **FilePath: foo/Python/Learning&Development/Pratice/Directory1/File1.py**
> 
> class File1():
> 
>def parent(self):
>return "I am from File1"
> 
> **FilePath: foo/Python/Learning&Development/Pratice/Directory2/File2.py**
> 
> # import sys
> # try:
># sys.path.index('foo/Python/Learning&Development')
># sys.path.index('foo/Python/Learning&Development/Pratice')
># sys.path.index('foo/Python/Learning&Development/Pratice/Directory1')
># sys.path.index('foo/Python/Learning&Development/Pratice/Directory2')
> # except ValueError:
># sys.path.append('foo/Python/Learning&Development')
># sys.path.append('foo/Python/Learning&Development/Pratice')
># sys.path.append('foo/Python/Learning&Development/Pratice/Directory1')
># sys.path.append('foo/Python/Learning&Development/Pratice/Directory2')
> 
> from Pratice.Directory1.File1 import File1 as f
> 
> 
> class File2():
> 
>def child(self):
>return f.parent(self)
> Results:
> 
> Traceback (most recent call last):
>  File "File2.py", line 13, in 
>from Pratice.Directory1.File1 import File1 as f
> ModuleNotFoundError: No module named 'Pratice
> 
> Could someone help me on this problem? I would want the same piece of code to 
> be executed before running any of the .py file in my project folder. So that, 
> import error would not come into picture.
> 
> Expected: Python path should be set automatically by default and import error 
> should not occur while running any python file in the project.
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: distinguishable matplotlib colours / symbols / line styles

2019-12-16 Thread DL Neil via Python-list

On 17/12/19 5:19 am, Chris Angelico wrote:

On Tue, Dec 17, 2019 at 3:16 AM duncan smith  wrote:


Hello,
   Not really specific to Python or matplotlib (but that's what I'm
using). I'm looking for a good combination of colours and symbols for
scatter plots, and combination of colours and line styles for line
plots. Too often I find myself producing these when I don't know whether
they will end up being printed in colour or greyscale. It would be a lot
easier if I could produce decent plots that would work well in either
case. I can find various stuff on colour palettes, but pretty much
nothing on symbols or line styles. Is anybody aware of an approach that
works well? I'm aware of issues with colour blindness and RGB versus
CMYK. Ideally I'd have something that I could just use that would deal
with all these issues. TIA.



I'd recommend looking at the Web Content Accessibility Guidelines
published by the W3C; there are a number of tools out there that are
designed to help you pick colours for a web page, and the same sorts
of rules will apply here, I think.

Also, thank you for even *thinking* about this. A lot of people don't. :)


+1

We spend a lot of time teaching this topic (non-Python courses). It 
receives a lot of often highly-polarised comments/discussion. Many folk 
have their 'eyes opened' to an issue which has not affected them 
personally. Some even have to be informed that it is a legal obligation 
in their jurisdiction. However, it also receives the highest number of 
'why do I have to learn this stuff' complaints...


I learned (way back) that the incidence of "color blindness" is far 
higher than I had imagined. Secondly, that it affects males more than 
females. Thirdly, that calling it "blindness" is a bit of a misnomer, 
because whilst people often can't see red 'correctly' (most common 
symptom), they do see something (it varies). Which is why they are 
permitted to drive vehicles (traffic lights: red, amber/yellow, green - 
and arrows; plus stop/brake lights), but why many smart-phone apps/web 
pages which encode information-relevance (red is 'wrong' and green/blue 
is acceptable) can become almost unusable (without other cues).


Those key-words: "accessibility guidelines" will yield a swag of useful 
tools - ignore the ones which are basically 'help choose the color of my 
web page/color palette, because they are often aiming (only) for 
'pretty'. The best tools enumerate the efficacy of fg/bg 
color-combinations, allowing one to experiment; and will enumerate 
grey-scale variation/comparisons.



Hmmm, note to self (you've inspired me to specifically review/critique 
the printing-from-screen action): what happens when we take a 
color-checked screen display and print same but end-up viewing it as 
monochrome/grey-scale output? Probably not a main-stream demand, but 
worth tossing at the WCAG experts...

--
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: distinguishable matplotlib colours / symbols / line styles

2019-12-16 Thread Chris Angelico
On Tue, Dec 17, 2019 at 8:09 AM DL Neil via Python-list
 wrote:
>
> On 17/12/19 5:19 am, Chris Angelico wrote:
> > On Tue, Dec 17, 2019 at 3:16 AM duncan smith  wrote:
> >>
> >> Hello,
> >>Not really specific to Python or matplotlib (but that's what I'm
> >> using). I'm looking for a good combination of colours and symbols for
> >> scatter plots, and combination of colours and line styles for line
> >> plots. Too often I find myself producing these when I don't know whether
> >> they will end up being printed in colour or greyscale. It would be a lot
> >> easier if I could produce decent plots that would work well in either
> >> case. I can find various stuff on colour palettes, but pretty much
> >> nothing on symbols or line styles. Is anybody aware of an approach that
> >> works well? I'm aware of issues with colour blindness and RGB versus
> >> CMYK. Ideally I'd have something that I could just use that would deal
> >> with all these issues. TIA.
> >>
> >
> > I'd recommend looking at the Web Content Accessibility Guidelines
> > published by the W3C; there are a number of tools out there that are
> > designed to help you pick colours for a web page, and the same sorts
> > of rules will apply here, I think.
> >
> > Also, thank you for even *thinking* about this. A lot of people don't. :)
>
> +1
>
> We spend a lot of time teaching this topic (non-Python courses). It
> receives a lot of often highly-polarised comments/discussion. Many folk
> have their 'eyes opened' to an issue which has not affected them
> personally. Some even have to be informed that it is a legal obligation
> in their jurisdiction. However, it also receives the highest number of
> 'why do I have to learn this stuff' complaints...

So true. Although sometimes it pays to just make it an arbitrary
requirement - for instance, if your students submit code for grading,
you could incorporate into your rubric "must have zero errors in aXe
report" (along with "must have zero errors in W3C Validator"). Yes,
that's technically not the point... but it's remarkably helpful in
dealing with those unreadable web sites that, unfortunately, can be
seen in a lot of production environments...

> Those key-words: "accessibility guidelines" will yield a swag of useful
> tools - ignore the ones which are basically 'help choose the color of my
> web page/color palette, because they are often aiming (only) for
> 'pretty'. The best tools enumerate the efficacy of fg/bg
> color-combinations, allowing one to experiment; and will enumerate
> grey-scale variation/comparisons.

Agreed; "accessibility" or "a11y" (and yes, I will pronounce that
"ally", judge me all you like) is the thing to look for. Looking for
"readability" can be a bit hit or miss, but "a11y" does well.

> Hmmm, note to self (you've inspired me to specifically review/critique
> the printing-from-screen action): what happens when we take a
> color-checked screen display and print same but end-up viewing it as
> monochrome/grey-scale output? Probably not a main-stream demand, but
> worth tossing at the WCAG experts...

It's funny how the same considerations come up in different contexts.
Advice from a Twitch emote artist: Always desaturate your image to
greyscale and see how it looks. If your icon still looks like the
thing it's meant to be, great! But if it all blurs away to nothing
when it's greyscaled, chances are it won't be readable even in its
original colour form. This is especially true if you have more than
two colours involved - say, you have a shaped background and text that
goes partly on it and partly off it, so the text needs to be readable
on both the backgrounds.

I'm sure the experts have already looked into that exact concept, and
probably have a much more rigorous way to define the problem and the
solution. But "flip the saturation to zero in your image editor" is a
pretty close approximation. You can do the same thing with a web page
with a bit of CSS:

body {filter: saturate(0);}

Check your page like that and see if it's still readable. A good page
will just look nightvisioned, a bad one will suddenly be unreadable.

(For the fun of it, I just tried that on a few web sites. After doing
that for a while, your brain gets used to it, and then colour starts
to look weird...)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python3 - How do I import a class from another file

2019-12-16 Thread DL Neil via Python-list
Wow, I turned my back to attend to $job and this conversation has 
'exploded' (>80 msgs)!


TLDR;
With apologies, I started to reply to your reply, but then added 'bits' 
as I read the conversation thereafter. The result (below) is a messy 
hodge-podge, for which I can only apologise (as I don't have more 
spare-time to be able to 'fix it' and edit it into some semblance of 
proper order). May I suggest a first quick-read to pick-up the 
'highlights', and then re-reading in order to make sense of the 
cross-references? I regret the appearance of circling-back between topics...




On 10/12/19 9:45 pm, R.Wieser wrote:
...


Than again, I normally camel-case my variable and function names (to make
them stand out from the build-in commands), as I normally do not use editors
with syntax highlighting.

...


:-) Always start with a descriptive* name for the variable, regardless of if
it is a compounded one or not.   As said, the type prefix is just a
reminder.


Remember that PEP-8 is (only?) applied to code submitted for inclusion 
in the Python Standard Library. It's wider application is less 
prescriptive (although many in-house style manuals take an 
embrace-and-extend approach).


Bottom-line (IMHO):
- if you are coding by yourself and only for yourself, you make your own 
'rules'!
- if you are working with others, you (all) come up with 'the rules' - 
one of which may be that you allow 'the other guy' to make his own 
rules, whilst (s)he does the same for you - and simply work-around that 
with your own (and, one assumes, v-v)
- if the organisation/team already has 'rules', then you adapt to the 
group mores...


Have you come across the bit where Guido (I think?) talks about "the 
hobgoblin" of over-applying 'rules'? To which the 'Zen of Python' adds 
(the joke) "unless you're Dutch".


The topic of naming-standards is a massive time-sink/hobgoblin (see also 
- using tabs or spaces to indent, and 'how many spaces')...
(see also: which car is 'best', which language is 'best', which team..., 
which super-hero..., do you really love me? does my bum look big in this...)


That said, there's enough to learn when taking-on a new language, 
without 'sweating the small stuff' ("cognitive load"). So, if it helps 
you to use VS Coding Standards right now, just do it. Later, as you come 
to understand more of the 'philosophies' behind Python, you will/may 
learn/adapt (see also, 'working with others', above).




*though not /too/ descriptive.   Languages which can easily have
40-character names for variables, functions and such are simply the pits,
especially when they start to differ only for a single/few character(s)
somewhere in the middle. :-(


Surely it is unlikely that all 40-characters are necessary to 
communicate meaning!? Even in Welsh?Tamil?Dutch?German?


That said, it is *so* easy with modern text editors to make universal 
changes (an error-laden task filled with so much peril it was 
strenuously-avoided in the ?good, old, days) - which ease applies as 
much to variableNMs as it does to interpreting what tab-to-indent 
means/is to mean for this module!


In other words, I play as fast-and-loose as does Python (per earlier 
comment).




rudy = Man( etc ) #rudy probably does have class, in this instance

You almost owed me a new keyboard there. :-p


Normally my lame jokes are greeted with a groan, so I'll take that as a 
compliment (regardless of how it was intended - I'm that desperate!)



Which brings me to a few points, noted throughout the conversation. 
Whereas I do offer training (not Python), hold a qualification in the 
field (specifically vocational training/andragogy), and have a research 
interest in Cognitive Psychology (yeah, yeah, blah, blah, big deal...) 
there will be very few others, similar, who are also (active) members of 
this list. Expecting high-quality 'training materials' as responses is 
probably asking 'a bit much'...



We do have folk (on the list) who are actively developing the language, 
others who use the language professionally and every-day, and still 
more, less specialised, right ?down to 'mere' hobbyists who only get to 
talk-Python at (some) weekends. Answers reflect that. However, a scan of 
(names frequently appearing in) the archives will soon reveal 'much'!


In case of misunderstanding:
There is no-one (to my knowledge) who is paid to be 'here'. All 
contributions are voluntary and provided out of people's 'free time'. It 
is not a manufacturer's 'support site'!


The best way to receive help with coding (as has been said) is to 
copy-paste *your* problematic code into a post. This allows interested 
parties to easily reproduce the problem (or not). It also ensures that 
responses are as specific as possible by providing 'focus'!


It also pays to continue the copy-paste-result pattern when replying to 
advice: 'I've tried it, and 'this' is what happened' - yet I understood 
you to say 'that' should...' Such not only ensures/contributes to 
ensuring that 

Re: distinguishable matplotlib colours / symbols / line styles

2019-12-16 Thread duncan smith
On 16/12/2019 21:08, DL Neil wrote:
> On 17/12/19 5:19 am, Chris Angelico wrote:
>> On Tue, Dec 17, 2019 at 3:16 AM duncan smith 
>> wrote:
>>>
>>> Hello,
>>>    Not really specific to Python or matplotlib (but that's what I'm
>>> using). I'm looking for a good combination of colours and symbols for
>>> scatter plots, and combination of colours and line styles for line
>>> plots. Too often I find myself producing these when I don't know whether
>>> they will end up being printed in colour or greyscale. It would be a lot
>>> easier if I could produce decent plots that would work well in either
>>> case. I can find various stuff on colour palettes, but pretty much
>>> nothing on symbols or line styles. Is anybody aware of an approach that
>>> works well? I'm aware of issues with colour blindness and RGB versus
>>> CMYK. Ideally I'd have something that I could just use that would deal
>>> with all these issues. TIA.
>>>
>>
>> I'd recommend looking at the Web Content Accessibility Guidelines
>> published by the W3C; there are a number of tools out there that are
>> designed to help you pick colours for a web page, and the same sorts
>> of rules will apply here, I think.
>>
>> Also, thank you for even *thinking* about this. A lot of people don't. :)
> 
> +1
> 
> We spend a lot of time teaching this topic (non-Python courses). It
> receives a lot of often highly-polarised comments/discussion. Many folk
> have their 'eyes opened' to an issue which has not affected them
> personally. Some even have to be informed that it is a legal obligation
> in their jurisdiction. However, it also receives the highest number of
> 'why do I have to learn this stuff' complaints...
> 
> I learned (way back) that the incidence of "color blindness" is far
> higher than I had imagined. Secondly, that it affects males more than
> females. Thirdly, that calling it "blindness" is a bit of a misnomer,
> because whilst people often can't see red 'correctly' (most common
> symptom), they do see something (it varies). Which is why they are
> permitted to drive vehicles (traffic lights: red, amber/yellow, green -
> and arrows; plus stop/brake lights), but why many smart-phone apps/web
> pages which encode information-relevance (red is 'wrong' and green/blue
> is acceptable) can become almost unusable (without other cues).
> 
> Those key-words: "accessibility guidelines" will yield a swag of useful
> tools - ignore the ones which are basically 'help choose the color of my
> web page/color palette, because they are often aiming (only) for
> 'pretty'. The best tools enumerate the efficacy of fg/bg
> color-combinations, allowing one to experiment; and will enumerate
> grey-scale variation/comparisons.
> 
> 
> Hmmm, note to self (you've inspired me to specifically review/critique
> the printing-from-screen action): what happens when we take a
> color-checked screen display and print same but end-up viewing it as
> monochrome/grey-scale output? Probably not a main-stream demand, but
> worth tossing at the WCAG experts...

A paper I recently published contained a number of colour images (graphs
- of the nodes and edges variety - and line plots). But it turned out
that the funding we used to have for colour printing charges no longer
exists. So the print version is greyscale with links to online colour
images. Anyone accessing the paper online will be able to download a pdf
with colour images. I don't yet know whether there will be funding for
colour printing charges for the paper I'm currently working on, yet I'm
generating plots. So something that would work for all these possible
end points would be ideal. That brings up the issue of distinguishable
symbols / markers (for scatter plots) and distinguishable line styles
(for line plots). i.e. They might help for greyscale without being too
distracting for colour images. So a single image would do for all the
possible end points. I'm not 100% happy about readers of the print
journal (probably) having to go online to make sense of my recent paper,
but that's done now.

BTW, I've gone with the Seaborn qualitative 'colorblind' palette for
now. Still tinkering with different markers / marker sizes / line
weights etc. Cheers.

Duncan
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: distinguishable matplotlib colours / symbols / line styles

2019-12-16 Thread Chris Angelico
On Tue, Dec 17, 2019 at 1:38 PM Dennis Lee Bieber  wrote:
>
> Not of use to the OP -- my suggestion would have been to generate an
> image with a grid of the "available" (or likely candidate colors), then
> play with desaturating it in something like PhotoShop to see what results.
> I had a web page (lost the web server privileges when I moved and my new
> internet service doesn't offer space) showing examples of various color to
> grey conversions. I moved it to an R-Pi and set up a dynamic DNS, but it
> seems something in my u-Verse service is blocking outside access to the
> R-Pi server (I'd swear it was working when I first set it up, but a few
> months later it started timing out from outside access -- strangely, I can
> use the dynamic DNS address, and access from the LAN side, so my router
> must be recognizing the IP as "itself" and redirecting to the internal
> server).
>

Does it need an actual server, or is it a static file? If it's all
static, toss it up onto GitHub Pages for easy hosting.

That issue with the port-80-redirect is one I've seen with a number of
home-grade routers, unfortunately. One possible sidestep would be to
run it on HTTPS, which the router most likely doesn't support,
although that would cost a bit of extra processing power -  how's an
R-Pi on that?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


SCons 3.1.2 Released

2019-12-16 Thread Bill Deegan
  A new SCons checkpoint release, 3.1.2, is now available
  on the SCons download page:

  https://scons.org/pages/download.html

  Here is a summary of the changes since 3.1.1:

  NOTE: The 4.0.0 Release of SCons will drop Python 2.7 Support

  NEW FUNCTIONALITY
- Added debug option "action_timestamps" which outputs to stdout the
absolute start and end time for each target.

  REMOVED FUNCTIONALITY
- Turn previously deprecated debug options into failures:
  --debug=tree, --debug=dtree, --debug=stree, --debug=nomemoizer.
- Remove deprecated SourceSignatures, TargetSignatures
- Remove deprecated Builder keywords: overrides and scanner
- Remove deprecated env.Copy
- Remove deprecated BuildDir plus SConscript keyword build_dir


  CHANGED/ENHANCED EXISTING FUNCTIONALITY
- Update Command() function to accept target_scanner, source_factory,
and target_factory arguments.
  This makes Command act more like a one-off builder.
- Added support for "-imacros" to ParseFlags
- EXPERIMENTAL NEW FEATURE: Enable caching MSVC configuration
  If SCONS_CACHE_MSVC_CONFIG shell environment variable is set,
  SCons will cache the results of past calls to vcvarsall.bat to
  a file; integrates with existing memoizing of such vars.
  On vs2019 saves 5+ seconds per SCons invocation, which really
  helps test suite runs.

  FIXES
- Fix suncxx tool (Oracle Studio compiler) when using Python 3.
Previously would throw an exception.
  Resolved by properly handling tool version string output as unicode.
- Resolved a race condition in multithreaded Windows builds with Python
2
  in the case where a child process is spawned while a Python action
has a
  file open. Original author: Ryan Beasley.
- Fix CheckFunc detection code for Visual 2019. Some functions
  (e.g. memmove) were incorrectly recognized as not available.
- Fix stacktrace when using SCons with Python 3.5+ and SunOS/Solaris
related tools.
- Latex: Avoid crash with UnicodeDecodeError on Python 3 when a Latex
log file in
  non-UTF-8 encoding (e.g. containing umlauts in Latin-1 encoding when
  the fontenc package is included with \usepackage[T1]{fontenc}) is
read.
- CmdStringHolder fix from issue #3428

  IMPROVEMENTS
- Improved threading performance by ensuring NodeInfo is shared
  across threads. Results in ~13% improvement for parallel builds
  (-j# > 1) with many shared nodes.
- Improve performance of Entry.disambiguate() by making check for
  most common case first, preventing unnecessary IO.
- Improved DAG walk performance by reducing unnecessary work when
  there are no un-visited children.


  PACKAGING

 - N/A

  DOCUMENTATION

-  N/A

  DEVELOPMENT

- N/A


Thanks to the following developers for their contributions to this release.
git shortlog --no-merges -ns 3.1.1..HEAD
59  Mats Wichmann
21  William Deegan
 8  Edoardo Bezzeccheri
 5  Adam Gross
 5  maiphi
 4  Ivan Kravets
 4  Mathew Robinson
 2  Jakub Kulík
 2  Jacek Kuczera
 2  Rob Boehne
 2  Jason Kenny
 2  Tim Gates
 1  Jakub Kulik
 1  Theogen Ratkin
 1  jw0k
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: distinguishable matplotlib colours / symbols / line styles

2019-12-16 Thread DL Neil via Python-list

On 17/12/19 3:37 pm, Dennis Lee Bieber wrote:

If, by some chance, external nodes can get to it:
http://wlfraed.microdiversity.freeddns.org/BW/BWConv.html }


Works for me, no hacking necessary!
(photo of ppl dressed-up in Mickey Mouse type costumes)

--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list