Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diffusion Example Improvements (and a bit of clean-up) #1914

Merged

Conversation

thorstenhater
Copy link
Contributor

Post-Merge clean-up for the diffusion PR

  • remove redundant WRITEs in mechanisms
  • diffusion.py is now closer in functionality to diffusion.cpp
  • diffusion.py now prints a table of results

ax.plot(xs, ys, label=lbl)
ax.plot(d[:, 0], d[:, ix], label=lbl)
# Table
print("Sodium concentration (NaD/mM)")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use pandas/sth else to pretty print the table?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory yes, but the code is usually neither more comprehensible nor shorter. You would be looking for
DataFrame::to_string(buf=None, columns=None, col_space=None, header=True, index=True, na_rep='NaN', formatters=None, float_format=None, sparsify=None, index_names=True, justify=None, max_rows=None, max_cols=None, show_dimensions=False, decimal='.', line_width=None, min_rows=None, max_colwidth=None, encoding=None) .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something else = pip install tabulate, but I am not going to add a dependency for that

@brenthuisman brenthuisman merged commit 0c3b833 into arbor-sim:master Jun 23, 2022
@thorstenhater thorstenhater deleted the diffusion/better-py-example branch August 1, 2022 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants