Public
Edited
Dec 3, 2022
Importers
2 stars
Insert cell
Insert cell
stars = Array.from(parse())
Insert cell
stars
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
buffer = FileAttachment("BSC5").arrayBuffer()
Insert cell
littleEndian = true
Insert cell
Insert cell
Insert cell
Insert cell
function* parse() {
const utf8decoder = new TextDecoder()
const [ star0, star1, starn, stnum, mprop, nmag, nbent ] = header()
const view = new DataView(buffer.slice(28))

let offset = 0
while (offset < -starn * nbent) {
const xno = view.getFloat32(offset, littleEndian); offset += 4
const sra0 = view.getFloat64(offset, littleEndian); offset += 8
const sdec0 = view.getFloat64(offset, littleEndian); offset += 8
const is = utf8decoder.decode(new Uint8Array([view.getUint8(offset, littleEndian), view.getUint8(offset+1, littleEndian)])); offset += 2
const mag = view.getInt16(offset, littleEndian) / 100; offset += 2
const xrpm = view.getFloat32(offset, littleEndian); offset += 4
const xdpm = view.getFloat32(offset, littleEndian); offset += 4

yield { xno, sra0, sdec0, is, mag, xrpm, xdpm }
}
}
Insert cell
Insert cell
catalog
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
catalog = (await FileAttachment('bsc5.dat.txt').text()).trim().split('\n').map(line => {
const name = line.substring(4, 14).trim()
const constellation = name && name.substring(name.length - 3)
return {
hr: +line.substring(0, 4).trim(),
name,
constellation,
bv: +line.substring(109, 114),
ub: +line.substring(115, 120),
// line
}
})
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more