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

PhysicalConstants cannot be instantiated inside of a Dict #8

Closed
neil-glikin opened this issue Apr 23, 2021 · 2 comments
Closed

PhysicalConstants cannot be instantiated inside of a Dict #8

neil-glikin opened this issue Apr 23, 2021 · 2 comments

Comments

@neil-glikin
Copy link
Collaborator

Example:
Dict("D5/2" => PhysicalConstant(4.1115503183857306e14, "Hz"))
Returns the error "TypeError: in new, expected PhysicalConstant, got Float64". This seems to be caused by the Base.convert for PhysicalConstants added in constants.jl. I suspect there's something not quite right with this usage of convert, as defining this method alone breaks all instantiation of PhysicalConstants (even outside of Dicts); the Base.Fix2 method seems to patch this up, but does not fix the problem when the instantiation takes place inside a Dict. I do see that some sort of Base.convert method is necessary, as it allows mathematical operations with regular numbers, but not sure how it would need to be fixed.

It would be nice to be able to do this so that in species files e.g. /src/species/ca40.jl we can directly define energies and transition matrix elements as PhysicalConstants within dictionaries.

@marwahaha marwahaha added this to To do in getting to 1.0 Oct 13, 2021
@marwahaha
Copy link
Member

@neil-glikin - is this still an issue?

@neil-glikin
Copy link
Collaborator Author

neil-glikin commented Apr 6, 2022

@marwahaha Yes, I created a new more general issue #53

getting to 1.0 automation moved this from To do to Done Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

No branches or pull requests

2 participants