Re: Rosetta: Sequence of non-squares

2017-05-05 Thread pecore
breamore...@gmail.com writes:

> A problem at the moment is that although the gmane side works, you
> can't get onto the website

gmane ex-maintainer got fed up of people complaining through lawyers

he gave to new maintainers the gmane spools and the infrastructure to
harvest the mailing lists, but not the web site's code

while setting up a nntp server was a simple matter the new maintainers
are still struggling to build a new web site
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: list comprehension return a list and sum over in loop

2014-12-13 Thread pecore
KK Sasa genwei...@gmail.com writes:

 Hi there,

 The list comprehension is results = [d2(t[k]) for k in
 xrange(1000)], where d2 is a function returning a list, say
 [x1,x2,x3,x4] for one example. So results is a list consisting of
 1000 lists, each of length four. Here, what I want to get is the sum
 of 1000 lists, and then the result is a list of length four. Is
 there any efficient way to do this? Because I found it is slow in my
 case. I tried sum(d2(t[k]) for k in xrange(1000)), but it returned
 error: TypeError: unsupported operand type(s) for +: 'int' and
 'list'. Thanks.

Why didn't you  follow Mark Lawrence's advice? 

In your problem, results is a list of N sublists, each containing
exactly four numerical values,

Let's try with N=2

In [36]: results = [d2(t[k]) for k in range(2)]
In [37]: print results
[[1, 2, 3, 4], [5, 6, 7, 8]]

Let's try the obvious method to sum

In [38]: [sum(el) for el in results]
Out[38]: [10, 26]

not what you're looking for, but what if we had 

In [39]: [sum(el) for el in zip(*results)]
Out[39]: [6, 8, 10, 12]

correct.

BTW, as you're using the scientific stack the answer of Christian
Gollwitzer is the more appropriate.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Matplotlib Contour Plots

2014-08-19 Thread pecore
Jamie Mitchell jamiemitchell1...@gmail.com writes:

 You were right Christian I wanted a shape (2,150).

 Thank you Rustom and Steven your suggestion has worked.

 Unfortunately the data doesn't plot as I imagined.

 What I would like is:

 X-axis - hs_con_sw
 Y-axis - te_con_sw
 Z-axis - Frequency

 What I would like is for the Z-axis to contour the frequency or
 amount of times that the X-axis data and Y-axis data meet at a
 particular point or bin.

 Does anyone know what function or graph could best show this?

in my understanding, you have 3 arrays of data that describe 3D data
points, and you want to draw a 2D contour plot...

in this case you have to interpolate the z-values on a regular grid,
that's very easy if you already know what to do ;-)

here I assume that data is in a .csv file

% cat a.csv
0 ≤ x ≤ 10, 0 ≤ y ≤ 10, z = cos(sqrt((x-5)**2_(y-5)**2))
1.922065,5.827944,-0.998953
7.582322,0.559370,0.411861
5.001753,3.279957,-0.148694
...

of course my z's are different from yours, but this shouldn't be a
real problem --- and here it is my *tested* solution (tested on python
2.7, that is), please feel free to adapt to your needs

hth, ciao
   g

% cat contour.py
from numpy import loadtxt, linspace
from matplotlib.mlab import griddata
import matplotlib.pyplot as pl

# open 'a.csv', specify the delimiter, specify how many header rows,
# slurp the data
temp_array = loadtxt(open('a.csv'),delimiter=',',skiprows=1)

# the shape of temp_array is (N,3), we want its transpose
temp_array = temp_array.transpose()

# now the shape is (3,N) and we can do unpack and assignment:
x, y, z = temp_array

# now the tricky part, 

# 1: create two arrays with 101 (arbitrary number) equispaced values
# between 0 and 10 --- that is the ranges of data x and data y
xi = linspace(0,10,101)
yi = linspace(0,10,101)

# 2: create, by interpolation, the 2D array that contourf so eagerly
# awaited!
print griddata.__doc__
zi = griddata(x,y,z, xi,yi)

# eventually, lets plot the stuff...
# see http://matplotlib.org/examples/pylab_examples/griddata_demo.html
# for further details and ideas

pl.contour (xi,yi,zi,11,linewidths=1,colors='black')
pl.contourf(xi,yi,zi); pl.colorbar()
# optional
pl.gca().set_aspect('equal', 'box')
pl.show()
% python contour.py
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to look up historical time zones by date and location

2014-08-18 Thread pecore
Ian Kelly ian.g.ke...@gmail.com writes:

 Some experimentation determines that the timedelta between Shanghai
 and Urumqi

Urumqi is on the way for the level of popularity that Piraeus enjoyed
in the good ol'days
-- 
per crimini come l'umanita'.
   MMAX, in IPI+IHC
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to look up historical time zones by date and location

2014-08-18 Thread pecore
Joel Goldstick joel.goldst...@gmail.com writes:

 Local Mean Time is time based on the actually astronomical position
 of the sun.  It is defined as 12 noon when the sun is at its high
 point, directly south in the sky.  This is the time you get when you
 read a sundial!

a sundial measures the Apparent Time, where the duration between two
consecutive noons is different from 24*3600 s due to the variations in
the Sun apparent angular velocity, that are originated by the Earth's
orbit eccentricity and by the inclination of the Earth's rotation
axis

these variation are small but cumulative, so the AT can be fast or
slow with respect to the LMT by as much as ±15'

don't know if the same considerations apply also in Urumqi
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Exploring Python for next desktop GUI Project

2014-07-29 Thread pecore
Roy Smith r...@panix.com writes:

 In article 87mwbtjg9r@pascolo.net, pec...@pascolo.net wrote:

  2. Python 2 or 3? Which will serve me better in the future?
 
  Long term (7 years), [Python] 3.
 
 I have STRONG suicidal intent and no access to treatment,
 should I better learn Python 2?

 In that case, go with PHP.

ah, well said! but I went with PHP already and look at me now!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Exploring Python for next desktop GUI Project

2014-07-28 Thread pecore

 2. Python 2 or 3? Which will serve me better in the future?

 Long term (7 years), [Python] 3.

I have STRONG suicidal intent and no access to treatment,
should I better learn Python 2?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: 1-0.95

2014-07-01 Thread pecore
Pedro Izecksohn izecks...@yahoo.com writes:

 pedro@microboard:~$ /usr/bin/python3
 Python 3.3.2+ (default, Feb 28 2014, 00:52:16) 
 [GCC 4.8.1] on linux
 Type help, copyright, credits or license for more information.
 1-0.95
 0.050044
 

   How to get 0.05 as result?

print(%4.2f%(1-0.95))

i.e., you can change how a result is displayed, not its internal
representation
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [OFF-TOPIC] How do I find a mentor when no one I work with knows what they are doing?

2014-04-08 Thread pecore

  “I’m going to put wings on a [bleep] tank”.

class FairchildA10(...
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Explanation of list reference

2014-02-14 Thread pecore
dave em daveandem2...@gmail.com writes:

 He is asking a question I am having trouble answering which is how a
 variable containing a value differs from a variable containing a
 list or more specifically a list reference.

s/list/mutable object/

# Mr Bond and Mr Tont are two different ob^H^H persons
james_bond = SecretAgent()
james_tont = SecretAgent()

# in some circles, Mr Bond is know as agent 007
agent_007 = james_bond

# Mr Bond, aka 007, is sent to the Caribbeans to crush Spectre
agent_007.move_to('Barbados')
print agent_007.location
print james_bond.location

# Mr Bond, alas, retires and his place in the Mi5 is taken, alas, by Mr Tont
agent_007 = james_tont

# Mr Tont, aka 007, is sent to Hong Kong to, to, whatever... 
agent_007.move_to('Hong Kong')
print agent_007.location
print james_bond.location
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: cascading python executions only if return code is 0

2013-12-27 Thread pecore
Roy Smith r...@panix.com writes:

 Or how to deal with languages where 26 letters isn't enough.

English! that is, imvho
English is in sore need
of some more letters[*]
and of diacriticals too
  g
[*] unable to quantify!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Managing Google Groups headaches

2013-11-30 Thread pecore
Dennis Lee Bieber wlfr...@ix.netcom.com writes:

 [NNTP] clients provide full-fledged editors
   and conversely full-fledged editors provide
   NNTP clients
-- 
https://mail.python.org/mailman/listinfo/python-list