Examples › object database › Object library · material lab (proposal 5)

Object library · material lab (proposal 5)

Material-first: materials with their density and measured reflectance spectra, and every object placed by what it is made of on an Ashby chart (mass against bounding-box volume). 3D shows only in an object's peek.

object databasetablechart3 views of one materials.json

The .base file and its data

Every tab above is one entry of this file; the views read these rows. ⋯ in the toolbar copies the current view as YAML.

# Proposal 5 · Material-first ("the material lab"). What a hyperspectral sorter sees first: materials with their
# density and their measured reflectance spectra (USGS splib07a, HZDR RODARE 2448, 4TU; spectra.base beside this file),
# and the objects placed by what they are made of, mass against bounding-box volume (an Ashby chart: a material's
# objects sit along its density line). 3D shows only in an object's peek; the cards here are materials, not objects.
# New views. Check it: node bin/data-ui.mjs check gallery/examples/object-db-materials/views.base
data: ../object-db-shelf/materials.json
facets:
  - { property: family, label: Family }
  - { property: density_g_cm3, as: range, unit: g/cm³, label: Density }
properties:
  name: { displayName: Material }
  family: { displayName: Family }
  resin_code: { displayName: Resin code }
  density_g_cm3: { displayName: Density }
  spectra: { displayName: Spectra }
  spectral_range_nm: { displayName: Range (nm) }
  spectral_source: { displayName: Spectral source }
  instances: { displayName: Objects in library }
views:
  - type: table
    name: Materials
    groupBy: { property: family, direction: ASC }
    order: [name, resin_code, density_g_cm3, instances, spectra, spectral_range_nm, spectral_source]
    display: { instances: bar }
    sort:
      - { property: density_g_cm3, direction: DESC }
  - type: chart
    name: Density by family
    chart:
      mark: { type: point, filled: true, size: 80 }
      encoding:
        y: { field: name, sort: "-x", title: null }
        x: { field: density_g_cm3, title: "Density (g/cm³)" }
        color: { field: family }
  - type: chart
    name: Objects per material
    chart:
      mark: { type: bar }
      encoding:
        y: { field: name, sort: "-x", title: null }
        x: { field: instances, title: "Objects in the library" }
        color: { field: family }
// ../object-db-shelf/materials.json: 26 rows, 14 KB; the first 3
{
 "id": "bam-materials",
 "title": "Materials",
 "titleProperty": "name",
 "source": "BAM's object library materials @ 3a3be7a; spectra only where a licence is stated",
 "properties": {
  "id": {
   "type": "text",
   "hidden": true
  },
  "kind": {
   "type": "text",
   "hidden": true
  },
  "family": {
   "type": "text",
   "display": "badge",
   "facet": "values"
  },
  "density_g_cm3": {
   "type": "number",
   "unitText": "g/cm³",
   "decimals": 2
  },
  "spectra": {
   "type": "number",
   "decimals": 0
  },
  "instances": {
   "type": "number",
   "decimals": 0
  },
  "name": {
   "type": "text"
  },
  "resin_code": {
   "type": "number"
  },
  "spectral_range_nm": {
   "type": "text"
  },
  "spectral_source": {
   "type": "text"
  },
  "spectral_license": {
   "type": "text"
  }
 },
 "rows": [
  {
   "id": "aluminium",
   "kind": "material",
   "name": "Aluminium",
   "family": "metal",
   "resin_code": null,
   "density_g_cm3": {
    "value": 2.7,
    "basis": "datasheet",
    "source": "typical value, https://en.wikipedia.org/wiki/Aluminium"
   },
   "spectra": 1,
   "spectral_range_nm": "350-2500",
   "spectral_source": "USGS Spectral Library Version 7 (splib07a, measured spectra)",
   "spectral_license": "Public domain (USGS-authored data, U.S. Public Domain per https://www.usgs.gov/information-policies-and-instructions/copyrights-and-credits); cite Kokaly et al. 2017, USGS Spectral Library Version 7 Data, doi:10.5066/F7RR1WDJ",
   "instances": 21
  },
  {
   "id": "cardboard",
   "kind": "material",
   "name": "Corrugated cardboard",
   "family": "paper",
   "resin_code": null,
   "density_g_cm3": {
    "value": 0.2,
    "basis": "datasheet",
    "source": "typical value, https://en.wikipedia.org/wiki/Corrugated_fiberboard"
   },
   "spectra": 1,
   "spectral_range_nm": "350-2500",
   "spectral_source": "USGS Spectral Library Version 7 (splib07a, measured spectra)",
   "spectral_license": "Public domain (USGS-authored data, U.S. Public Domain per https://www.usgs.gov/information-policies-and-instructions/copyrights-and-credits); cite Kokaly et al. 2017, USGS Spectral Library Version 7 Data, doi:10.5066/F7RR1WDJ",
   "instances": 12
  },
  {
   "id": "ceramic",
   "kind": "material",
   "name": "Ceramic",
   "family": "ceramic",
   "resin_code": null,
   "density_g_cm3": {
    "value": 2.4,
    "basis": "datasheet",
    "source": "typical value, https://en.wikipedia.org/wiki/Ceramic"
   },
   "spectra": 1,
   "spectral_range_nm": "350-2500",
   "spectral_source": "USGS Spectral Library Version 7 (splib07a, measured spectra)",
   "spectral_license": "Public domain (USGS-authored data, U.S. Public Domain per https://www.usgs.gov/information-policies-and-instructions/copyrights-and-credits); cite Kokaly et al. 2017, USGS Spectral Library Version 7 Data, doi:10.5066/F7RR1WDJ",
   "instances": 56
  }
 ]
}
README.md
# Object library · material lab (proposal 5)

Material-first: materials with their density and measured reflectance spectra, and every object placed by what it
is made of on an Ashby chart (mass against bounding-box volume). 3D shows only in an object's peek.

- **App:** object database
- **Replaces:** `~/bam-waste-objects/views/Materials.base` and the spectra CSVs nobody can see without a script
- **Shows:** table grouped by family, chart (Vega-Lite dot plot, bars, 31 spectral lines, Ashby scatter with hull envelopes and a constant-density line), peek with a 3D orbit viewer
- **Data:** `../object-db-shelf/materials.json` (26 materials), `spectra.json` (31 spectra in 20 nm bins), `objects.json`; built by `../object-db-shelf/source/build.py`
- **Prior art:** USGS Spectral Library viewer (SpecLab), Ansys Granta / MatWeb material selectors, Ashby charts (Ashby, *Materials Selection in Mechanical Design*), TOMRA / Specim NIR sorting demos

The original UI it replaces

~/bam-waste-objects/views/Materials.base and the spectra CSVs nobody can see without a script

What it shows

table grouped by family, chart (Vega-Lite dot plot, bars, 31 spectral lines, Ashby scatter with hull envelopes and a constant-density line), peek with a 3D orbit viewer

Data

../object-db-shelf/materials.json (26 materials), spectra.json (31 spectra in 20 nm bins), objects.json; built by ../object-db-shelf/source/build.py