Closed ayush9pandey closed 2 months ago
Thanks for your comments. I have now addressed all of these points here: https://github.com/finsberg/gotranx/pull/117
The only exception is point 3. 294 refers to the number of characters written to the file which is the return value from Path.write_text
. I see two possible ways to fix this
num_chars = Path("lorentz.ode").write_text(ode_str)
which now introduces an unused variable. Alternatively, I could assign it to _
, i.e
_ = Path("lorentz.ode").write_text(ode_str)
but I also think this looks a bit weired.
Do you have any opinions here?
I agree -- this is not a major issue either way. My approach in the past has been to create a package specific write_model
function, which in your case could be write_ode(ode_string, filename)
. That way, you can wrap around the Path library's function and get the desired behavior.
I agree -- this is not a major issue either way. My approach in the past has been to create a package specific
write_model
function, which in your case could bewrite_ode(ode_string, filename)
. That way, you can wrap around the Path library's function and get the desired behavior.
OK, I will just keep it as is. There is already a method for saving an ODE to a file (see https://finsberg.github.io/gotranx/docs/api.html#gotranx.ode.ODE.save). In this case I am simply just writing a string to a file and I see no good reason to why I should make a new function to do exactly the same thing (except not returning the number characters written).
OK. So, in principle, I could create an ODE object from the string and then use save
to save it to a file instead of using the Path library directly?
Yes, there is actually also a function for that, so I updated the example to use that in stead (see https://github.com/finsberg/gotranx/pull/119). Thanks
When running through the Using the Python API and the Your first ODE file page, I am running into a few issues:
ORdmm_Land.ode
file. I was able to find it eventually under examples/split-ode/, so it might be better to mention the location on the documentation page.