Skip to content

Warn when extrapolating get_permeability_data #27

Description

@driftregion

Is your feature request related to a problem? Please describe.

When calling get_permeability_data as shown below, it is possible to pass temperature and frequency values that are outside of the range of the source data, like temperature=-20, frequency=1e12 and get results back without triggering a warning.

import materialdatabase as mdb
db = mdb.MaterialDatabase()
db.get_permeability_data(
    temperature=25,
    frequency=1e5,
    material_name=mdb.Material._3F4,
    datatype=mdb.MeasurementDataType.ComplexPermeability,
    datasource=mdb.MaterialDataSource.ManufacturerDatasheet)

Describe the solution you'd like

  • raise a warning ( https://docs.python.org/3/library/warnings.html ) when temperature or frequency are out of range, e.g. "temperature=-20 is outside of range [25, 100]". Use case: quick visual feedback.
  • return a tuple of (values, info_dict) similar to the info_dict returned by scipy.curve_fit ( https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.curve_fit.html ). where info_dict contains:
    • a boolean value indicating whether or not the values were extrapolated, e.g. {"extrapolated": False}. Use case: annotation in subsequent analyses.
    • (nice to have) the maximum distance to the nearest neighbor along the temperature and frequency axes, e.g.: {"furthest_neighbor": (0, 15000)}, indicating that the furthest point away in the interpolation was 0C and 15000 Hz away from the requested point. Use case: proxy for uncertainty.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions