Skip to content

Instantly share code, notes, and snippets.

View TallJimbo's full-sized avatar

Jim Bosch TallJimbo

  • Princeton University
View GitHub Profile
@TallJimbo
TallJimbo / snap_combine_a.py
Last active April 28, 2023 16:50
Snap Combination
from lsst.afw.image import Exposure, ExposureInfo, MaskedImage, Image
from lsst.afw.table import SourceCatalog
from lsst.afw.detection import Psf
from lsst.afw.math import BackgroundList
from lsst.pex.config import Config, ConfigurableField
from lsst.pipe.base import PipelineTaskConnections, PipelineTaskConfig, PipelineTask, Struct, Task
from lsst.pipe.base.connectionTypes import Input, Output
class CharacterizeImageConnections(PipelineTaskConnections, dimensions=("visit", "detector")):
from typing import Iterable, Optional
import astropy.time
from lsst.daf.butler import DatasetRef
class Registry:
...
def certify(self, collection: str,
@TallJimbo
TallJimbo / connections.py
Last active May 14, 2020 14:46
Interface sketch for Gen3 registry dimensions pre-fetching object
class DimensionConnector(ABC):
"""An interface for objects that optimize joins and other queris on
dimension information via pre-fetching.
Parameters
----------
dimensions
All dimensions that will ever be passed to or used by this object.
In the QuantumGraph generation use case, this would be all
dimensions referenced by any dataset type or task in the full
@TallJimbo
TallJimbo / redundant-constraint-bug.sql
Last active February 13, 2020 19:32
Reproduces a SQLite 3.31.1 bug in query results with redundant constraints
- Result should be "good" only, not "good" and "bad"
DROP TABLE IF EXISTS redundant;
DROP TABLE IF EXISTS enough;
CREATE TABLE redundant (
name VARCHAR(10) PRIMARY KEY
);
INSERT INTO redundant VALUES('good');
INSERT INTO redundant VALUES('bad');
@TallJimbo
TallJimbo / filters.py
Last active August 23, 2019 15:12
Filter RFC proposal
from abc import ABC, abstractmethod
from typing import Optional
class Filter(ABC):
"""A string-based identifier for a filter.
A `Filter` may be *associated* with transmission curve information,
but never holds it. In many cases, that association will also require
other information (i.e. an epoch or validity range).
@TallJimbo
TallJimbo / read_footprints.py
Last active July 10, 2018 17:31
Pure-Python lsst.afw.table.io reader for Footprints
#
# Copyright (c) 2018 Jim Bosch
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
@TallJimbo
TallJimbo / read_footprints.py
Created July 10, 2018 17:29
Pure-Python lsst.afw.table.io reader for Footprints
#
# Copyright (c) 2018 Jim Bosch
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
@TallJimbo
TallJimbo / butler-use-cases.md
Last active August 10, 2017 19:19
Use Cases for the LSST DM Data Butler Working Group

Definitions

Data Repository

A collection of datasets and the metadata that describes them, managed by the Butler. Datasets in a repository share at least some provenance (e.g. configuration and software versions). Data repositories may be chained together, enabling the outputs of one step of processing to be used as the inputs for the next, and the graph of related data repositories defines a search path for the datasets within them.

Data ID

@TallJimbo
TallJimbo / inplace-ops-on-properties.py
Last active May 17, 2017 19:56
Testing how Python implements in-place binary operations on properties
class Member(object):
def __init__(self, value):
self.value = value
def __iadd__(self, value):
print("__iadd__")
self.value += value
return self
@TallJimbo
TallJimbo / RFC-28
Created March 5, 2015 18:10
LSST DM Fuzzy Comparison Proposal (RFC-28)
class Comparison(object):
"""Interface definition for comparison objects.
This class doesn't actually have to exist - it's just for exposition.
A comparison for a new type can be defined by implementing a class with
signatures like this one, then calling ComparisonRegistry.register().
"""