Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 22 20:10

    bocklund on cs_dat_support_linear

    WIP: io.cs_dat: ChemSage DAT fi… FIX: grammar: floating-point nu… ENH/WIP: cs_dat: Stoichiometric… and 120 more (compare)

  • Jan 22 20:00

    bocklund on cs_dat_support_linear

    WIP: io.cs_dat: ChemSage DAT fi… FIX: grammar: floating-point nu… ENH/WIP: cs_dat: Stoichiometric… and 120 more (compare)

  • Jan 18 16:59

    github-actions[bot] on website

    DOC: Deploy latest docs to webs… (compare)

  • Jan 18 16:54

    bocklund on triangular-fixes

    (compare)

  • Jan 18 16:54

    bocklund on develop

    FIX: Improve Triangular axes pr… (compare)

  • Jan 18 16:54
    bocklund closed #295
  • Jan 08 20:24
    bocklund edited #268
  • Jan 08 16:57

    github-actions[bot] on website

    DOC: Deploy latest docs to webs… (compare)

  • Jan 08 16:52

    bocklund on ci-py39

    (compare)

  • Jan 08 16:52

    bocklund on develop

    MAINT/CI: Support Python 3.9 (#… (compare)

  • Jan 08 16:52
    bocklund closed #298
  • Jan 08 13:51
    bocklund review_requested #298
  • Jan 07 19:15
    codecov[bot] commented #298
  • Jan 07 19:15
    codecov[bot] commented #298
  • Jan 07 19:14
    codecov[bot] commented #298
  • Jan 07 19:14
    codecov[bot] commented #298
  • Jan 07 19:13
    codecov[bot] commented #298
  • Jan 07 19:12
    codecov[bot] commented #298
  • Jan 07 19:11
    codecov[bot] commented #298
  • Jan 07 19:11
    codecov[bot] commented #298
Brandon Bocklund
@bocklund
@stsievert did you ask here originally or did something get messed up on my end? I was almost sure that I saw a message in this pycalphad channel
Scott Sievert
@stsievert
@bocklund I asked the question on dask/dask originally, then posted to SO, then saw your reply here. I joined this channel a couple minutes ago.
Brandon Bocklund
@bocklund
@stsievert Oops! I'm not sure what happened then. Sorry for pinging you and bringing you here!
Daniel Schwen
@dschwen
and the users just supply these new options to binplot using plot_kwargs ?
Scott Sievert
@stsievert
@bocklund no worries – thanks for the answer!
Brandon Bocklund
@bocklund
@dschwen correct
Daniel Schwen
@dschwen
Do you guys have CI?
Or do you expect me to actually test my code before i make a PR?! :-D
Brandon Bocklund
@bocklund
We recently swiched to GitHub Actions. They should run locally on push to your fork, but the checks won't show up in the PR the way we have it configured
Brandon Bocklund
@bocklund
We don't have PRs enabled to keep ourselves from running 2 suites (1 push, 1 pr) * 3 platforms * 3 Python versions of tests, but maybe it's worth enabling since we've had 2 external PRs in the last week :)
Daniel Schwen
@dschwen
Ok, I do not see any testing happening. I opened a PR here pycalphad/pycalphad#292
Brandon Bocklund
@bocklund
I'll see if I can quickly add an action that will run on PRs and get that merged into develop, then we can rebase #292 onto develop
Daniel Schwen
@dschwen
It is on develop already...
Brandon Bocklund
@bocklund
#293 should enable CI to run on PRs. Just verifying that the test pass and then I'll merge into develop
Daniel Schwen
@dschwen
ah, ok, then I'll have to rebase
looks good
Brandon Bocklund
@bocklund
@dschwen you should be able to rebase #292 onto develop now (now at commit 8ed33ba) and that should trigger the tests to run our GitHub Actions workflow. Thank you for your patience! We're still learning the ins-and-outs of GitHub Actions and refining our test and CI stack.
Daniel Schwen
@dschwen
Looks ok to me now.
Daniel Schwen
@dschwen
Any idea how to customize font (size) in ternplots? plt.rcParams.update({'font.size': 22}) only affects the legend, but neither tick labels, axis labels, or the plot title
ah well, looks like the sizes are all hardcoded...
by default the ternary plot tick labels are too small to be used in a publication. Looks like we need a bit of customizability. I wonder if a good approach could be to just scale relative to font.size...
that way not another slew of parameters needs to be added and propagated through function calls
Daniel Schwen
@dschwen
hm, axis label placement looks awkward with scaled fonts
Richard Otis
@richardotis
@dschwen Looks like there is some information here: https://matplotlib.org/3.1.1/tutorials/introductory/customizing.html
## note that font.size controls default text sizes.  To configure
## special text sizes tick labels, axes, labels, title, etc, see the rc
## settings for axes and ticks. Special text sizes can be defined
## relative to font.size, using the following values: xx-small, x-small,
## small, medium, large, x-large, xx-large, larger, or smaller
The lack of a good default stylesheet for our plots is definitely a gap.
Daniel Schwen
@dschwen

I patched locally and adedd

    base_font_size = plt.rcParams['font.size']
    ax.tick_params(axis='both', which='major', labelsize=1.4*base_font_size)

etc.

but that requires me to also patch

    ax.set_ylabel(_axis_label(y), position=(0.18,0.45), fontsize=2*base_font_size)

adding a hard coded position for the y axis label (the one on the slanted upper axis in the triangle). Otherwise labels collide, and labelpad does not do anything

Brandon Bocklund
@bocklund

I would suggest that you do something like this:

%matplotlib inline
from pycalphad import Database, eqplot, equilibrium, variables as v
import matplotlib.pyplot as plt

dbf = Database("Cr-Fe-Ni_Miettinen.tdb")
comps = ['CR', 'FE', 'NI', 'VA']
phases = sorted(dbf.phases.keys())
conditions = {v.N: 1, v.P: 101325, v.T: 1000, v.X('NI'): (0.0, 1.0, 0.1), v.X('CR'): (0.0, 1.0, 0.1)}

eq = equilibrium(dbf, comps, phases, conditions)

# plot the result
fig = plt.figure(dpi=200)
ax = fig.gca(projection='triangular')

eqplot(eq, x=v.X('CR'), y=v.X('NI'), ax=ax)

box = ax.get_position()
ax.set_position([box.x0, box.y0, box.width, box.height])
ax.tick_params(axis='both', which='major', labelsize=8, pad=10000)
ax.grid(True)
plot_title = '-'.join([component.title() for component in sorted(comps) if component != 'VA'])
ax.set_title(plot_title, fontsize=16)
ax.set_xlabel('X(CR)', fontsize=10, labelpad=8)
ax.set_ylabel('X(NI)', fontsize=10, labelpad=5)

You can pass in your own axes and set all the parameters after the fact.

image.png
I'm seeing an issue where the triangular projection seems to break the pad argument for ax.tick_params (it has no effect). Othat than that, you can set everything except the parameters for the lines outside of ternplot/eqplot.
Brandon Bocklund
@bocklund
I definitely agree that it would be nice to do better dpi/figuresize scaling. The triangular projection can be especially fiddly with the transforms
Daniel Schwen
@dschwen
Thanks Brandon, that's a great suggestion
you can probably supply a transform for the tick labels
Brandon Bocklund
@bocklund
Yeah, pycalphad.plot.triangular.TriangularAxes probably needs a fix.
git blame has me on the hook for all that code, but I have no recollection of writing it. It's several years old, so it's unclear whether it worked at some point and broke or whether it never worked.
Daniel Schwen
@dschwen
:-D
Richard Otis
@richardotis
It may have been part of a rework involving code I originally wrote, which would explain why you don't remember it
Daniel Schwen
@dschwen
btw. @bocklund is the TDB file you used in the Cr-Fe-Ni plot openly available?
Brandon Bocklund
@bocklund
It's from this paper by Miettinen: https://doi.org/10.1016/S0364-5916(99)00027-9. It will show up if you search the TDBDB for "Cr,Fe,Ni". This particular TDB file was constructed from the paper and is hosted by NIMS, which requires you to register (it's free).
Daniel Schwen
@dschwen
Yeah, I'm going through he account recovery process. Apparently I signed up a long time ago
thanks for sharing directly
Brandon Bocklund
@bocklund
As of this month they wiped the user database and asked people to re-register
Fernando Inaoka Okigami
@fernando109_gitlab
Hi everybody! I understand that the scripting in python is very powerful, but has anyone started an initiative to create a GUI for it? It can be 100% done in python, i'm experienced in pyqt and can help. This way i believe we can reach out to an even broader audience. What do you think?
Richard Otis
@richardotis
@fernando109_gitlab I did some prototyping using ipywidgets earlier this year, where the concept was something like a 'wizard' which would guide the user through a common calculation type and provide the corresponding Python code as output. You can see the idea here: https://github.com/pycalphad/binder/blob/builder_test/Builder.ipynb - it may or may not actually run on Binder as-is, but it should be possible to execute the notebook locally using Voila to see the output
Richard Otis
@richardotis
Also, for analyzing the results of equilibrium calculations and building charts/plots, I've had a little luck using dtale: https://github.com/man-group/dtale - you can import the xarray objects in directly. The automatic subgrouping isn't very advanced yet though, and there are some UI bugs. I don't recommend dtale for general pycalphad use at this time, but perhaps as a starting point for future extensions
You'll notice all of these are browser-based UIs. I've tended to gravitate toward those approaches because you can deploy them in / next to Jupyter. So it doesn't matter if it's local, or on Binder, or your own JupyterHub deployment, etc. With the new Jupyter Server core project ( https://github.com/jupyter-server/jupyter_server ) arbitrary web UIs can be integrated into Jupyter, and I'm bullish on that approach long-term
Richard Otis
@richardotis
I'm open to a pyqt approach, but I'd want to hear solutions to the multi-OS package distribution problem before I invested much of my own time into it. Python apps (especially ones with Cython extensions, like pycalphad) are so hard to package consistently, and you end up with something that is not close to the native desktop experience
Richard Otis
@richardotis
If you're interested in exploring (in my opinion) the future of Python-based data science GUIs, I'd take a look at Dash: https://github.com/plotly/dash - you can use it to build GUIs entirely from Python, but it also integrates really nicely with the JS framework React. It's what dtale was built on top of. If someone wanted to explore forking dtale's chart builder to build a 'pycalphad GUI', I would make time available for that person during my office hours (the limit of what I can promise outright, but potentially other opportunities too)