Sign inSign up

insentek/fangwu-spectrum-resolver

By insentek

•Updated 7 months ago

Fangwu spectrum resolver API container

Image
0

107

insentek/fangwu-spectrum-resolver repository overview

⁠Fangwu Spectrum Resolver

A containerized HTTP API for TI DLP NIR spectroscopy workflows.

This image exposes two core endpoints:

  1. /reference-calibration to parse a reference calibration scan and return the reference intensity array
  2. /absorbance-spectrum to compute an absorbance spectrum from one or more sample scan packets

⁠Supported Platform

  • linux/amd64

⁠Pull the Image

docker pull insentek/fangwu-spectrum-resolver:1.0

Replace 1.0 with the release version you want to run.

⁠Run the Container

docker run --rm -p 3000:3000 \
  -e API_KEY=replace-with-your-api-key \
  insentek/fangwu-spectrum-resolver:1.0

If API_KEY is not set, the service still starts and business endpoints accept unauthenticated requests. GET /health is always public.

⁠Environment Variables

VariableRequiredDefaultDescription
PORTNo3000HTTP service port inside the container
API_KEYNounsetOptional API key expected in the x-api-key request header

⁠Health Check

curl http://127.0.0.1:3000/health

Response:

{
  "ok": true
}

⁠Authentication

When API_KEY is configured, send:

x-api-key: <your-api-key>

⁠API Example: Reference Calibration

curl -X POST http://127.0.0.1:3000/reference-calibration \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: your-api-key' \
  -d '{
    "referenceScanHex": "74706c00750e00005328..."
  }'

Response:

{
  "ok": true,
  "data": {
    "referencePga": 64,
    "length": 228,
    "wavelength": [901.7373613582381, 905.7653917562943],
    "referenceIntensity": [5833, 6798]
  }
}

⁠API Example: Absorbance Spectrum

curl -X POST http://127.0.0.1:3000/absorbance-spectrum \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: your-api-key' \
  -d '{
    "sampleScanHex": [
      "74706c00750e00005328...",
      "74706c00750e00005328..."
    ],
    "referenceIntensity": [5833, 6798, 6094],
    "referencePga": 64
  }'

Response:

{
  "ok": true,
  "data": {
    "length": 228,
    "wavelength": [901.7373613582381, 905.7653917562943],
    "absorbance": [-0.035718, 0.00806],
    "spectrum": {
      "901.7373613582381": [-0.036101, -0.035335],
      "905.7653917562943": [0.007412, 0.008708]
    }
  }
}

When multiple sampleScanHex packets are submitted, data.absorbance is the mean absorbance at each wavelength. data.spectrum preserves the raw multi-packet absorbance values keyed by wavelength.

Tag summary

Content type

Image

Digest

sha256:ab95dd7ae…

Size

90 MB

Last updated

7 months ago

docker pull insentek/fangwu-spectrum-resolver:1.0