rivetTDA / rivet-python

Python API for RIVET
BSD 3-Clause "New" or "Revised" License
6 stars 8 forks source link

visualize Hilbert functions from precomputed RIVET data? #1

Open delooper opened 6 years ago

delooper commented 6 years ago

Apologies for this simple query. I'm wondering if rivet-python has a way to take pre-computed RIVET data (i.e. the output file of rivet_console) and plot the Hilbert functions?

I see in the API demo examples where the rivet.betti_file command is used on metric space data (standard rivet_console input). This outputs a rivet.MultiBetti object, and this has a graded_rank call for the Hilbert function, that can be plotted.

What I don't see is how to recover the MultiBetti object from precomputed RIVET data.

I suppose I could recompute like in the API demo, but several of my computations took 12+ hours, and I'd like to save some time.

If I'm reading the code for betti_file correctly, it looks like I need to take the screen output from rivet_console (i.e. not the file output) and parse that with _parse_betti. Here is the primary part of betti_file:

_parse_betti(subprocess.check_output(shlex.split(cmd)).split(b'\n'))

I don't know the check_output command in subprocess well, but from what I can see it is essentially returning the screen output from the call to rivet_console.

Is there not an easy way to recover this information from the text file output of rivet_console?

delooper commented 6 years ago

Now I'm confused. I've tried running rivet_console in the manner of the betti_file procedure, but rivet_console outputs nothing to screen.

Oh, I missed one detail. rivet_console is called with the argument "--betti" in the betti_file call. And you can't give it an output file when you use the "--betti" option.

xoltar commented 6 years ago

There's no reason I know of in principle why this couldn't work, but if I recall correctly, rivet_console itself doesn't allow --betti to be called on a precomputed file. I feel like it probably should accept precomputed files as well, but I don't think it does at the moment. Perhaps the reason was that computing the Betti numbers is much faster than computing the augmented arrangement, so there's not as much advantage to precomputing.

On Tue, Oct 9, 2018 at 11:49 AM Ryan Budney notifications@github.com wrote:

Apologies for this simple query. I'm wondering if rivet-python has a way to take pre-computed RIVET data (i.e. the output file of rivet_console) and plot the Hilbert functions?

I see in the API demo examples where the rivet.betti_file command is used on metric space data (standard rivet_console input). This outputs a rivet.MultiBetti object, and this has a graded_rank call for the Hilbert function, that can be plotted.

What I don't see is how to recover the MultiBetti object from precomputed RIVET data.

I suppose I could recompute like in the API demo, but several of my computations took 12+ hours, and I'd like to save some time.

If I'm reading the code for betti_file correctly, it looks like I need to take the screen output from rivet_console (i.e. not the file output) and parse that with _parse_betti. Here is the primary part of betti_file:

_parse_betti(subprocess.check_output(shlex.split(cmd)).split(b'\n'))

I don't know the check_output command in subprocess well, but from what I can see it is essentially returning the screen output from the call to rivet_console.

Is there not an easy way to recover this information from the text file output of rivet_console?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rivetTDA/rivet-python/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/ABK13EMBnFjmTW5KgqZP6O3M5naTW72Gks5ujO--gaJpZM4XT54U .

delooper commented 6 years ago

Thanks. Okay, this is helpful. I'm noticing the relative speed of calling rivet_console with the --betti option now.