Re: Cygwin Popen object

2005-01-17 Thread Grover
Yup that fixed it, thanks a million :)

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


dynamic modules

2005-02-04 Thread Grover
What is the best way to add a modules loaded with __import__() to the
global namespace? Example:

  foo = __import__( 'foo', globals(), locals(), ['*'] )
  
PS: what exactly are the parameters globals and locals used for?

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


PEAK-Rules package.

2015-12-30 Thread Radhika Grover
Hi,

I don't see any package available under 
https://pypi.python.org/simple/PEAK-Rules/. Could you please let me know if it 
has seen a change recently.

I need PEAK-Rules>=0.5a1.dev-r2600 using easy_install default behavior. 
Any help is appreciated. Thanks in advance!

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


Re: PEAK-Rules package.

2015-12-31 Thread Radhika Grover
Hi,

Thanks for the reply! I do see different revisions of PEAK-Rules listed on
- http://peak.telecommunity.com/snapshots/.

However, earlier as part our product installation
PEAK-Rules>=0.5a1.dev-r2600 dependency was being fulfilled using
easy_install default behavior. So, I think
https://pypi.python.org/simple/PEAK-Rules/ had the right package available
earlier. Could you please let me know if the above link has been changed.

- Radhika

On Thu, Dec 31, 2015 at 1:43 AM, Joel Goldstick 
wrote:

>
>
> On Wed, Dec 30, 2015 at 8:24 AM, Radhika Grover 
> wrote:
>
>> Hi,
>>
>> I don't see any package available under
>> https://pypi.python.org/simple/PEAK-Rules/. Could you please let me know
>> if it has seen a change recently.
>>
>> I need PEAK-Rules>=0.5a1.dev-r2600 using easy_install default behavior.
>> Any help is appreciated. Thanks in advance!
>>
>> - Radhika
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>
> https://pypi.python.org/pypi/PEAK-Rules maybe?
>
> --
> Joel Goldstick
> http://joelgoldstick.com/stats/birthdays
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Data Analysis Recommendations

2016-01-02 Thread Sameer Grover
I also collect data by sweeping multiple parameters in a similar fashion. I
find pandas very convenient for analysis.
I don't use all the features of pandas. I mainly use it for selecting
certain rows from the data, sometimes using database style merge
operations, and plotting using matplotlib. This can also be done using pure
numpy but with pandas, I don't have to keep track of all the indices

This is what my workflow is like (waarning - sloppy code):

data = pd.DataFrame()
data.columns = ['temperature', 'voltage_measured', 'voltage_applied',
'channels']
for channel in data.channels.unique():
for temperature in data.temperature.unique():
slope = fit_slope(data[data['temperature']==temperature and
data['channels']==channel]) # fit_slope(x) -> fits x.voltage_measured and
x.voltage_applied and returns slope
# append (channel, temperature, slope) to final plotting array etc


I imagine your database driven approach would do something similar but you
might find pandas more convenient given that it can all be done in python
and that you won't have to resort to SQL queries.

My data is small enough to get away with storing as plain text. But hdf5 is
definitely a better solution.

In addition to pytables, there is also h5py (http://www.h5py.org/). I
prefer the latter. You might like pytables because it is more database-like.

Sameer



On 31 December 2015 at 22:45, Rob Gaddi 
wrote:

> I'm looking for some advice on handling data collection/analysis in
> Python.  I do a lot of big, time consuming experiments in which I run a
> long data collection (a day or a weekend) in which I sweep a bunch of
> variables, then come back offline and try to cut the data into something
> that makes sense.
>
> For example, my last data collection looked (neglecting all the actual
> equipment control code in each loop) like:
>
> for t in temperatures:
>   for r in voltage_ranges:
> for v in test_voltages[r]:
>   for c in channels:
> for n in range(100):
>   record_data()
>
> I've been using Sqlite (through peewee) as the data backend, setting up
> a couple tables with a basically hierarchical relationship, and then
> handling analysis with a rough cut of SQL queries against the
> original data, Numpy/Scipy for further refinement, and Matplotlib
> to actually do the visualization.  For example, one graph was "How does
> the slope of straight line fit between measured and applied voltage vary
> as a function of temperature on each channel?"
>
> The whole process feels a bit grindy; like I keep having to do a lot of
> ad-hoc stitching things together.  And I keep hearing about pandas,
> PyTables, and HDF5.  Would that be making my life notably easier?  If
> so, does anyone have any references on it that they've found
> particularly useful?  The tutorials I've seen so far seem to not give
> much detail on what the point of what they're doing is; it's all "how
> you write the code" rather than "why you write the code".  Paying money
> for books is acceptable; this is all on the company's time/dime.
>
> Thanks,
> Rob
>
> --
> Rob Gaddi, Highland Technology -- www.highlandtechnology.com
> Email address domain is currently out of order.  See above to fix.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: pywin32 COM sort in Excel (late binding fails, early binding works) (+py2exe)

2006-10-20 Thread Kevin Grover

On Oct 19, 10:09 am, Thomas Heller <[EMAIL PROTECTED]> wrote:
> Thomas- Hide quoted text -- Show quoted text -

That's it thanks.  A quick google search lead me to:

http://www.py2exe.org/index.cgi/IncludingTypelibs

Cheers

- Kevin

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


NEED HELP

2006-08-28 Thread mailme . grover
Below is my code, which is kind of virtual and with its help ill use it
in my main project.
Now what i am looking for is can anybody write all the code inside a
class...so that I can reuse it. I am kind of novice...n kind of stuc
with that.

from Tkinter import *

root = Tk()

w = Label(root, text="Right-click to display menu", width=40,
height=20)
w.pack()

# create a menu
popup = Menu(root, tearoff=0)
popup.add_radiobutton(label="SourceIP", command= hello) # ,
command=next) etc...
popup.add_radiobutton(label="DestIP", command= hello)
popup.add_radiobutton(label="Reporter'sIP", command= hello)
popup.add_radiobutton(label="Observer'sIP", command= hello)
popup.add_separator()
popup.add_radiobutton(label="Home")

def do_popup(event):
# display the popup menu
try:
popup.post(event.x_root, event.y_root)
finally:
# make sure to release the grab (Tk 8.0a1 only)
popup.grab_release()
def hello(event= None):
print "hello"

w.bind("", do_popup)

b = Button(root, text="Quit", command=root.destroy)
b.pack()

mainloop()



THANKS A LOT

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


replacing built-in exception types

2007-12-11 Thread Nishkar Grover

I'm trying to replace a built-in exception type and here's a simplified 
example of what I was hoping to do...

 >>>
 >>> import exceptions, __builtin__
 >>>
 >>> zeroDivisionError = exceptions.ZeroDivisionError
 >>>
 >>> class Foo(zeroDivisionError):
... bar = 'bar'
...
 >>>
 >>> exceptions.ZeroDivisionError = Foo
 >>> ZeroDivisionError = Foo
 >>> __builtin__.ZeroDivisionError = Foo
 >>>
 >>> try:
... raise ZeroDivisionError
... except ZeroDivisionError, e:
... print e.bar
...
bar
 >>>
 >>> try:
... 1/0
... except ZeroDivisionError, e:
... print e.bar
...
Traceback (most recent call last):
   File "", line 2, in ?
ZeroDivisionError: integer division or modulo by zero
 >>>

Notice that I get my customized exception type when I explicitly raise 
ZeroDivisionError but not when that is implicitly raised by 1/0. It 
seems like I have to replace that exception type at some lower level, 
but I'm not sure how/where. Does anyone know of a way to do this?

- Nishkar

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


Re: replacing built-in exception types

2007-12-11 Thread Nishkar Grover

I'm trying to replace the built-in base exception class with a subclass 
of itself in python 2.5 because we can no longer add attributes to that...

% python2.4 -c 'import exceptions; exceptions.Exception.bar = 1234'

% python2.5 -c 'import exceptions; exceptions.Exception.bar = 1234'
Traceback (most recent call last):
   File "", line 1, in 
TypeError: can't set attributes of built-in/extension type 
'exceptions.Exception'

% python2.5 -c 'import exceptions; exceptions.BaseException.bar = 1234'
Traceback (most recent call last):
   File "", line 1, in 
TypeError: can't set attributes of built-in/extension type 
'exceptions.BaseException'

I already have a way to programatically construct the hierarchy of 
subclasses, so for example, my subclass of OSError is a subclass of the 
built-in OSError and a subclass of my subclass of EnvironmentError. The 
only thing left to do is find a way to replace the built-in exception 
types with my custom ones.

- Nishkar


Calvin Spealman wrote:
> 
> Why would you do this? How to do it, if its even possible, is far less
> important than if you should even attempt it in the first place.
> 
> 
> On Dec 11, 2007, at 3:51 PM, Nishkar Grover wrote:
>>
>> I'm trying to replace a built-in exception type and here's a simplified
>> example of what I was hoping to do...
>>
>> >>>
>> >>> import exceptions, __builtin__
>> >>>
>> >>> zeroDivisionError = exceptions.ZeroDivisionError
>> >>>
>> >>> class Foo(zeroDivisionError):
>> ... bar = 'bar'
>> ...
>> >>>
>> >>> exceptions.ZeroDivisionError = Foo
>> >>> ZeroDivisionError = Foo
>> >>> __builtin__.ZeroDivisionError = Foo
>> >>>
>> >>> try:
>> ... raise ZeroDivisionError
>> ... except ZeroDivisionError, e:
>> ... print e.bar
>> ...
>> bar
>> >>>
>> >>> try:
>> ... 1/0
>> ... except ZeroDivisionError, e:
>> ... print e.bar
>> ...
>> Traceback (most recent call last):
>>File "", line 2, in ?
>> ZeroDivisionError: integer division or modulo by zero
>> >>>
>>
>> Notice that I get my customized exception type when I explicitly raise
>> ZeroDivisionError but not when that is implicitly raised by 1/0. It
>> seems like I have to replace that exception type at some lower level,
>> but I'm not sure how/where. Does anyone know of a way to do this?
>>
>> - Nishkar
>>
>> --http://mail.python.org/mailman/listinfo/python-list
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


PyQt QScrollView/QGridLayout question

2008-07-11 Thread Samir Grover
folks, 

I am trying put some user input fields into a scrollable (QScrollView)
window. So,
I placed a QLabel at 0,0 and QLineEdit at 0,1, next to QLabel. 

Somehow, results are not what I am expecting.It is placing QLineEdit
below QLabel.
I am not using designer for this. Please, notice that I convert vbox's
box layout into
grid layout, so that, I can place QLabel at 0,0 and QLineEdit at 0,1.
But it does not
do that.  any advice on correcting this piece of code will be helpfull.
regards,

here is how this code looks like:

-
import sys, qt
from qt import *


class MyDialog(QDialog):
def __init__(self,parent = None,name = None,modal = 0,fl = 0):
QDialog.__init__(self,parent,name,modal,fl)

if not name:
self.setName("MyDialog")

self.setSizeGripEnabled(1)

self.build_window()

def build_window(self):

toplayout = QGridLayout(self,1,1,11,6,"toplayout")
vbMain = qt.QVBox(self)
toplayout.addWidget(vbMain, 0, 0)

sview = qt.QScrollView(vbMain)
vp = sview.viewport()
vbox = qt.QVBox(vp)
sview.addChild(vbox)

vplayout = qt.QGridLayout(vp, 0, 0, 1,-1, 'vpl')
vplayout.addWidget(vbox, 0, 0)

grid = qt.QGridLayout(vbox.layout(), 2, 2)

ll = qt.QLabel('circuit name', vbox)
grid.addWidget(ll, 0,0, qt.Qt.AlignLeft)

nameinput = qt.QLineEdit(vbox)
grid.addWidget(nameinput, 0,1, qt.Qt.AlignLeft)

if __name__ == "__main__":
app = QApplication(sys.argv)
f = MyDialog()
f.show()
app.setMainWidget(f)
app.exec_loop()


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