TiesdeKok / ipystata

Enables the use of Stata together with Python via Jupyter (IPython) notebooks.
192 stars 68 forks source link

Clean up log parsing #23

Closed pacbard closed 7 years ago

pacbard commented 7 years ago

Hi! I reworked the log parser.

Now, it removes the line at the beginning of the file, all the lines starting with . and >, and it cleans up the junk at the beginning of the log. It leaves in the lines that are part of the regression tables and the empty lines between commands.

I tested with some of my notebooks and it seems to improve the output. I would test this a little more, though.

I think that this also fixes #22.

TiesdeKok commented 7 years ago

Thanks @pacbard, very helpful!

I ran it through some of my tests and I noticed that it currently does not parse loops and Mata code correctly, can you look into adding that functionality as well? See an example below:

image

pacbard commented 7 years ago

I will take a look.

In the for cycle, we just want the numbers 0 to 5 and in the mata output just the matrix, right?

TiesdeKok commented 7 years ago

Awesome! Yes, exactly.

pacbard commented 7 years ago

Ok. Now for cycles and mata output should work.

Let me know if you find any other issues with it.

Edit: The only problem that I see right now is the fact that each cell has two empty lines at the bottom because those are present in the original stata log file. Is this a problem?

TiesdeKok commented 7 years ago

I will try testing your new version later today. My preference would be to replace those two empty lines with just one empty line to make it a bit more concise.

pacbard commented 7 years ago

It now removes the multiple lines and it replaces with just one line. The output looks definitely better.

TiesdeKok commented 7 years ago

Hi @pacbard, sorry for the delay. I have finally gotten around to running your newest version and I like it! I have added two extra lines to get rid of some excess new lines that I encountered but overall it is way cleaner now. Thank you very much.

As a token of appreciation I have added you as a contributor at the bottom of the main page.