Published
Edited
Sep 20, 2021
Insert cell
Insert cell
metrology.get(4001).get(null)[0]
Insert cell
Plot.plot({
width:width,
height:width,
x:{ticks:false, domain:[-420,420]},
y:{ticks:false, domain:[-420,420]},
color:{
//type:"categorical",
domain:["old","new","bus","enabled","bad"],
range:["lightgray","green","orange","blue","red"],
},
marks:[
Plot.dot(positioners, {
x:loc=>metrology.get(loc).get(null)[0].X_FP,
y:loc=>metrology.get(loc).get(null)[0].Y_FP,
r:loc=>CALIB.get(loc).fiber_intact=="True" ? 10:3,
fill:loc=>diffs.DEVICE_ID.includes(loc) ? "new":"old",
title:loc=>after.get(loc).DEVICE_ID,
}),
Plot.dot(positioners.filter(loc=>{
const pos=after.get(loc);
if(pos.PETAL_LOC!=6) return false;
if((pos.BUS_ID!=10) && (pos.BUS_ID!=17)) return false;
//if(['M06054','M06090','M06056','M06235','M06847'].includes(pos.DEVICE_ID)) return false;
return true;
}), {
x:loc=>metrology.get(loc).get(null)[0].X_FP,
y:loc=>metrology.get(loc).get(null)[0].Y_FP,
r:loc=>CALIB.get(loc).fiber_intact=="True" ? 10:3,
title:loc=>after.get(loc).DEVICE_ID,
fill: loc=>['M06054','M06090','M06056','M06235','M06847']
.includes(after.get(loc).DEVICE_ID) ? "bad":"bus",
}),
Plot.dot(diffs.ENABLED, {
x:loc=>metrology.get(loc)?.get(1)[0].X_FP,
y:loc=>metrology.get(loc)?.get(1)[0].Y_FP,
fill: loc=>"enabled",
}),
/*
Plot.text(diffs.DEVICE_ID, {
x:loc=>metrology.get(loc).get(null)[0].X_FP,
y:loc=>metrology.get(loc).get(null)[0].Y_FP,
dx:25,
text:loc=>after.get(loc).DEVICE_ID,
}),
*/
],
})
Insert cell
diffs.ENABLED.map(loc=>metrology.get(loc).get(1)[0])
Insert cell
before.get(8496)
Insert cell
diffs = {
// Loop over the attributes for each location.
const attrs=Object.keys(before.get(locations[0]));
const diffs={};
for(const attr of attrs) {
// Find any entries where this attribute's value has changed.
const values=locations.filter(loc=>before.get(loc)[attr]!=after.get(loc)[attr]);
diffs[attr]=values;
}
return diffs;
}
Insert cell
fiducials=locations.filter(loc=>after.get(loc).DEVICE_TYPE=="FIF")
Insert cell
positioners=locations.filter(loc=>after.get(loc).DEVICE_TYPE=="POS")
Insert cell
locations={
// Check that the set of locations has not changed.
const locsBefore=new Set([...before.keys()].sort());
const locsAfter=new Set([...before.keys()].sort());
if(locsBefore.size != locsAfter.size) throw new Error("Locations have changed.");
for(const loc of locsBefore) if(!locsAfter.has(loc)) throw new Error("Locations have changed.");
return [...locsBefore];
}
Insert cell
after.get(8075)
Insert cell
after=await FileAttachment("desi_positioner_indexes_20210910 (1).csv").text()
.then(f=>d3.csvParse(f, d3.autoType))
.then(f=>d3.index(f, d=>1000*d.PETAL_LOC+d.DEVICE_LOC))
Insert cell
before=await FileAttachment("desi_positioner_indexes_20210331.csv").text()
.then(f=>d3.csvParse(f, d3.autoType))
.then(f=>d3.index(f, d=>1000*d.PETAL_LOC+d.DEVICE_LOC))
Insert cell
Insert cell
metrology.get(1001).get(null)[0]
Insert cell
metrology=await FileAttachment("umt@2.csv").text()
.then(f=>d3.csvParse(f, d3.autoType))
.then(f=>f.filter(f=>f.PETAL_LOC<10))
.then(f=>{
f.forEach(d=>{
const [C,S]=ROT[d.PETAL_LOC];
d.X_FP=d.X_PTL*C - d.Y_PTL*S;
d.Y_FP=d.X_PTL*S + d.Y_PTL*C;
});
return f;
})
.then(f=>d3.group(f, d=>1000*d.PETAL_LOC+d.DEVICE_LOC, d=>d.PINHOLE_ID))
Insert cell
after.get(533)
Insert cell
UMT.filter(d=>d.DEVICE_LOC==533)
Insert cell
UMT=await FileAttachment("umt@2.csv").text()
.then(f=>d3.csvParse(f, d3.autoType))
Insert cell
ROT = {
const {PI,cos,sin}=Math;
return d3.range(10).map(petal_loc=>{
const angle=(petal_loc-3)*PI/5;
return [cos(angle),sin(angle)];
});
}
Insert cell
CALIB=await FileAttachment("calib-20210621-00095513.csv").text()
.then(f=>d3.csvParse(f, d3.autoType))
.then(f=>d3.index(f, d=>1000*d.petal_loc+d.device_loc))
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more