Timeline for read Python-generated data file
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 10, 2016 at 12:14 | comment | added | coussin | Thanks Szabolcs. I haven't heard of Interpreter[] before and it works quite well (at least, it does what I want here). | |
Feb 10, 2016 at 11:39 | comment | added | Szabolcs |
How many elements are there approximately? The simplest solutions tend to be the slowest, and often Interpreter is the simplest: Interpreter["ComplexNumber"]["-0.998722569699-0.000124681423362j"] does work for this form.
|
|
Feb 10, 2016 at 11:23 | answer | added | Jason B. | timeline score: 5 | |
Feb 10, 2016 at 11:13 | comment | added | coussin | What I pasted is the first line of the file. The file consists of a number of line, each line containing six complex numbers, separated by spaces. | |
Feb 10, 2016 at 10:56 | history | edited | rhermans | CC BY-SA 3.0 |
added 73 characters in body
|
Feb 10, 2016 at 10:56 | comment | added | rhermans | @coussin please edit your question to add any extra information, such as data examples. It would be a good idea to offer a permanent paste on pastebin.com so we can see the format of the line and fields separators and headers if present at all. See this question on meta for ways for sharing data. Also please try to share code in formatted form. | |
Feb 10, 2016 at 10:44 | comment | added | Jason B. | @coussin, is the file like that, all on one line? Or is each complex number on a separate line, with parantheses? | |
Feb 10, 2016 at 10:18 | comment | added | coussin | Unfortunately, I am not the one generating the data file. Here are the first few elements : (1e-07+0j) (-0.998722569699-0.000124681423362j) (-0.00620217196207+0.0501472284707j) (-53.0662993987-543.342932199j) (1837.15+0j) (3.7656639408e-16+0j) | |
Feb 10, 2016 at 10:06 | comment | added | Szabolcs | If you are exporting the data from Python yourself, the best solution will be to split the complex numbers into real and imaginary parts and export them as distinct units. Parsing special forms in Mathematica is possible but not fast. If your data file is a simple table with only real numbers, there are very fast builtin functions to read it. | |
Feb 10, 2016 at 10:04 | comment | added | Jason B. | Paste a little snippet of the data file so we can see what the format is exactly. | |
Feb 10, 2016 at 10:03 | history | asked | coussin | CC BY-SA 3.0 |