134 Posted Topics

Member Avatar for hughesadam_87

Hello all, Following the guide on sourceforge, I've created several pyplot programs which have nice event handling. I'm able to press keys on my keyboard and the plots advance and change. The backend for this program is GTKagg. There are several instances where I can change parameters in the plot …

Member Avatar for hughesadam_87
0
118
Member Avatar for hughesadam_87

Hey guys, Couldn't find the answer to this question in any old threads, probably because I don't know the terminology involved well enough. I have a program which takes in data and writes it into a numpy array at the beginning of a pipeline. I use a class called Masterarray …

Member Avatar for hughesadam_87
0
98
Member Avatar for hughesadam_87

Hey fellows, I've created a fairly large math suite for my spectrometer research, which is basically a set of programs that does several math operations, generates plots etc... It's beginning to get pretty bulky, and seems like it would benefit from a nice class; wherein, I could store all the …

Member Avatar for TrustyTony
0
121
Member Avatar for hughesadam_87

Hello all, I've tried to find this problem in past threads, so sorry if this is a repost. I have a large file with regular data. The file is too large for me to open it all at once, so I need to split it into evenly (preferred) spaced output …

Member Avatar for Gribouillis
0
296
Member Avatar for hughesadam_87

I have a series of data files with large headers. Here is an example: [COLOR="red"]SpectraSuite Data File ++++++++++++++++++++++++++++++++++++ Date: Fri Feb 25 13:43:55 EST 2011 User: group Dark Spectrum Present: No Reference Spectrum Present: No Number of Sampled Component Spectra: 1 Spectrometers: USB2E7196 Integration Time (usec): 11000 (USB2E7196) Spectra Averaged: …

Member Avatar for hughesadam_87
0
151
Member Avatar for hughesadam_87

I wrote a program that interactively allows you to import files directly from your HDD into another python program. When building a new program, you simply call my program, navigator, and it lets you choose a directory and it prints out a numbered list of file: file a 1 file …

Member Avatar for Gribouillis
0
162
Member Avatar for peguin1089

penguin, One thing you should be careful of when posting in this forum is that not everyone knows the context of your problem. Python is a multi-dimensional language which can be used to do anything from writing letters to solving partial differential equations. As such, when posting, you need to …

Member Avatar for hughesadam_87
0
162
Member Avatar for hughesadam_87

Hey guys, Tried doing a search on this, and couldn't figure out if anyone had posted it before. Basically, my question is this. I have a large python pipeline that outputs data to be compared in an ordered fashion where comparable entries are to overlay one another. For example: Entry …

Member Avatar for lolafuertes
0
84
Member Avatar for hughesadam_87

Hey guys, I've been trying to solve this problem many ways now, and am really just not familiar enough with the language to see an elegant solution. I have a dictionary, where each value is itself a list of lists. For example: [CODE]keyA:([x1,y1,z1], [x2,y2,z2] etc...) [/CODE] Within a key, I …

Member Avatar for djidjadji
0
377
Member Avatar for hughesadam_87

Hey all, I'm trying to read through a code written by a colleague last year in which he used the BioPython package. The package is no longer on my computer, and I have to wait for the systems admin to update it; thus, I'm forced to merely read the code. …

Member Avatar for keithsavin
0
114
Member Avatar for hughesadam_87

Hey all, I'm new to C and trying to pick up good habits before I get too routed in my ways. Essentially, I have a code which runs a mathematical test on an array, and depending on the percent error, it decides to continue iterating or stop. Essentially, I have …

Member Avatar for Hiroshe
0
88
Member Avatar for hughesadam_87

Hey guys, Say I had the following list: [1, 2, 2, 2, 3, 4,4] Let's assume that the list will always be integers. Does python have a built in feature which would take a sorted list, and then return the frequency that each element occurred. For example: 1 -> 1 …

Member Avatar for jlm699
0
157
Member Avatar for pythonbegginer

If you are using bash in the linux terminal, it is simple to just remove all directories containing "td" with: rm -r *td* First you may want to use ls *td* to make sure there are no other directories that would be removed in this process by mistake. I know …

Member Avatar for pythonbegginer
0
188
Member Avatar for hughesadam_87

Hey guys, This questions is more about organization of python modules than the actual construction therein. In my project, we have several scientists performing similar analysis on several different data sets. For each project, the science changes, but the analysis often requires almost identical data handling. For example, one project …

Member Avatar for hughesadam_87
0
128
Member Avatar for hughesadam_87

Hey all, I have been reading some older posts on line/list manipulation, but don't quite understand exactly how to implement all of the tools that you guys are using (line.strip() for example) to get what I need. Essentially, I have a working program that iterates through data and outputs it …

Member Avatar for tdeck
0
21K
Member Avatar for hughesadam_87

Hey guys, I want to write a program which scans the first line in a data file and sees whether it is delimited by "\t", "," or " ". If it is any of these, I want to keep the line, else, I want to raise some sort of error …

Member Avatar for woooee
0
102
Member Avatar for hughesadam_87

Hey guys, Lets say I had two different files, each with a column of data. So: [CODE](File 1) 1 2 3[/CODE] And [CODE](File 2) Friend Foe Fighter[/CODE] In the end, I want to unify these into one large file: [CODE] 1 Friend 2 Foe 3 Fighter[/CODE] Each file has an …

Member Avatar for hughesadam_87
0
89
Member Avatar for hughesadam_87

Hey guys, Has anyone here ever used python to produce data files which can be immediately read by excel? I thought at first if I just tab-delimited my data, I could copy and paste an entire data file into excel. This is not the case. When I take a tab …

Member Avatar for hughesadam_87
0
118
Member Avatar for hughesadam_87

Hey guys, When using the glob import, I want it to scan all of the files in a directory, but not scan other directories in that directory. For example, say I am in a directory with the following files: [CODE]file, file1, file2, DIRECTORY1, DIRECTORY2[/CODE] When I use the glob command: …

Member Avatar for vegaseat
0
154
Member Avatar for hughesadam_87

Hey guys, A while ago, with your help, I was able to create a code which scans a data file for names, and when a new name is found, it appends it to a list. For each entry is the list, the code then opens a new file for each …

Member Avatar for jlm699
0
1K
Member Avatar for hughesadam_87

Hey guys, I have been trying to search for this answer on online tutorials, but cannot figure out just what I am doing wrong. I have a list of names, and some of them have the character '/' For example: [CODE]list = [adam, bill, jon/juan][/CODE] Because later in my code, …

Member Avatar for hughesadam_87
0
131
Member Avatar for hughesadam_87

Hey everyone, I tried a site search but it turned up cold. Has anyone here ever written a small method to take a list of names and sort them in alphabetical order? If so, would you mind posting it up, or directing me to a tutorial that would explain this …

Member Avatar for lllllIllIlllI
0
96
Member Avatar for hughesadam_87

Hey guys, I wrote a file the other day, which reads in data, adds a column, and then reads the data out to a specific file. I thought everything was working great, with all of your help; however, I am now running into another problem. The output data looks like …

Member Avatar for sneekula
0
89
Member Avatar for hughesadam_87

Hey everyone, I am writing a simple code, and seek to do something which I don't know whether it is possible or not. First, I have a name list: [CODE]Name_List = ["Jake", "Steve", "Adam"];[/CODE] The first thing I'd like to do is open a separate file for each name in …

Member Avatar for hughesadam_87
0
101
Member Avatar for hughesadam_87

Hey everyone, Here is an outline of my problem: I have a working code which defines a class, GeneDict, which reads in data from a special type of file, and stores it as a dictionary. What it is really doing is taking in millions of lines of biological data, and …

Member Avatar for hughesadam_87
0
138
Member Avatar for hughesadam_87

Hey everyone, I wrote a code which runs a game of rock paper scissors, and each time you lose, it counts down until at 0, it exits. The only way I've been able to exit the code is to throw in a 'sys.exit()' command. I hear there are better ways …

Member Avatar for hughesadam_87
0
150
Member Avatar for hughesadam_87

Hey all, I have a class with various methods and I want to pass the output of one method into the next method. For example: [CODE]class RockPaperScissors: '''Rock paper scissors game, best of 3''' tries = 3 def __init__(self, name): 'Reads in users call' self.name = name print 'You picked …

Member Avatar for jlm699
0
179
Member Avatar for hughesadam_87

I am trying to learn object oriented programming and am still shaky on the ins and outs of classes. I understand their purpose, but can't seem to grasp many simple operations when using them. The dive into python section on classes is not very helpful either, so if you know …

Member Avatar for vegaseat
0
414
Member Avatar for hughesadam_87

Hey guys, Have been working on this tiny simple code for an hour and can't figure out how to fix it. The code does this: Reads in 3-column, tab-delimited data file Adds "1000" in the fourth column to every line Writes out the 4-column file [ICODE]def columns(infile, outfile): f = …

Member Avatar for woooee
0
131
Member Avatar for hughesadam_87

Hey everyone, I have the following data set A B C D E F G H I J K L M N O P Q R S T Where every ten lines or so (though not a regular pattern) the data breaks its format and two of the data pieces …

Member Avatar for Alxandr
0
112
Member Avatar for hughesadam_87

First let me say thanks to everyone who has been responding to my posts and providing valuable insight. I have been trying to add rep whenever possible, and appreciate your help. My assignment was to write a python code which takes data from an infile, then has the user specify …

Member Avatar for jlm699
0
351
Member Avatar for hughesadam_87

Hey all, I ran a code today which digested an input file which was 304 MB, consisting of about 10 million lines with six columns a piece. I ran the code and got an indexing error. In troubleshooting, I copied only the first 1,000,000 lines into a new data file, …

Member Avatar for hughesadam_87
0
151
Member Avatar for hughesadam_87

Hey fellas, I have searched for this answer for about an hour on and off and cannot find anything so sorry to have to resort to posting. I have a list [a, b, c, d] And I want to write it to a simple output file, but I want it …

Member Avatar for jlm699
0
140
Member Avatar for hughesadam_87

Hey guys, I'm new to python so if this is a silly question, pardon me. I have the following basic assignment: Take a user-specified range of lines from some data file, call it input, and write them to an output data file. What I want to do is have the …

Member Avatar for The_Kernel
0
140

The End.