Essentially I've got an excel files with voltage in the first column, and time in the second. I want to find the period of the voltages, as it returns a graph of voltage in y axis and time in x axis with a periodicity, looking similar to a sine function.
To find the frequency I have uploaded my excel file to python as I think this will make it…
I need to do a binomial test in Python that allows calculation for 'n' numbers of the order of 10000.
I have implemented a quick binomial_test function using scipy.misc.comb, however, it is pretty much limited around n = 1000, I guess because it reaches the biggest representable number while computing factorials or the combinatorial itself.…
I am trying to figure out what the best way to debug a segault with swig/python/c++.
A core file is being generated.
I have a basic MessageFactory(defined in c++ that provides a simple interface to accept a few strings as input and return a string as output).
This interface is then specified in a .i file.
swig is used to generate Wrapper.cpp…
Hey all-
I'm doing some performance-critical Python work and want to create a function that removes a few elements from a list if they meet certain criteria. I'd rather not create any copies of the list because it's filled with a lot of really large objects.
Functionality I want to implement:
def listCleanup(listOfElements):
i = 0
…
Python for Windows by default comes with IDLE, which is the barest-bones IDE I've ever encountered. For editing files, I'll stick to emacs, thank you very much.
However, I want to run programs in some other shell than the crappy windows command prompt, which can't be widened to more than 80 characters.
IDLE lets me run programs in it if…
I am having issues running this:
link-mbp:codeswarm-0.1 benb$ python convert_logs/convert_logs.py -perforce-path
Traceback (most recent call last):
File “convert_logs/convert_logs.py”, line 408, in
main()
File “convert_logs/convert_logs.py”, line 350, in main
files = run_marshal(’p4 -G describe -s “‘ + changelist['change'] + ‘”‘)
KeyError:…
I'm debugging an script that I'm writing and the result of
executing a statement from pdb does not make sense so my
natural reaction is to try to trace it with pdb.
To paraphrase:
Yo dawg, I like python, so can you put my pdb in my pdb so I can debug while I debug?
I want to be able to bring up an interactive python terminal from my python application. Some, but not all, variables in my program needs to be exposed to the interpreter.
Currently I use a sub-classed and modified QPlainTextEdit and route all "commands" there to eval or exec, and keep track of a separate namespace in a dict. However there…
Hi,
I'm currently launching a programme using subprocess.Popen(cmd, shell=TRUE)
I'm fairly new to Python, but it 'feels' like there ought to be some api that lets me do something similar to:
subprocess.Popen(cmd, shell=TRUE, postexec_fn=function_to_call_on_exit)
I am doing this so that function_to_call_on_exit can do something based…
hi,everyone:
I run my python script functions like this:
read from a text file, and store the data as dict. But when in the loop, an Illegal instruction occurs. why this happens?
the psu-code is :
d={}
datafile=open('a.txt') # a big text file
for line in datafile:
line=line.rstrip('\n')
for token in line.split():
…
Hi all,
I am trying to get started with JSON in Python, but it seems that I misunderstand something in the JSON concept. I followed the google api example, which works fine. But when I change the code to a lower level in the JSON response (as shown below, where I try to get access to the location), I get the following error…
Hey, I'm really struggling with this one. I'am trying to port a small piece of someone else's code to Python and this is what I have:
typedef struct
{
uint8_t Y[LUMA_HEIGHT][LUMA_WIDTH];
uint8_t Cb[CHROMA_HEIGHT][CHROMA_WIDTH];
uint8_t Cr[CHROMA_HEIGHT][CHROMA_WIDTH];
} __attribute__((__packed__)) frame_t;
frame_t…
I am learning Python using "Dive Into Python 3" book. I like it, but I don't understand the example used to introduce Closures in Section 6.5.
I mean, I see how it works, and I think it's really cool. But I don't see any real benefit: it seems to me the same result could be achieved by simply reading in the rules file…
I'm trying to create an SQLite 3 database from Python. I have a few types I'd like to insert into each record: A float, and then 3 groups of n floats, currently a tuple but could be an array or list.. I'm not well-enough versed in Python to understand all the differences. My problem is the INSERT statement.
DAS = 12345…
Hi,
I use python sax to parse xml file.
The xml file is actually a combination of multiple xml files.
It looks like as follows:
<row name="abc" age="40" body="blalalala..." creationdate="03/10/10" />
<row name="bcd" age="50" body="blalalala..." creationdate="03/10/09" />
My python code is in the…
I work on something in Seattle Repy which is a restricted subset of Python. Anyway, I wanted to implement my own Queue that derives from a list:
class Queue(list):
job_count = 0
def __init__(self):
list.__init__(self)
def appendleft(item):
item.creation_time = getruntime()
…
There's lots of good conference videos online regarding Python and Django development.
Instead of watching ST:TNG at the computer, I figure it'd more productive to hone my knowledge . Fire away with some of your most inspiring and educational Python, Django, or simply programming related talks. Provide an…
I'm learning Python, and have run into a bit of a problem. On my OSX install of Python 3.1, this happens in the console:
>>> filename = "test"
>>> reader = open(filename, 'r')
>>> writer = open(filename, 'w')
>>> reader.read()
''
>>> writer.write("hello…
This simple Python method I put together just checks to see if Tomcat is running on one of our servers.
import urllib2
import re
import sys
def tomcat_check():
tomcat_status = urllib2.urlopen('http://10.1.1.20:7880')
results = tomcat_status.read()
pattern =…