Record lamp technology type (led / halogen / cfl / ...)
Station prompts for it (default led), metrics.json carries it as 'type', and the scaffolded device page description and Type spec follow it.
This commit is contained in:
@@ -178,6 +178,9 @@ def write_bundle(reading, out_dir, meta, n_readings, supply=None):
|
|||||||
metrics = {"name": meta["name"]}
|
metrics = {"name": meta["name"]}
|
||||||
if meta.get("ean"):
|
if meta.get("ean"):
|
||||||
metrics["ean"] = meta["ean"]
|
metrics["ean"] = meta["ean"]
|
||||||
|
if meta.get("type"):
|
||||||
|
# Lamp technology: led, halogen, cfl, incandescent, ...
|
||||||
|
metrics["type"] = meta["type"]
|
||||||
if meta.get("variant"):
|
if meta.get("variant"):
|
||||||
metrics["variant"] = meta["variant"]
|
metrics["variant"] = meta["variant"]
|
||||||
if meta.get("rated"):
|
if meta.get("rated"):
|
||||||
|
|||||||
+7
-2
@@ -194,6 +194,8 @@ def scaffold_device_page(web_repo, lamp_id, meta):
|
|||||||
specs = [("ID", lamp_id)]
|
specs = [("ID", lamp_id)]
|
||||||
if meta["ean"]:
|
if meta["ean"]:
|
||||||
specs.append(("EAN", meta["ean"]))
|
specs.append(("EAN", meta["ean"]))
|
||||||
|
if meta.get("type"):
|
||||||
|
specs.append(("Type", meta["type"].upper() if meta["type"] in ("led", "cfl") else meta["type"].capitalize()))
|
||||||
if meta["variant"]:
|
if meta["variant"]:
|
||||||
specs.append(("Variant", meta["variant"]))
|
specs.append(("Variant", meta["variant"]))
|
||||||
if "Power_W" in rated:
|
if "Power_W" in rated:
|
||||||
@@ -210,11 +212,12 @@ def scaffold_device_page(web_repo, lamp_id, meta):
|
|||||||
if "lifetime_h" in rated:
|
if "lifetime_h" in rated:
|
||||||
specs.append(("Rated lifetime", f"{rated['lifetime_h']:,} h".replace(",", " ")))
|
specs.append(("Rated lifetime", f"{rated['lifetime_h']:,} h".replace(",", " ")))
|
||||||
|
|
||||||
|
type_word = {"led": "LED", "cfl": "CFL"}.get(meta.get("type", "led"), meta.get("type", "LED"))
|
||||||
lines = ["---", f'title: "{title}"']
|
lines = ["---", f'title: "{title}"']
|
||||||
if meta["manufacturer"]:
|
if meta["manufacturer"]:
|
||||||
lines.append(f'manufacturer: "{meta["manufacturer"]}"')
|
lines.append(f'manufacturer: "{meta["manufacturer"]}"')
|
||||||
lines += [
|
lines += [
|
||||||
'description: "Household LED lamp, measured in our integrating sphere."',
|
f'description: "Household {type_word} lamp, measured in our integrating sphere."',
|
||||||
f'csv: "/data/comparisons/lamps/{lamp_id}/spd.csv"',
|
f'csv: "/data/comparisons/lamps/{lamp_id}/spd.csv"',
|
||||||
"specs:",
|
"specs:",
|
||||||
*[f' - {{ label: "{k}", value: "{v}" }}' for k, v in specs],
|
*[f' - {{ label: "{k}", value: "{v}" }}' for k, v in specs],
|
||||||
@@ -265,6 +268,8 @@ def measure_one(ean, args, data_repo):
|
|||||||
|
|
||||||
manufacturer = prompt("Manufacturer", manufacturer)
|
manufacturer = prompt("Manufacturer", manufacturer)
|
||||||
model = prompt("Model", model)
|
model = prompt("Model", model)
|
||||||
|
lamp_type = prompt("Type (led / halogen / cfl / incandescent / ...)",
|
||||||
|
previous.get("type", "led")).lower().strip()
|
||||||
variant = prompt("Variant (e.g. daylight / warm white, Enter if none)",
|
variant = prompt("Variant (e.g. daylight / warm white, Enter if none)",
|
||||||
previous.get("variant", "")).lower()
|
previous.get("variant", "")).lower()
|
||||||
notes = prompt("Notes", previous.get("notes", "retailer-internal barcode, brand unknown"
|
notes = prompt("Notes", previous.get("notes", "retailer-internal barcode, brand unknown"
|
||||||
@@ -287,7 +292,7 @@ def measure_one(ean, args, data_repo):
|
|||||||
"enable": True}
|
"enable": True}
|
||||||
readings, supply = readings_from_device(port, args.readings, False, psu)
|
readings, supply = readings_from_device(port, args.readings, False, psu)
|
||||||
reading = average_readings(readings)
|
reading = average_readings(readings)
|
||||||
meta = {"name": lamp_id, "ean": ean or "", "variant": variant,
|
meta = {"name": lamp_id, "ean": ean or "", "type": lamp_type, "variant": variant,
|
||||||
"manufacturer": manufacturer, "model": model, "notes": notes,
|
"manufacturer": manufacturer, "model": model, "notes": notes,
|
||||||
"rated": rated}
|
"rated": rated}
|
||||||
out_dir = data_repo / "lamps" / lamp_id
|
out_dir = data_repo / "lamps" / lamp_id
|
||||||
|
|||||||
Reference in New Issue
Block a user