make a serializable version of FunctionalProfile and FunctionalMagnetism #219
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These versions of FunctionalProfile and FunctionalMagnetism differ from the original:
profile
function, they will read the source withinspect.getsource
.profile_source
string, the string will be executed in a context withscipy
andnp
defined, and the function that results will be pulled out. (the function is expected to be the only defined name in the locals context when the exec is complete, so the string should contain only a function definition and nothing else)np
andscipy
namespaces (these are embedded in the execution context), e.g.FunctionalProfile.profile_params
slot
attribute:rho_start
irho_start
rho_end
irho_end
start
andend
attributes are now properties, which create an SLD object, e.g.start == SLD(rho=rho_start, irho=irho_start)
For
FunctionalMagnetism
, a further difference is that the total thickness is stored as an expression in the class. You can set it with aset_anchor
function as before, but now that function will construct a thickness expression, or you can pass in an existing Parameter or Expression, e.g.layer[3].thickness + layer[4].thickness