def layer_index(self) -> LayerIndex:
        """Convenience method to get the single layer index associated with this ScalarSource, if such a single layer index
        exists. Throws an error if it does not."""
        assert isinstance(self.layer_indexer, StaticLayerIndexer), (
            self.layer_indexer,
            "ScalarSource.layer_index should only be called for ScalarSource StaticLayerIndexer",
        )
        return self.layer_indexer.layer_index
Convenience method to get the single layer index associated with this ScalarSource, if such a single layer index
        exists. Throws an error if it does not.
neuron_explainer/activations/derived_scalars/scalar_deriver.py