Skip to content

Arithmetic operations for Parameters and DescriptorNumbers #31

@damskii9992

Description

@damskii9992

Discussed in #27

Originally posted by damskii9992 July 15, 2024

General

Adding capability to do arithmetic operations on Parameters and DescriptorNumbers allow users to use fitted parameters to do quick and easy calculations with uncertainties and units to calculate items of interest, as well as quickly and easily create new parameters/descriptors from previous ones.

Current implementation

This is not currently implemented

Proposed implementation

Add the following methods to Parameter and DescriptorNumber:

__add__
__sub__
__mul__
__truediv__
__pow__
__neg__
__abs__

The output should be a Parameter with automatically calculated min/max if any of the elements of the arithmetic operation is a Parameter, otherwise the output should be a DescriptorNumber. In either case the unit and variance is also automatically propagated.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions