ramjet.basic_models

Code for network architectures.

Module Contents

Classes

SanityCheckNetwork() A network consisting of a single fully connected layer.
SimpleCubeCnn() A simple 3D CNN for TESS data cubes.
SimpleLightcurveCnn() A simple 1D CNN for lightcurves.
SimpleFfiLightcurveCnn() A simple 1D CNN for FFI lightcurves.
SmallFfiLightcurveCnn() A simple 1D CNN for FFI lightcurves.
SimpleLightcurveLstm() A simple LSTM model for lightcurves.
SimpleLightcurveCnnPerTimeStepLabel() A simple 1D CNN for lightcurves.
Conv1DTranspose(filters, kernel_size, strides=1, *args, **kwargs) A 1D transposed convolutional layer.
ConvolutionalLstm() A convolutional LSTM network.
ConvolutionalLstmMeanFinal() A simple convolutional LSTM that does not reduce to a final value, but instead takes the average of the final
SimpleLightcurveCnnWithLstmLayers() A simple 1D CNN for lightcurves.
ResnetBlock1D(layers: int, channels: int, kernel_size: int, strides=2) A 1D ResNet block.
SimpleLightcurveCnnWithSkipConnections() A simple 1D CNN for lightcurves.
HalfDepthSimpleLightcurveCnn() A simple 1D CNN for lightcurves.
QuarterDepthSimpleLightcurveCnn() A simple 1D CNN for lightcurves.
DoubleDepthSimpleLightcurveCnn() A simple 1D CNN for lightcurves.
MiniDepthSimpleLightcurveCnn() A simple 1D CNN for lightcurves.
ConvolutionPoolingBatchNormalizationBlock(filters: int, kernel_size: int, pooling_size: int) A block containing a convolution, then a max pooling, then a batch normalization.
SimplePoolingLightcurveCnn() A simple CNN using max pooling to reduce the time dimension.
SimplePoolingLightcurveCnn2() A simple CNN using max pooling to reduce the time dimension.
FfiSimplePoolingLightcurveCnn2() A simple CNN using max pooling to reduce the time dimension.
class SanityCheckNetwork[source]

Bases: tensorflow.keras.Sequential

A network consisting of a single fully connected layer.

__init__(self)[source]

Creates a Sequential model instance.

Parameters:
  • layers – Optional list of layers to add to the model.
  • name – Optional name for the model.
class SimpleCubeCnn[source]

Bases: tensorflow.keras.Sequential

A simple 3D CNN for TESS data cubes.

__init__(self)[source]

Creates a Sequential model instance.

Parameters:
  • layers – Optional list of layers to add to the model.
  • name – Optional name for the model.
class SimpleLightcurveCnn[source]

Bases: tensorflow.keras.Model

A simple 1D CNN for lightcurves.

__init__(self)[source]

Initialize self. See help(type(self)) for accurate signature.

call(self, inputs, training=False, mask=None)[source]

The forward pass of the layer.

Parameters:
  • inputs – The input tensor.
  • training – A boolean specifying if the layer should be in training mode.
  • mask – A mask for the input tensor.
Returns:

The output tensor of the layer.

class SimpleFfiLightcurveCnn[source]

Bases: tensorflow.keras.Model

A simple 1D CNN for FFI lightcurves.

__init__(self)[source]

Initialize self. See help(type(self)) for accurate signature.

call(self, inputs, training=False, mask=None)[source]

The forward pass of the layer.

Parameters:
  • inputs – The input tensor.
  • training – A boolean specifying if the layer should be in training mode.
  • mask – A mask for the input tensor.
Returns:

The output tensor of the layer.

class SmallFfiLightcurveCnn[source]

Bases: tensorflow.keras.Model

A simple 1D CNN for FFI lightcurves.

__init__(self)[source]

Initialize self. See help(type(self)) for accurate signature.

call(self, inputs, training=False, mask=None)[source]

The forward pass of the layer.

Parameters:
  • inputs – The input tensor.
  • training – A boolean specifying if the layer should be in training mode.
  • mask – A mask for the input tensor.
Returns:

The output tensor of the layer.

class SimpleLightcurveLstm[source]

Bases: tensorflow.keras.Model

A simple LSTM model for lightcurves.

__init__(self)[source]

Initialize self. See help(type(self)) for accurate signature.

call(self, inputs, training=False, mask=None)[source]

The forward pass of the layer.

Parameters:
  • inputs – The input tensor.
  • training – A boolean specifying if the layer should be in training mode.
  • mask – A mask for the input tensor.
Returns:

The output tensor of the layer.

class SimpleLightcurveCnnPerTimeStepLabel[source]

Bases: tensorflow.keras.Model

A simple 1D CNN for lightcurves.

__init__(self)[source]

Initialize self. See help(type(self)) for accurate signature.

call(self, inputs, training=False, mask=None)[source]

The forward pass of the layer.

Parameters:
  • inputs – The input tensor.
  • training – A boolean specifying if the layer should be in training mode.
  • mask – A mask for the input tensor.
Returns:

The output tensor of the layer.

class Conv1DTranspose(filters, kernel_size, strides=1, *args, **kwargs)[source]

Bases: tensorflow.keras.layers.Layer

A 1D transposed convolutional layer.

__init__(self, filters, kernel_size, strides=1, *args, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

build(self, input_shape)[source]

Builds the layer.

Parameters:input_shape – The input tensor shape.
call(self, x, training=False, mask=None)[source]

The forward pass of the layer.

Parameters:
  • x – The input tensor.
  • training – A boolean specifying if the layer should be in training mode.
  • mask – A mask for the input tensor.
Returns:

The output tensor of the layer.

compute_output_shape(self, input_shape)[source]

The output shape of the layer.

Parameters:input_shape
Returns:
class ConvolutionalLstm[source]

Bases: tensorflow.keras.Model

A convolutional LSTM network.

__init__(self)[source]

Initialize self. See help(type(self)) for accurate signature.

call(self, inputs, training=False, mask=None)[source]

The forward pass of the layer.

Parameters:
  • inputs – The input tensor.
  • training – A boolean specifying if the layer should be in training mode.
  • mask – A mask for the input tensor.
Returns:

The output tensor of the layer.

class ConvolutionalLstmMeanFinal[source]

Bases: tensorflow.keras.Model

A simple convolutional LSTM that does not reduce to a final value, but instead takes the average of the final outputs.

__init__(self)[source]

Initialize self. See help(type(self)) for accurate signature.

call(self, inputs, training=False, mask=None)[source]

The forward pass of the layer.

Parameters:
  • inputs – The input tensor.
  • training – A boolean specifying if the layer should be in training mode.
  • mask – A mask for the input tensor.
Returns:

The output tensor of the layer.

class SimpleLightcurveCnnWithLstmLayers[source]

Bases: tensorflow.keras.Model

A simple 1D CNN for lightcurves.

__init__(self)[source]

Initialize self. See help(type(self)) for accurate signature.

call(self, inputs, training=False, mask=None)[source]

The forward pass of the layer.

Parameters:
  • inputs – The input tensor.
  • training – A boolean specifying if the layer should be in training mode.
  • mask – A mask for the input tensor.
Returns:

The output tensor of the layer.

class ResnetBlock1D(layers: int, channels: int, kernel_size: int, strides=2)[source]

Bases: tensorflow.keras.layers.Layer

A 1D ResNet block.

__init__(self, layers: int, channels: int, kernel_size: int, strides=2)[source]

Initialize self. See help(type(self)) for accurate signature.

call(self, inputs, training=False, mask=None)[source]

The forward pass of the layer.

Parameters:
  • inputs – The input tensor.
  • training – A boolean specifying if the layer should be in training mode.
  • mask – A mask for the input tensor.
Returns:

The output tensor of the layer.

class SimpleLightcurveCnnWithSkipConnections[source]

Bases: tensorflow.keras.Model

A simple 1D CNN for lightcurves.

__init__(self)[source]

Initialize self. See help(type(self)) for accurate signature.

call(self, inputs, training=False, mask=None)[source]

The forward pass of the layer.

Parameters:
  • inputs – The input tensor.
  • training – A boolean specifying if the layer should be in training mode.
  • mask – A mask for the input tensor.
Returns:

The output tensor of the layer.

class HalfDepthSimpleLightcurveCnn[source]

Bases: tensorflow.keras.Model

A simple 1D CNN for lightcurves.

__init__(self)[source]

Initialize self. See help(type(self)) for accurate signature.

call(self, inputs, training=False, mask=None)[source]

The forward pass of the layer.

Parameters:
  • inputs – The input tensor.
  • training – A boolean specifying if the layer should be in training mode.
  • mask – A mask for the input tensor.
Returns:

The output tensor of the layer.

class QuarterDepthSimpleLightcurveCnn[source]

Bases: tensorflow.keras.Model

A simple 1D CNN for lightcurves.

__init__(self)[source]

Initialize self. See help(type(self)) for accurate signature.

call(self, inputs, training=False, mask=None)[source]

The forward pass of the layer.

Parameters:
  • inputs – The input tensor.
  • training – A boolean specifying if the layer should be in training mode.
  • mask – A mask for the input tensor.
Returns:

The output tensor of the layer.

class DoubleDepthSimpleLightcurveCnn[source]

Bases: tensorflow.keras.Model

A simple 1D CNN for lightcurves.

__init__(self)[source]

Initialize self. See help(type(self)) for accurate signature.

call(self, inputs, training=False, mask=None)[source]

The forward pass of the layer.

Parameters:
  • inputs – The input tensor.
  • training – A boolean specifying if the layer should be in training mode.
  • mask – A mask for the input tensor.
Returns:

The output tensor of the layer.

class MiniDepthSimpleLightcurveCnn[source]

Bases: tensorflow.keras.Model

A simple 1D CNN for lightcurves.

__init__(self)[source]

Initialize self. See help(type(self)) for accurate signature.

call(self, inputs, training=False, mask=None)[source]

The forward pass of the layer.

Parameters:
  • inputs – The input tensor.
  • training – A boolean specifying if the layer should be in training mode.
  • mask – A mask for the input tensor.
Returns:

The output tensor of the layer.

class ConvolutionPoolingBatchNormalizationBlock(filters: int, kernel_size: int, pooling_size: int)[source]

Bases: tensorflow.keras.layers.Layer

A block containing a convolution, then a max pooling, then a batch normalization.

__init__(self, filters: int, kernel_size: int, pooling_size: int)[source]

Initialize self. See help(type(self)) for accurate signature.

call(self, inputs, training=False, mask=None)[source]

The forward pass of the layer.

Parameters:
  • inputs – The input tensor.
  • training – A boolean specifying if the layer should be in training mode.
  • mask – A mask for the input tensor.
Returns:

The output tensor of the layer.

class SimplePoolingLightcurveCnn[source]

Bases: tensorflow.keras.Model

A simple CNN using max pooling to reduce the time dimension.

__init__(self)[source]

Initialize self. See help(type(self)) for accurate signature.

call(self, inputs, training=False, mask=None)[source]

The forward pass of the layer.

Parameters:
  • inputs – The input tensor.
  • training – A boolean specifying if the layer should be in training mode.
  • mask – A mask for the input tensor.
Returns:

The output tensor of the layer.

class SimplePoolingLightcurveCnn2[source]

Bases: tensorflow.keras.Model

A simple CNN using max pooling to reduce the time dimension.

__init__(self)[source]

Initialize self. See help(type(self)) for accurate signature.

call(self, inputs, training=False, mask=None)[source]

The forward pass of the layer.

Parameters:
  • inputs – The input tensor.
  • training – A boolean specifying if the layer should be in training mode.
  • mask – A mask for the input tensor.
Returns:

The output tensor of the layer.

class FfiSimplePoolingLightcurveCnn2[source]

Bases: tensorflow.keras.Model

A simple CNN using max pooling to reduce the time dimension.

__init__(self)[source]

Initialize self. See help(type(self)) for accurate signature.

call(self, inputs, training=False, mask=None)[source]

The forward pass of the layer.

Parameters:
  • inputs – The input tensor.
  • training – A boolean specifying if the layer should be in training mode.
  • mask – A mask for the input tensor.
Returns:

The output tensor of the layer.