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

Aliases in Chemical.copy #55

Closed
yalinli2 opened this issue Mar 17, 2022 · 2 comments
Closed

Aliases in Chemical.copy #55

yalinli2 opened this issue Mar 17, 2022 · 2 comments

Comments

@yalinli2
Copy link
Member

The copy method basically copy everything from one chemical to another, but this could cause problem for aliases setting as it bypasses the duplicate alias check.

For example, in the corn biorefinery, Starch (and also Fiber, SolubleProtein, InsolubleProtein) is copied from Cellulose, and they end up having the same aliases
https://github.com/BioSTEAMDevelopmentGroup/Bioindustrial-Park/blob/1d79328e2cb60ef15392dce2ac0134c374980460/BioSTEAM%202.x.x/biorefineries/corn/_chemicals.py#L22

>>> from biorefineries import corn as cn
>>> chems = cn.create_chemicals()
>>> chems.Cellulose.aliases
{'C6H10O5'}
>>> chems.Starch.aliases
{'C6H10O5'}

I'm OK with just fixing it in the biorefinery setting like
https://github.com/BioSTEAMDevelopmentGroup/Bioindustrial-Park/blob/86fa9bc440d0e7d55a637bdcfb9a91c909928c07/BioSTEAM%202.x.x/biorefineries/corn/_chemicals.py#L22

but wondering if it's better to do something on the method, thanks!

@yoelcortes
Copy link
Member

Hi Yalin,

This reply comes a little late, sorry about that! I think your concern makes sense. I removed aliases for copied chemicals. Now we have the following:

>>> from biorefineries import corn as cn
>>> chems = cn.create_chemicals()
>>> chems.Cellulose.aliases
{'C6H10O5'}
>>> chems.Starch.aliases
set()

Hope this helps,
Thanks!

@yalinli2
Copy link
Member Author

Wonderful, thanks @yoelcortes!

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

No branches or pull requests

2 participants