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

ENH: Add a function to filter inactive phases #141

Merged
merged 4 commits into from Nov 25, 2017
Merged

Conversation

bocklund
Copy link
Collaborator

@bocklund bocklund commented Nov 9, 2017

Closes #100 and closes #129

I use this all the time. @richardotis what do you think about including this in pycalphad proper?

Any thoughts on doing this automatically in equilibrium calculations? That way users could always pass in phases=dbf.phases.keys() without getting any error messages. In large databases, your only other choice is to tediously select phases in the system you want to calculate.

@bocklund
Copy link
Collaborator Author

bocklund commented Nov 12, 2017

Having users do this (by updating examples) and applying this closes #129 and #100

@richardotis
Copy link
Collaborator

This sounds like a good idea. Adding this to equilibrium (but not calculate) would be useful.

@richardotis
Copy link
Collaborator

If the result of filter_phases is empty, we should give the user a nice error message like "No phase with the specified components could be found in the database."
The user probably made a typo somewhere, so the error message should give a hint to check the component list and/or the database.

Semi-related comment: I would be okay with creating a base EquilibriumError exception class and then basing all "logical" errors (as opposed to errors from bugs) returning that exception or a subclass of it.

if len(possible_active_phases) == 0:
raise ConditionError('There are no phases in the Database that can be active with components {0}'.format(comps))
if len(active_phases) == 0:
raise ConditionError('None of the passed phases ({0}) are active. List of active phases: {1}.'.format(phases, possible_active_phases))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should be "List of possible phases"

from pycalphad.tests.datasets import ALNIPT_TDB

ALNIPT_DBF = Database(ALNIPT_TDB)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Needs an integration test to show the equilibrium logic is working. Ideally for both ConditionErrors

@bocklund bocklund merged commit 3a432ec into develop Nov 25, 2017
@bocklund bocklund deleted the filter-phases branch November 25, 2017 22:24
richardotis pushed a commit that referenced this pull request Nov 26, 2017
* ENH: Add a function to filter inactive phases

* ENH: Add active phase filtering to equilibrium with ConditionErrors

* MAINT: Change name of filtered phases to list_of_possible_phases

* TST: Integration tests for equilibrium condition errors
bocklund added a commit to bocklund/pycalphad that referenced this pull request Aug 17, 2021
…#141)

GitHub sanitizes the size of figures in their RST renderer (see github/markup#295), so we need to remove the logo (the workaround suggested in that issue of using the RST `raw` directive doesn't work because PyPI rejects the `raw` directive).
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.

more descriptive error messages, if possible Filter inactive phases in calculate and equilibrium
2 participants