sfftk.schema package¶
sfftk.schema¶
This module defines an usable adapter API to the one generated by generateDS API. It is designed to fulfill several requirements:
allow multiple versions of generateDS APIs to exist for the same adapter;
implement more convenient ways of working with the classes of the API;
easily integrate new EMDB-SFF entities into the API;
decouple the file format from the data model: most classes in this adapter implement methods to handle conversion to non-XML formats (XML is the only format that generateDS writes to)
This adapter API therefore specifies two main base classes from which all other classes are built upon:
The SFFType
Base Class¶
This class contains all the magic to convert a subclass definition into a user-level class. View the API documentation of this class for details on its attributes.
The SFFAttribute
Descriptor Class¶
Attributes of subclasses of SFFType
are instances of this descriptor class.
In addition to the two above classes there is a SFFTypeError
class which is raised whenever a type error
occurs which provides details on the required type.
Here is an example of how the SFFSegmentation
class is defined using these classes:
class SFFSegmentation(SFFType):
"""Adapter class to make using the output of ``generateDS`` easier to use"""
gds_type = sff.segmentation
ref = "Segmentation"
repr_string = ""
# attributes
name = SFFAttribute('name')
version = SFFAttribute('version')
software = SFFAttribute('software', sff_type=SFFSoftware)
primaryDescriptor = SFFAttribute('primaryDescriptor')
transforms = SFFAttribute('transformList', sff_type=SFFTransformList)
boundingBox = SFFAttribute('boundingBox', sff_type=SFFBoundingBox)
globalExternalReferences = SFFAttribute('globalExternalReferences', sff_type=SFFGlobalExternalReferences)
segments = SFFAttribute('segmentList', sff_type=SFFSegmentList)
details = SFFAttribute('details')
In the above example, the SFFSegmentation
class inherits from SFFType
which uses the first
three attributes (gds_type
, ref
and repr_string
) to configure the user-level SFFSegmentation
class. A user can now use SFFSegmentation
normally:
from sfftk.schema import SFFSegmentation
# to create a new empty EMDB-SFF segmentation object
seg = SFFSegmentation()
# to open an XML-, HDF5- or JSON-formatted file, respectively
seg = SFFSegmentation('file.sff')
seg = SFFSegmentation('file.hff')
seg = SFFSegmentation('file.json')
The attributes (name
, version
, etc.) are all instances of SFFAttribute
, which takes the name (first
positional argument) and an optional keyword argument sff_type
denoting the class of the attribute. In the above
example, the software
attribute will be of class SFFSoftware
.
-
class
sfftk.schema.
SFFType
(var=None, *args, **kwargs)¶ Bases:
object
Base class for all EMDB-SFF adapter classes
This class reads and configures any subclass using the subclass’ definition.
Subclasses of
SFFType
should define class attributes from the following list depending on whether the subclass defines a container or not. Containers typically have List in the class name signifying that they are a list of objects of some type. For example, theSFFSegmentList
objects are a list ofSFFSegment
objects.- Parameters
var – argument value determines what the subclass does
The
type
ofvar
determines what the subclass does.If the subclass is
SFFSegmentation
then ifvar
is:None
it will produce an emptySFFSegmentation
objectan
emdb_sff.segmentation
object it will produce a populatedSFFSegmentation
object;str
it will try to treatvar
as a filename containing data to populate anSFFSegmentation
object; the extension of the filename determines the format to be read:*.sff
will read as XML*.hff
will read as HDF5*.json
will read as JSON
If the subclass is any other class then if
var
is:None
it will produce an empty object of that class e.g.SFFSoftware()
will produce an empty object for defining software dataNone
(or excluded) but keyword arguments to the generated generateDS class are specified it will produce a populated object of the corresponding adapter class e.g.SFFSoftware(name="name", version="version", processingDetails="details")
will be an object loaded with the keyword data;any
emdb_sff
object it will produce a populated object of the corresponding adapter class;
-
gds_type
¶ The class generated by generateDS (generate ds type) that this class adapts
-
repr_str
¶ A string representation for objects of the subclass that can be formatted. This string will be produced for calls to the
print()
function. Formatting is accomplished by included empty format delimiters ({}
) which will be populated with values from therepr_args
specified below otherwise literal braces will be displayed.
-
repr_args
¶ The arguments of the string representation, if any. This is a tuple containing any combination of either:
the names of attributes of the subclass to populate the the
repr_string
attribute;a literal text string;
the string
len()
to include the length of the subclass
-
iter_attr
¶ The iterable attribute of the class. It refers to an attribute of the class pointed to by
gds_type
which is iterable.It should be a two-tuple having the name of the generateDS class and
SFF*
class to adapt it to.Only one attribute per class can be specified.
For example, consider the following class definition for some fictional
SFFTest
class that adapts a class calledtest
that was generated by generateDS.import emdb_sff class SFFTest(SFFType): gds_type = emdb_sff.test repr_str = "SFFTest object with {} SFFItem objects inside" repr_args = ("len()",) iter_attr = ('i', SFFItem) # attributes items = SFFAttribute('items', sff_type=SFFItem)
In this sample:
the generateDS API is located in the module called
emdb_sff
;test
is a class in theemdb_sff
module;i
is an iterable attribute oftest
;i
is adapted by theSFFItem
class (which should have itsgds_type
set to the class fori
);
Now consider this class in action:
from sfftk.schema import SFFTest T = SFFTest() # ... # populate T with some valid data # ... # now we can iterate over the data for i in T: # because it has an iter_attr specified # i is an SFFItem object print(i) # prints 'SFFTest object with 37 SFFItem objects inside'
In addition to being iterable, the iterable attribute enable the following operations on objects of the subclass:
length i.e. len(obj);
len(T) # 37
indexing e.g.
obj[<int>]
;T[15]
-
export
(fn, *_args, **_kwargs)¶ Export to a file on disc
- Parameters
fn (str) – filename to export to; the output format is determined by the extension:
.sff
- XML.hff
- HDF5.json
- JSON
-
get_by_id
(item_id)¶ If the subclass is a container class, returns the object of the specified ID
- Parameters
item_id (int) – the ID whose item is required
- Returns
a contained object
- Return type
depends on the container class
- Raises
ValueError – if the item is not found
-
get_ids
()¶ If the subclass is a container class, returns a list of IDs for items contained
- Returns
a list of IDs
- Return type
-
classmethod
reset_id
()¶ Reset the ID for a subclass
-
class
sfftk.schema.
SFFAttribute
(name, sff_type=None, get_from=None, set_to=None, del_from=None, help='')¶ Bases:
object
Descriptor for SFFType subclass attributes
This descriptor acts an adapter and references an attribute on the instance (obj._local). In this way, it guarantees that there is no overwriting of values because every instance will have a new _local instance to refer to.
-
class
sfftk.schema.
SFFSegmentation
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
Adapter class to make using the output of
generateDS
easier to use-
as_hff
(parent_group, name=None)¶ Return the data of this object as an HDF5 group in the given parent group
-
as_json
(f, sort_keys=True, indent_width=2)¶ Render an EMDB-SFF to JSON
-
boundingBox
¶ the bounding box in which the segmentation sits; a
sfftk.schema.SFFBoundingBox
object
-
clear_annotation
(from_id)¶ Clear all annotations from the segment with ID specified
- Parameters
from_id – segment ID
- Returns
-
copy_annotation
(from_id, to_id)¶ Copy annotation across segments
- Parameters
from_id (int/list) – segment ID to get notes from; use -1 for for global notes
to_id (int/list) – segment ID to copy notes to; use -1 for global notes
-
details
¶ any other details about this segmentation (free text)
-
classmethod
from_hff
(hff_data)¶ Create an
sfftk.schema.SFFSegmentation
object from HDF5 formatted data- Parameters
hff_data (
h5py.File
) – an HDF5 File object- Return sff_seg
an EMDB-SFF segmentation
- Rtype sff_seg
-
classmethod
from_json
(json_file)¶ Create an
sfftk.schema.SFFSegmentation
object from JSON formatted data- Parameters
json_file (str) – name of a JSON-formatted file
- Return sff_seg
an EMDB-SFF segmentation
- Rtype sff_seg
-
gds_type
¶ alias of
sfftk.schema.emdb_sff.segmentation
-
globalExternalReferences
¶ a list of external references that apply to the whole segmentation (global); a
sfftk.schema.SFFGlobalExternalReferences
object
-
lattices
¶ the list of lattices (if any) containing 3D volumes referred to; a
sfftk.schema.SFFLatticeList
object
-
merge_annotation
(other_seg)¶ Merge the annotation from another sff_seg to this one
- Parameters
other_seg (
sfftk.schema.SFFSegmentation
) – segmentation to get annotations from
-
name
¶ the name of this segmentation
-
property
numGlobalExternalReferences
¶ The number of global external references
-
primaryDescriptor
¶ the main type of representation used for this segmentation; can be one of ‘meshList’, ‘shapePrimitiveList’ or ‘threeDVolume’
-
segments
¶ the list of annotated segments; a
sfftk.schema.SFFSegmentList
object
-
software
¶ the software details used to generate this segmentationa
sfftk.schema.SFFSoftware
object
-
transforms
¶ a list of transforms; a
sfftk.schema.SFFTransformList
object
-
version
¶ EMDB-SFF version
-
-
class
sfftk.schema.
SFFSoftware
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
Class definition for specifying software used to create this segmentation
-
name
¶ The name of the software used
-
version
¶ The version string
-
processingDetails
¶ Details of how the segmentation was produced
-
as_hff
(parent_group, name='software')¶ Return the data of this object as an HDF5 group in the given parent group
-
classmethod
from_hff
(hff_data)¶ Return an SFFType object given an HDF5 object
-
name
the software/programme’s name
-
processingDetails
a description of how the data was processed to produce the segmentation
-
version
the version used
-
-
class
sfftk.schema.
SFFTransformList
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
Container for transforms
-
add_transform
(T)¶ Add the specified transform to this transform container
-
as_hff
(parent_group, name='transforms')¶ Return the data of this object as an HDF5 group in the given parent group
-
check_transformation_matrix_homogeneity
()¶ Helper method to check transformation matrix homogeneity
If the transformation matrices are not homogeneous then we cannot use structured arrays in numpy :’(
-
classmethod
from_hff
(hff_data)¶ Return an SFFType object given an HDF5 object
-
property
transformationMatrixCount
¶ The number of
SFFTransformationMatrix
objects in this transform container
-
-
class
sfftk.schema.
SFFTransformationMatrix
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
Transformation matrix transform
-
cols
¶ the number of columns in this matrix
-
data
¶ the data in this matrix
-
property
data_array
¶ The data in this matrix as an array
-
gds_type
¶ alias of
sfftk.schema.emdb_sff.transformationMatrixType
-
id
¶ an ID for this transform
-
rows
¶ the number of rows in this matrix
-
-
class
sfftk.schema.
SFFBoundingBox
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
Dimensions of bounding box
-
as_hff
(parent_group, name='boundingBox')¶ Bounding box as HDF5 group
-
classmethod
from_hff
(hff_data)¶ Bounding box from HDF5 group
-
xmax
¶ maximum x co-ordinate value
-
xmin
¶ minimum x co-ordinate value
-
ymax
¶ maximum y co-ordinate value
-
ymin
¶ minimum y co-ordinate value
-
zmax
¶ maximum z co-ordinate value
-
zmin
¶ minimum z co-ordinate value
-
-
class
sfftk.schema.
SFFGlobalExternalReferences
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
Container for global external references
-
add_externalReference
(eR)¶ Add the specified external reference object to this container
- Parameters
eR (
SFFExternalReference
) – an external reference object
-
insert_externalReference
(eR, index)¶ Insert the specified external reference object at the specified index
- Parameters
eR (
SFFExternalReference
) – an external reference objectindex (int) – the index to insert to; bumps all other external references down the list
-
replace_externalReference
(eR, index)¶ Replace the external reference at
index
with the specified external reference- Parameters
eR (
SFFExternalReference
) – an external reference objectindex (int) – the index to replace at
-
-
class
sfftk.schema.
SFFBiologicalAnnotation
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
Biological annotation
-
as_hff
(parent_group, name='biologicalAnnotation')¶ Return the data of this object as an HDF5 group in the given parent group
-
description
¶ a brief description for this segment
-
externalReferences
¶ the set of external references
-
classmethod
from_hff
(hff_data)¶ Return an SFFType object given an HDF5 object
-
name
¶ the name of this segment
-
numberOfInstances
¶ the number of instances of this segment
-
-
class
sfftk.schema.
SFFExternalReferences
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
Container for external references
-
add_externalReference
(eR)¶ Add the specified external reference object to this container
- Parameters
eR (
SFFExternalReference
) – an external reference object
-
insert_externalReference
(eR, index)¶ Insert the specified external reference object at the specified index
- Parameters
eR (
SFFExternalReference
) – an external reference objectindex (int) – the index to insert to; bumps all other external references down the list
-
replace_externalReference
(eR, index)¶ Replace the external reference at
index
with the specified external reference- Parameters
eR (
SFFExternalReference
) – an external reference objectindex (int) – the index to replace at
-
-
class
sfftk.schema.
SFFExternalReference
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
Class that encapsulates an external reference
-
description
¶ a long description of this external reference
-
id
¶ this external reference’s ID
-
label
¶ a short description of this external reference
-
otherType
¶ a URL/IRI where data for this external reference may be obtained
-
type
¶ the ontology/archive name
-
value
¶ the accession for this external reference
-
-
class
sfftk.schema.
SFFComplexesAndMacromolecules
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
Complexes and macromolecules
-
as_hff
(parent_group, name='complexesAndMacromolecules')¶ Return the data of this object as an HDF5 group in the given parent group
-
complexes
¶ a list of complex accessions
-
classmethod
from_hff
(hff_data)¶ Return an SFFType object given an HDF5 object
-
gds_type
¶ alias of
sfftk.schema.emdb_sff.macromoleculesAndComplexesType
-
macromolecules
¶ a list of macromolecule accessions
-
-
class
sfftk.schema.
SFFComplexes
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
Class that encapsulates complex
-
add_complex
(c)¶ Add a complex accession to the available complexes
- Parameters
c (str) – a complex accession
-
delete_at
(index)¶ Delete the complex accession at the given index
- Parameters
index (int) – index from which to delete the complex accession
-
classmethod
from_hff
(hff_data)¶ Return an SFFType object given an HDF5 object
-
insert_complex_at
(index, c)¶ Insert a complex accession at the given index
-
replace_complex_at
(index, c)¶ Replace a complex accession at the given index
-
repr_args
= ('len()',)¶ - TODO
buggy; refers to emdb_sff attribute instead of SFFType attribute (which is inconsistent)
-
-
class
sfftk.schema.
SFFMacromolecules
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
Class that encapsulates macromolecule
-
add_macromolecule
(m)¶ Add the given macromolecule accession to this container
- Parameters
m (str) – a macromolecule accession
-
delete_at
(index)¶ Delete the macromolecule accession at the give index
- Parameters
index (int) – index of macromolecule accession to delete
-
classmethod
from_hff
(hff_data)¶ Return an SFFType object given an HDF5 object
-
insert_macromolecule_at
(index, m)¶ Insert the given macromolecule accession at the specified index bumping all others down the list
-
replace_macromolecule_at
(index, m)¶ Replace the macromolecule accession at the specified index with the one specified
-
-
class
sfftk.schema.
SFFRGBA
(var=None, random_colour=False, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
RGBA colour
-
alpha
¶ alpha (opacity) channel
-
as_hff
(parent_group, name='colour')¶ Return the data of this object as an HDF5 group in the given parent group
-
blue
¶ blue channel
-
classmethod
from_hff
(hff_data)¶ Return an SFFType object given an HDF5 object
-
green
¶ green channel
-
red
¶ red channel
-
-
class
sfftk.schema.
SFFSegmentList
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
Container for segments
-
add_segment
(s)¶ Add a segment to this segment container
- Parameters
s (
SFFSegment
) – a segment object- Raises
SFFTypeError – if
s
is of the wrong type
-
as_hff
(parent_group, name='segments')¶ Return the data of this object as an HDF5 group in the given parent group
-
classmethod
from_hff
(hff_data)¶ Return an SFFType object given an HDF5 object
-
-
class
sfftk.schema.
SFFSegment
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
Class that encapsulates segment data
-
as_hff
(parent_group, name='{}')¶ Return the data of this object as an HDF5 group in the given parent group
-
biologicalAnnotation
¶ the biological annotation for this segment; described using a
sfftk.schema.SFFBiologicalAnnotation
object
-
colour
¶ this segments colour; described using a
sfftk.schema.SFFRGBA
object
-
complexesAndMacromolecules
¶ the complexes and macromolecules associated with this segment; described using a
sfftk.schema.SFFComplexesAndMacromolecules
object
-
classmethod
from_hff
(hff_data)¶ Return an SFFType object given an HDF5 object
-
gds_type
¶ alias of
sfftk.schema.emdb_sff.segmentType
-
id
¶ the ID for this segment; segment IDs begin at 1 with the value of 0 implying the segmentation i.e. all segments are children of the root segment (the segmentation)
-
meshes
¶ the list of meshes (if any) that describe this segment; a
sfftk.schema.SFFMeshList
object
-
parentID
¶ the ID for the segment that contains this segment; defaults to 0 (the whole segmentation)
-
shapes
¶ the list of shape primitives that describe this segment; a
sfftk.schema.SFFShapePrimitiveList
object
-
volume
¶ the 3D volume (if any) that describes this segment; a
sfftk.schema.SFFThreeDVolume
object
-
-
class
sfftk.schema.
SFFMeshList
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
Mesh list representation
-
as_hff
(parent_group, name='meshes')¶ Return the data of this object as an HDF5 group in the given parent group
-
classmethod
from_hff
(hff_data)¶ Return an SFFType object given an HDF5 object
-
-
class
sfftk.schema.
SFFMesh
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
Single mesh
-
classmethod
from_hff
(hff_data)¶ Return an SFFType object given an HDF5 object
-
property
numPolygons
¶ The number of polygons in this mesh
-
property
numVertices
¶ The number of vertices in this mesh
-
polygons
¶ a list of derived polygons (object of class
sfftk.schema.SFFPolygonList
)
-
transformId
¶ a transform applied to the mesh
-
vertices
¶ a list of vertices (object of class
sfftk.schema.SFFVertexList
)
-
classmethod
-
class
sfftk.schema.
SFFVertexList
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
List of vertices
-
add_vertex
(v)¶ Add the provided vertex to this vertex container
- Parameters
v (
SFFVertex
) – a vertex object- Raises
SFFTypeError – if
v
is of the wrong type
-
classmethod
from_hff
(hff_data)¶ Return an SFFType object given an HDF5 object
-
property
numVertices
¶ The number of vertices in this vertex container
-
property
vertex_ids
¶ Iterable of vertex IDs contained in this vertex container
-
-
class
sfftk.schema.
SFFVertex
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
Single vertex
-
designation
¶ type of vertex (‘surface’ (default) or ‘normal’)
-
property
point
¶ The co-ordinates for this vertex
-
vID
¶ vertex ID; referenced by polygons
-
x
¶ x co-ordinate
-
y
¶ y co-ordinate
-
z
¶ z co-ordinate
-
-
class
sfftk.schema.
SFFPolygonList
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
List of polygons
-
add_polygon
(P)¶ Add a polygon to this polygon container
- Parameters
p (
SFFPolygon
) – a polygon object
-
classmethod
from_hff
(hff_data)¶ Return an SFFType object given an HDF5 object
-
property
numPolygons
¶ The number of polygons in this list of polygons
-
property
polygon_ids
¶ An iterable over the polygon IDs of the contained polygons
-
-
class
sfftk.schema.
SFFPolygon
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
Single polygon
-
PID
¶ the ID for this polygon
-
property
vertex_ids
¶ An iterable of vertex IDs of this polygon
-
-
class
sfftk.schema.
SFFShapePrimitiveList
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
Container for shapes
-
add_shape
(s)¶ Add the provide shape into this shape container
- Parameters
s (
SFFShape
) – a shape object- Raises
SFFTypeError – if
s
is of the wrong type
-
classmethod
from_hff
(hff_data)¶ Return an SFFType object given an HDF5 object
-
property
numCones
¶ The number of cones in this container
-
property
numCuboids
¶ The number of cuboids in this container
-
property
numCylinders
¶ The number of cylinders in this container
-
property
numEllipsoids
¶ The number of ellipsoids in this container
-
-
class
sfftk.schema.
SFFShape
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
Base shape class
-
attribute
¶ extra attribute information e.g. ‘FOM’
-
id
¶ the ID of this shape
-
transformId
¶ the transform applied to this shape to position it in the space
-
-
class
sfftk.schema.
SFFCone
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFShape
Cone shape class
-
bottomRadius
¶ cone bottom radius
-
height
¶ cone height
-
-
class
sfftk.schema.
SFFCuboid
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFShape
Cuboid shape class
-
gds_type
¶ alias of
sfftk.schema.emdb_sff.cuboid
-
x
¶ length in x
-
y
¶ length in y
-
z
¶ length in z
-
-
class
sfftk.schema.
SFFCylinder
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFShape
Cylinder shape class
-
diameter
¶ cylinder diameter
-
height
¶ cylinder height
-
-
class
sfftk.schema.
SFFEllipsoid
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFShape
Ellipsoid shape class
-
gds_type
¶ alias of
sfftk.schema.emdb_sff.ellipsoid
-
x
¶ length in x
-
y
¶ length in y
-
z
¶ length in z
-
-
class
sfftk.schema.
SFFThreeDVolume
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
Class representing segments described using a 3D volume
-
as_hff
(parent_group, name='volume')¶ Return the data of this object as an HDF5 group in the given parent group
-
classmethod
from_hff
(hff_data)¶ Return an SFFType object given an HDF5 object
-
latticeId
¶ the ID of the lattice that has the data for this 3D volume
-
transformId
¶ a transform applied to this 3D volume [optional]
-
value
¶ the voxel values associated with this 3D volume
-
-
class
sfftk.schema.
SFFVolume
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
Class for represention 3-space dimension
-
cols
¶ number of columns
-
classmethod
from_hff
(hff_data)¶ Return an SFFType object given an HDF5 object
-
rows
¶ number of rows
-
sections
¶ number of sections (sets of congruent row-column collections)
-
-
class
sfftk.schema.
SFFVolumeStructure
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFVolume
-
property
voxelCount
¶ The number of voxels in this volume
-
property
-
class
sfftk.schema.
SFFVolumeIndex
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFVolume
-
class
sfftk.schema.
SFFLatticeList
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
A container for lattice objects
-
add_lattice
(l)¶ Add a lattice to the list of lattices
Convert the data from bytes to unicode before adding
- Parameters
l (
SFFLattice
) – a lattice object
-
as_hff
(parent_group, name='lattices')¶ Return the data of this object as an HDF5 group in the given parent group
-
classmethod
from_hff
(hff_data)¶ Return an SFFType object given an HDF5 object
-
-
class
sfftk.schema.
SFFLattice
(var=None, *args, **kwargs)¶ Bases:
sfftk.schema.SFFType
Class representing 3D
-
as_hff
(parent_group, name='{}')¶ Return the data of this object as an HDF5 group in the given parent group
-
data
¶ data provided by a numpy array; the dimensions should correspond with those specified in the ‘size’ attribute
-
decode
()¶ Decode the data for processing
Base64 decode -> Unzip -> Unpack -> Reshape
-
encode
()¶ Encode the numpy array provided in the initialiser
Flatten -> Pack -> Zip -> Base64 encode
-
endianness
¶ endianness; either ‘little’ (default) or ‘big’
-
classmethod
from_hff
(hff_data)¶ Return an SFFType object given an HDF5 object
-
id
¶ the ID for this lattice (referenced by 3D volumes)
-
property
is_binary
¶ Quick check to see whether the 3D volume is binary or not
-
property
is_encoded
¶ Tells whether the data in the lattice is encoded or not
-
mode
¶ type of data for each voxel; valid values are: int8, uint8, int16, uint16, int32, uint32, int64, uint64, float32, float64
-
size
¶ size of the lattice described using a
sfftk.schema.SFFVolumeStructure
object
-
start
¶ starting index of the lattices described using a:py:class:sfftk.schema.SFFVolumeIndex object
-


Man due in court over machete robbery at filling station
Gardaí arrested suspect (23) shortly after raid on the Blackrock Road in Cork
by Barry RocheA 23-year-old man is due to appear in court on Tuesday in connection with a robbery in Cork at the weekend after a man armed with a machete raided a filling station .
The man from the Mahon area on Cork’s southside was arrested in Mahon on Sunday evening by gardaí investigating an armed raid on a filling station on the Blackrock Road at about 5.30pm.
A man armed with a machete went into the filling station before fleeing on foot with a tray from the cash register .
Staff were uninjured in the raid and were able to alert gardaí who were quickly on the scene. Gardaí arrested a man (23) in the Mahon area a short time later.
The man was arrested and brought to the Bridewell Garda station where he was detained under Section 4 of the Criminal Justice Act and questioned all throughout Monday about the robbery.
The man was charged on Monday night at the Bridewell Garda station with robbery and is due to be brought before Cork District Court on Tuesday morning .
Meanwhile gardaí recovered a sum of cash they believe was taken in the raid while searches are due to resume on Tuesday for the machete .


{% extends ""|add:RUNTIME_USER|add:":httptest:static/base.html" %} {% load humanize %} {% load datastore %} {% block body %}
Declarative HTTP-Based Service Testing, Alerting and SSL Certificate Monitoring
Declare in a human readable format the expected behaviour of a service and run tests with assert instructions.
Learn MoreService Monitoring & Alertingreduces your Ops reaction time to fix an issue by repeated runs and alerting by email.
Learn MoreVerifies SSL related configuration and the expiration date of the server's certificate to plan the renewal of the certificate earlier.
Learn MoreThe source code is on Github https://github.com/sahlinet/httptest and is waiting for contributors. HTTPTest is based on Tumbo and everybody can run HTTPTest on every infrastructure with Tumbo.


[1] On the defeat of Pharnaces and reduction of Africa, those who escaped from those battles fled to young Cn. Pompey, who had taken possession of Further Spain, while Caesar was detained in Italy in exhibiting games. Pompey began to throw himself on the protection of every state, in order the more readily to establish the means of defense against him. Accordingly, with a considerable force which had been collected, partly by entreaty, partly by force, he began to lay waste the province. Under these circumstances some states voluntarily sent him supplies, others shut the gates of their towns against him. If any of these chanced to fall into his hands by assault, although some citizen in it had deserved well of Cn. Pompey (his father), yet some cause was alleged against him on account of the greatness of his wealth, so that, he being dispatched, his fortune might become the reward of the soldiers. Thus the enemy, being encouraged by a few advantages, their forces increased much, wherefore those states which were opposed to Pompey, by continual messages dispatched to Italy, sought protection for themselves.
[2] When Caesar, now a third time dictator, and elected a fourth time, having already proceeded many marches into Spain with prompt dispatch, was coming to finish the war, he was met on the way by embassadors from Corduba, who had deserted Cn. Pompey; these informed him that it would be an easy matter to make himself master of the town by night, because the enemy as yet knew nothing of his arrival in the province, as the scouts sent out by Cn. Pompey to inform him of Caesar's approach had been all made prisoners. They alleged besides many other very plausible reasons. He, therefore, immediately sent intelligence of his arrival to Q. Pedius, and Q. Fabius Maximus his lieutenants, to whom he had left the command of the troops in the province, ordering them to send him all the cavalry they had been able to raise. He came up with them much sooner than they expected, and had not the protection of the cavalry, according to his desire.
[3] Sextus Pompey, the brother of Cneius, commanded at this time at Corduba, which was accounted the capital of the province. Young Cneius Pompey himself was employed in the siege of Ulia, which had now lasted some months. Notice of Caesar's arrival having been received, messengers having passed Pompey's guards came to him from that town and besought him to send them relief as soon as possible. Caesar, knowing that this people had deserved very well of the Romans, detached, about nine o'clock, at night eleven cohorts, with a like number of horse, under the command of L. Julius Paciecus, a man known in that province, and also well acquainted with it. When he arrived at Pompey's quarter, a dreadful tempest arising, attended with a violent wind, so great a darkness ensued that you could scarcely have distinguished even the person next you. This accident proved of great advantage to Paciecus: for being arrived at Pompey's camp, he ordered the cavalry to advance two by two, and march directly through the enemy's quarters to the town; one of their guards calling to know who passed, one of our troopers bade him be silent, for they were just then endeavoring by stealth to approach the wall, in order to get possession of the town; and partly by this answer, partly by favor of the tempest, the sentinels were prevented from examining things diligently. When they reached the gates, upon a signal being given, they were admitted; and both horse and foot raising a loud shout, after leaving some troops to guard the town, sallied in a body upon the enemy's camp. This came upon them so unexpectedly that the greater number of the men in the camps thought that they were captured.
[4] Ulia being relieved, Caesar, to draw Pompey from the siege, marched toward Corduba; sending the cavalry before, with a select body of heavy-armed foot; who, as soon as they came within sight of the place, got up behind the troopers. By this stratagem they could not possibly be perceived by those of Corduba. Upon their approach to the walls, the enemy sallied in great numbers to attack our cavalry; when the infantry, whom we have mentioned above, leaping down, fell upon them with such fury that out of an almost infinite multitude of men, very few returned to the town. This so alarmed Sextus Pompey that he immediately sent letters to his brother, requesting him to come speedily to his relief, lest Caesar should make himself master of Corduba before his arrival. Thus Cn. Pompey, moved by his brother's letters, quitted the siege of Ulia, which was upon the point of surrendering, and set out toward Corduba.
[5] Caesar, arriving at the river Guadalquivir, which he found too deep to be forded, sank several baskets of stones in it. Thus having formed a bridge, he transported his troops in three bodies to the camps. As I have just mentioned, the beams of the bridge stretched over against the tower in two rows. Pompey, arriving soon after with his troops, encamped directly over against him. Caesar, to cut off his provisions and communication with the town, ran a line from his camp to the bridge. Pompey did the same; so that a struggle arose between the two generals, which should first get possession of the bridge; and this daily brought on skirmishes, in which sometimes the one, sometimes the other party had the better. When these merged into a serious engagement, both sides fought hand to hand; in the heat of the struggle for this position, owing to the narrowness of the bridge, they were pressed together, and in their efforts to extend themselves toward the river-side, many fell headlong. Thus the loss was pretty equal; for on either side lay heaps of slain, and Caesar for many days used all possible endeavors to bring the enemy to an engagement on equal terms, that he might bring the war to a conclusion as soon as possible.
[6] But finding that they carefully avoided a battle, with a view to which chiefly he had quitted the route of Ulia; he caused great fires to be lighted in the night, repassed the river with all his forces, and marched toward Ategua, one of their strongest garrisons. Pompey, being informed of this by the deserters, on the same day brought back many carriages and machines by narrow paths, and betook himself to Corduba. Caesar began his attack upon Ategua, and carried lines quite round the town. Pompey, having intelligence of this, set out upon his march the same day. In order to guard against his arrival, Caesar possessed himself of many forts; partly to shelter his cavalry, partly to post guards of infantry for the defense of his camp. Pompey's arrival happened at a time when the mist was very thick, so that he found means, with some cohorts and troops of cavalry, to hem in a party of Caesar's horse, and fell upon them in such manner that very few escaped slaughter.
[7] The following night Pompey set fire to his camp, passed the river Rio Salado, and, marching through the valleys, encamped on a rising ground, between the two towns of Ategua and Ucubis. Caesar cast up a mound and brought forward his machines, with other preparations which were necessary for storming the town. The country all around is mountainous, and seems formed for war, being separated from the plain by the river Rio Salado, ascending on the side toward Ategua, about two miles from the river. Pompey's camp was upon these mountains, within view of both towns; he could, however, send no relief to his friends. He had the emblems and standards of thirteen legions, but of those on whom he trusted for support two were natives which had deserted from Trebonius; one was formed out of the Roman colonies in those parts; and a fourth, belonging to Afranius, he had brought with him from Africa; the rest were for the most part made up of fugitives and deserters; in light-armed foot and cavalry we far exceeded him in both courage and numbers.
[8] Another reason why Pompey was enabled to protract the war was that the country was full of mountains and extremely well adapted to encampments. For almost the whole province of Further Spain, though of an extremely fertile soil, and abounding in springs, is nevertheless very difficult of access. Here too, on account of the frequent incursions of the natives, all the places remote from great towns, are fortified with towers and castles, covered as in Africa, not with tiles but with earth, on these they place sentinels, and their high situation commands an extensive view of the country on all sides. Nay, the greatest part of the towns of this province are built on mountains, and places exceedingly strong by nature, the approaches to which are extremely difficult. Thus sieges are rare and hazardous in Spain, since it is not easy to reduce their towns by force; as happened in the present war. For Pompey having established his camp between Ategua and Ucubis, as related above, and within view of both towns, Caesar possessed himself of an eminence very conveniently situated, and only about four miles from his own camp, on which he built a fortress.
[9] Pompey, who, from the nature of the ground, was covered by the same eminence, which was besides at a sufficient distance from Caesar's quarters, became sensible of the importance of this post; and as Caesar was separated from it by the river Rio Salado, he imagined that the difficulty of sending relief would prevent his attempting any thing of that kind in its defense. Influenced by this belief, he set out about midnight and attacked the fort, that he might bring assistance to the besieged. Our troops, upon their approach, setting up a shout, discharged their javelins in great numbers, and wounded multitudes of men. After this, when those in the camp began to resist, and when tidings of it was conveyed to the great camps to Caesar, he set out with three legions, and when he approached them, many were killed, owing to their trepidation and flight, and a great number made prisoners. Among these two * * *; and many others, having thrown down their arms escaped, so that fourscore shields were found.
[10] The next day Arguetius arrived from Italy with the cavalry, and five standards taken from the Saguntines; but was forced to quit his post by Asprenas, who likewise brought a reinforcement from Italy to Caesar. The same night Pompey set fire to his camp, and drew toward Corduba. A king, named Indus, who was bringing some troops to Caesar with a party of cavalry, following the pursuit of the enemy too briskly, was made prisoner, and slain by the Spanish legionaries.
[11] On the next day, our cavalry pursued those who were employed in carrying provisions from the town to Pompey's camp, almost to the very walls of Corduba, and took fifty prisoners besides horses. On the same day, Q. Marcius, a military tribune in Pompey's army, deserted to us. At midnight, a keen encounter took place in the town, and they hurled fire and every means was resorted to by which fire could be cast. When the attack was ended, C. Fundanius, a Roman knight, quitted the enemy, and came over to us.
[12] On the next day, two Spanish legionaries, who pretended to be slaves, were made prisoners by a party of our horse; but being brought to the camp, they were known by the soldiers, who had formerly served under Fabius and Pedeius, and deserted from Trebonius. No pardon was extended to them, and they were slaughtered by our troops. At the same time, some couriers, sent from Corduba to Pompey, entering our camp by mistake, were seized, had their hands cut off, and then were dismissed. About nine at night, the besieged, according to custom, spent a considerable time in casting fire and darts upon our soldiers, and wounded a great number of men. At day-break they sallied upon the sixth legion, while we were busy at the works, and began a sharp contest, in which, however, our men got the better, though the besieged had the advantage of the higher ground. Those who had begun the attack, being vigorously opposed on our side, notwithstanding all the inconveniences we fought under, were at length obliged to retire into the town, with many wounds.
[13] On the next day Pompey began a line from the camp to the river Rio Salado; and a small party of our horse, being attacked by a much larger body of the enemy, were driven from their post, and three of their number slain. On the same day, A. Valgius, the son of a senator, whose brother was in Pompey's camp, mounted his horse and went over to the enemy, leaving all his baggage behind him. A spy, belonging to Pompey's second legion, was taken and slain. At the same time, a bullet was shot into the town, with this inscription: "That he should set up a shield on whatever day they advanced to storm the town." This encouraging some to hope that they might scale the walls, and possess themselves of the town without danger, they fell the next day to sapping them, and threw down a considerable part of the outward wall. * * In this action, being captured and protected by the townsmen, as if they had been of their own party, they requested Caesar to dismiss in armor even those who were appointed over the city by Pompey to guard it. To this Caesar answered, "That it was his custom to give, not accept of conditions:" which being reported to the garrison, they set up a shout, and began to pour their darts upon our men from the whole circuit of the wall; which gave reason to believe that the garrison intended that day to make a vigorous sally. Wherefore, surrounding the town with our troops, the conflict was for some time maintained with great violence, and one of our engines threw down a tower belonging to the enemy, in which were five of their men, and a boy, whose office it was to observe the engine.
[14] After this Pompey erected a fort on the other side of the Rio Salado, in which he met with no interruption from our men, and exulted not a little in the idea of having possessed himself of a post so near us. Also the following day, extending himself in like manner still further, he came up with our out-post of cavalry; and charging them briskly, obliged several squadrons and the light-armed foot to give ground: many of whom, owing to the smallness of their numbers and their light armor, were trodden down by the enemy's horse. This passed within view of both camps, and not a little animated the Pompeians, to see our men pushed so far: but the latter, being afterward reinforced by a party from our camp, faced about with the intention of renewing the fight.
[15] It invariably happens in encounters of cavalry that when the troopers dismount to charge the infantry, the match proves unequal, as happened on the present occasion. For a select body of the enemy's light-armed foot, coming unexpectedly upon our horse, they alighted to sustain the charge. Thus in a very little time, from a cavalry it became an infantry engagement, and again from an infantry changed to a cavalry engagement, in which our men were driven back to their very lines; but being there reinforced, about a hundred and twenty-three of the enemy were slain, several forced to throw down their arms, many wounded, and the rest pursued quite to their camp. On our side, three were slain, besides twelve foot-soldiers and five troopers wounded. Toward the evening of the same day, the fight, as usual, was renewed before the walls: and the enemy having thrown many darts, and a great quantity of fire from the battlements, proceeded afterward to an action of unexampled cruelty and barbarity: for in the very sight of our troops they fell to murdering the citizens, and tumbling them headlong from the walls, as is usual among barbarians: no parallel to this is to be found in the memory of man.
[16] When night came on, Pompey sent a messenger unknown to us, to exhort the garrison to set fire to our towers and mound, and make a sally at midnight. Accordingly, having poured upon us a great quantity of darts and fire, and destroyed a considerable part of the rampart, they opened the gate which lay over against and within view of Pompey's camp, and sallied out with all their forces, carrying with them fascines to fill up the ditch; hooks and fire to destroy and reduce to ashes the barracks, which the soldiers had built mostly of reeds to defend them from the winter; and some silver and rich apparel to scatter among the tents, that while our men should be employed in securing the plunder, they might fight their way through and escape to Pompey; who, in expectation that they would be able to effect their design, had crossed the Rio Salado with his army, where he continued all night in order of battle, to favor their retreat. But though our men had no apprehension of this design, their valor enabled them to frustrate the attempt, and repulse the enemy with many wounds. They even made themselves masters of the spoil, their arms, and some prisoners, who were put to death next day. At the same time, a deserter from the town informed us that Junius, who was employed in the mine when the citizens were massacred, exclaimed that it was a cruel and barbarous action-"that they had never deserved such treatment at their hands-for that they had received them in their temples and their homes-that it was in violation of all hospitality." He added many things besides, which made such an impression upon the garrison that they desisted from the massacre.
[17] The next day, Tullius, a lieutenant-general, accompanied by C. Antonius of Lusitania, came to Caesar, and addressed him to this effect: "Would to Heaven I had been one of your soldiers rather than a follower of C. Pompey, and given those proofs of valor and constancy in obtaining victories for you, rather than in suffering for him. The only advantage we reap from following his banners are wretched applauses; being reduced to the condition of indigent citizens, and by the melancholy fate of our country ranked among its enemies; we, who having never shared with Pompey his good fortune, yet find ourselves involved in his disgrace; and after sustaining the attack of so many armed legions, employing ourselves day and night in the works of defense, exposed to the darts and swords of our fellow-citizens; vanquished, deserted by Pompey, and compelled to give way to the superior valor of your troops, find ourselves at last obliged to have recourse to your clemency, and implore that you will not show yourselves less placable to fellow-citizens, than you have so often been to foreign nations." "I shall," said Caesar, "prove myself the same to fellow-citizens, as I have been to conquered nations."
[18] The embassadors being dismissed, when Tiberius Tullius arrived at the gate of the town, and C. Antony did not follow him, he returned to the gate and laid hold of him, upon which drawing a poniard from his breast, he wounded him in the hand, and in this condition they both fled to Caesar. At the same time the standard-bearer of the first legion came over to our camp, and reported that the day when the skirmish happened between the horse, no less than thirty-five of his company fell; but it was not allowed to mention it in Pompey's camp, or so much as own the loss of one man. A slave, whose master was in Caesar's camp, and who had left his wife and son in the city, cut his master's throat, and deceiving the guards, escaped privately to Pompey's camp; whence by means of a bullet, on which he inscribed his intelligence, Caesar was informed of the preparations made for the defense of the place. When we had read the inscription, those who were employed to throw the bullet returning to the city, two Lusitanian brothers deserted, and informed us that Pompey in a speech made to his soldiers, had said: "That as he found it impossible to relieve the town, he was resolved to withdraw in the night from the sight of the enemy, and retire toward the sea;" to which one answered "that it was better to hazard a battle than take refuge in flight," but he who said so was instantly put to death. At the same time some of his couriers were intercepted, who were endeavoring to get into the town. Caesar sent the letters to the inhabitants, and ordered one of the messengers begging his life, to set fire to the townsmen's wooden turret, promising that if he did this he would grant him all. The enterprise was not without difficulty: he undertook it, however, but was slain in the attempt. The same night a deserter informed us that Pompey and Labienus were greatly offended at the massacre of the citizens.
[19] About nine at night, one of our wooden towers, which had been severely battered by the enemy's engines, gave way as far as the third story. A sharp encounter ensued under the walls, and the besieged, assisted by a favorable wind, burned the remaining part of that tower and another. Next morning a matron threw herself from the wall, and came over to the camp, reporting, "that the rest of her family had intended the same, but were apprehended and put to death;" likewise, a letter was thrown over, in which was written" L. Minatius to Caesar; Pompey has abandoned me; if you will grant me my life, I promise to serve you with the same fidelity and attachment I have hitherto manifested toward him." At the same time deputies who had been sent before to Caesar by the garrison, now waited on him a second time, offering to deliver up the town next day, upon a bare grant of their lives: to which he replied, "That he was Caesar, and would perform his word." Thus, having made himself master of the place, on the nineteenth of February he was saluted imperator.
[20] Pompey, being informed by some deserters that the town had surrendered, removed his camp toward Ucubis, where he began to build redoubts, and secure himself with lines. Caesar also decamped and drew near him. At the same time a Spanish legionary soldier deserting to our camp, informed us that Pompey had assembled the people of Ucubis, and given them instructions to inquire diligently who favored his party, who that of the enemy. Some time after in the town which was taken, the slave, who, as we have related above, had murdered his master, was apprehended in a mine and burned alive. About the same time eight Spanish centurions came over to Caesar, and in a skirmish between our cavalry and that of the enemy, we were repulsed, and some of our light-armed foot wounded. The same night we took of the enemy's spies, three slaves and one Spanish soldier. The slaves were crucified, and the soldier was beheaded.
[21] The day following, some of the enemy's cavalry and light-armed infantry deserted to us; and about eleven of their horse falling upon a party of our men that were sent to fetch water, killed some and took others prisoners; among which last were eight troopers. On the next day Pompey beheaded seventy-four persons supposed to be favorers of Caesar's cause, ordering the rest who lay under the same suspicion to be carried back to the town, of whom a hundred and twenty escaped to Caesar.
"caes.spain.22": [22] Some time after, the deputies from Bursavola (whom Caesar had taken prisoners at Ategua, and sent along with his own embassadors to their city, to inform them of the massacre of the Ateguans, and what they had to apprehend from Pompey, who suffered his soldiers to murder their hosts, and commit all manner of crimes with impunity), arriving in the town, none of our deputies, except such as were natives of the place, durst enter the city, though they were all Roman knights and senators. But after many messages backward and forward, when the deputies were upon their return, the garrison pursued and put them all to the sword, except two who escaped to Caesar, and informed him of what had happened. Some time after, the inhabitants of Bursavola, sending spies to Ategua to know the truth of what had happened, and finding the report of our deputies confirmed, were for stoning to death him who had been the cause of the murder of the deputies, and were with difficulty restrained from laying violent hands upon him, which in the end proved the occasion of their own destruction. For having obtained leave of the inhabitants to go in person to Caesar and justify himself, he privately drew together some troops, and when he thought himself strong enough, returned in the night, and was treacherously admitted into the town, where he made a dreadful massacre of the inhabitants, slew all the leaders of the opposite party, and reduced the place to subjection. Soon after, some slaves who had deserted informed us that he had sold all the goods of the citizens, and that Pompey suffered none of his soldiers to quit the camp but unarmed, because, since the taking of Ategua, many despairing of success fled into Baeturia, having given over all expectation of victory; and that if any deserted from our camp, they were put among the light-armed infantry, whose pay was only sixteen asses a day.
[23] The day following Caesar removed his camp nearer to Pompey's, and began to draw a line to the river Salado. While our men were employed in the work, some of the enemy fell upon us from the higher ground, and as we were in no condition to make resistance, wounded great numbers. Here, as Ennius says, "our men retreated a little." This occurrence, so contrary to our usual custom, being perceived, two centurions of the fifth legion passed the river, and restored the battle; when, pressing upon the enemy with astonishing bravery, one of them fell overwhelmed by the multitude of darts discharged from above. The other continued the combat for some time, but seeing himself in danger of being surrounded, endeavored to make good his retreat, but stumbled and fell. His death being known, the enemy crowded together in still greater numbers, upon which our cavalry passed the river, and drove them back to their intrenchments; so that, while they too eagerly desired to slay them within their lines, they were surrounded by the cavalry and light-armed troops. Many of these would have been captured alive, had not their valor been pre-eminent, for they were so confined by the space included in the fortress, that the cavalry could not well defend itself. Many of our men were wounded in these two encounters, and among the rest Clodius Aquitius, but as the fight was carried on mostly from a distance, none of our men fell, except the two centurions who sacrificed themselves in the cause of glory.
[24] Next day both parties withdrawing from Soricaria, we continued our works. But Pompey, observing that our fort had cut off his communication with Aspavia, which is about five miles distant from Ucubis, judged it necessary to come to a battle. Yet he did not offer it upon equal terms, but chose to draw up his men upon a hill, that he might have the advantage of the higher ground. In this respect, when both parties were seeking the superior position, our men anticipating them, drove them into the plain, which gave us the advantage. The enemy yielded on all hands, and we made immense havoc among them. The mountain and not their valor protected them; of which advantage, and of all relief, our men, though few in number, would have deprived them had not night intervened. Three hundred and twenty-four light-armed foot, and about a hundred and thirty-eight legionary soldiers of their number fell, besides those whose armor and spoils we carried off. Thus the death of the two centurions, which happened the day before, was fully revenged.
[25] The day after, Pompey's cavalry advanced, according to their usual custom, to our lines; for they only dared venture to draw up on equal ground. They therefore began to skirmish with our men who were at work, the legionaries calling out to us at the same time to choose our field of battle, with a view to make us believe that they desired nothing so much as to come to blows; upon this our men quitted the eminence where they were encamped, and advanced a great way into the plain. But none of the enemy had the boldness to present themselves, excepting Antistius Turpio; who, presuming on his strength, and fancying no one on our side a match for him, offered us defiance. Upon this, as is recorded of Memnon and Achilles, Q. Pompeius Niger, a Roman knight, born in Italy, advanced from our ranks to the encounter. The fierce air of Antistius having engaged the attention of all, the two armies drew up to be spectators of the issue of this challenge, and expressed as much impatience as if the whole fortune of the war had depended upon it. The wishes on both sides for success were equal to the anxiety and concern each felt for his own combatant. They advanced into the plain with great courage, having each a resplendent buckler of curious workmanship. And doubtless the combat would have been soon decided, had not some light-armed foot drawn up near the lines, to serve as a guard to the camp because of the approach of the enemy's horse, which we have before alluded to. * * * Our horse, in retreating to their camp, being warmly pursued by the enemy, suddenly faced about with great cries; which so terrified the Pompeians, that they immediately betook themselves to flight, and retreated to their camp with the loss of many of their men.
[26] Caesar, to reward the valor of the Cassian troop, presented them with thirteen thousand sesterces, distributed ten thousand more among the light-armed foot, and gave to the commander of the cavalry five golden collars. The same day, A. Bebius, C. Flavius, and A. Trebellius, Roman knights of Asta, with their horses richly caparisoned and adorned with silver, came over to Caesar, and informed him, that all the rest of the Roman knights in Pompey's camp, had like them conspired to come and join him, that, on the information of a slave they had all been seized and cast into custody; that out of this number they only had escaped. The same day letters were intercepted, sent by Pompey to Ursao, with the usual greeting, and stating, "That hitherto he had all the success against the enemy he could desire, and would have ended the war much sooner than was expected, could he have brought them to engage him upon equal terms; that he did not think it advisable to venture new-levied troops on a plain; that the enemy, depending on our supplies, as yet protract the war for they storm city after city, thence supplying themselves with provisions: that he would therefore endeavor to protect the towns of his party, and bring the war to as speedy an issue as possible: that he would send them a reinforcement of some cohorts, and that having deprived them of provisions he would necessitate the enemy to come to an engagement.
[27] Some time after, as our men were carelessly dispersed about the works, a few horse were killed, who had gone to a grove of olives to fetch wood. Several slave deserted at this time, and informed us that ever since the action at Soritia on the 7th of March, the enemy had been under continual alarms, and appointed Attius Varus to guard the lines. The same day Pompey decamped, and posted himself in an olive-wood over against Hispalis. Caesar, before he removed, waited till midnight, when the moon began to appear. At his departure he ordered them to set fire to the fort of Ucubis, which Pompey had abandoned, and to assemble in the greater camp. He afterward laid siege to Ventisponte, which surrendered; and marching thence to Carruca, encamped over against Pompey, who had burned the city, because the garrison refused to open the gates to him. A soldier who had murdered his brother in the camp, being intercepted by our men, was scourged to death. Caesar, still pursuing his march, arrived in the plains of Munda, and pitched his camp opposite to that of Pompey.
[28] Next day as Caesar was preparing to set out with the army, notice was sent him by his spies, that Pompey had been in order of battle ever since midnight. Upon this intelligence he ordered the standard to be raised. Pompey had taken this resolution in consequence of his letter to the inhabitants of Ursao, who were his firm adherents, in which he told them that Caesar refused to come down into the plain, because his army consisted mostly of new-levied troops. This had greatly confirmed the city in its allegiance. Thus relying on this opinion, he thought that he could effect the whole, for he was defended by the nature of his situation, and by the position for defense of the town, where he had his camp: for, as we observed before, this country is full of hills which run in a continued chain, without any plains intervening.
[29] But we must by no means omit to mention an accident which happened about this time. The two camps were divided from one another by a plain about five miles in extent, so that Pompey, in consequence of the town's elevated position, and the nature of the country, enjoyed a double defense. Across this valley ran a rivulet, which rendered the approach to the mountain extremely difficult, because it formed a deep morass on the right. Caesar had no doubt that the enemy would descend into the plain and come to a battle, when he saw them in array. This appeared evident to all; the rather because the plain would give their cavalry full room to act, and the day was so serene and clear that the gods seemed to have sent it on purpose to favor the engagement. Our men rejoiced at the favorable opportunity: some however were not altogether exempt from fear when they considered that their all was at stake, with the uncertainty of what might be their fate an hour after. He advanced however to the field of battle, fully persuaded that the enemy would do the same; but they durst not venture above a mile from the town, being determined to shelter themselves under its walls. Our men still continued before them in order of battle; but although the equality of the ground sometimes tempted them to come and dispute the victory, they nevertheless still kept their post on the mountain, in the neighborhood of the town. We doubled our speed to reach the rivulet, without their stirring from the place where they stood.
[30] Their army consisted of thirteen legions; the cavalry was drawn up upon the wings, with six thousand light-armed infantry and about the same number of auxiliaries. We had only eighty heavy-armed cohorts, and eight thousand horse. When we reached the extremity of the plain, the real seat of disadvantage, the enemy were awaiting us above, so that it would have been exceedingly dangerous to proceed. When Caesar perceived this, he pointed out the locality, lest any disagreeable occurrence should result from the temerity of his troops. The army murmured greatly, as if they had been kept back from a certain victory, when this was told them. The delay, however, served to enliven the enemy, thinking that Caesar's troops shrank from an encounter through fear: they therefore had the boldness to advance a little way, yet without quitting the advantage of their post, the approach to which was extremely dangerous. The tenth legion, as usual, was on the right, the third and fifth on the left, with the auxiliary troops and cavalry. The battle began with a shout.
[31] But though our men were superior to the enemy in courage, the latter nevertheless defended themselves so well by the advantage of the higher ground, and the shouts were so loud, and the discharge of darts on both sides so great, that we almost began to despair of victory. For the first onset and shout, by which an enemy is most apt to be dismayed, were pretty equal in the present encounter. All fought with equal valor; the place was covered with arrows and darts, and great numbers of the enemy fell. We have already observed that the tenth legion was on the right, which, though not considerable for the number of men, was nevertheless formidable for its courage; and so pressed the enemy on that side that they were obliged to draw a legion from the right wing to reinforce the left, lest we should come upon their flank; but they fought so bravely that the reinforcement could not find an opportunity of entering the ranks. Upon this motion, our cavalry on the left fell upon Pompey's right wing. Meanwhile the clashing of armor mingled with the shouts of combatants, and the groans of the dying and the wounded, terrified the new-raised soldiers. On this occasion, as Ennius says, "they fought hand to hand, foot to foot, and shield to shield;" but though the enemy fought with the utmost vigor, they were obliged to give ground, and retire toward the town. The battle was fought on the feast of Bacchus, and the Pompeians were entirely routed and put to flight; insomuch that not a man could have escaped, had they not sheltered themselves in the place whence they advanced to the charge. The enemy lost on this occasion upward of thirty thousand men, and among the rest Labienus and Attius Varus, whose funeral obsequies were performed upon the field of battle. They had likewise three thousand Roman knights killed, partly Italian, partly provincial. About a thousand were slain on our side, partly foot, partly horse; and five hundred wounded. We gained thirteen eagles, and several standards, and emblems of authority, and made seventeen officers prisoners. Such was the issue of this action.
[32] The remains of Pompey's army retreating to Munda, with the intention of defending themselves in that town, it became necessary to invest it. The dead bodies of the enemy, heaped together, served as a rampart, and their javelins and darts were fixed up by way of palisades. Upon these we hung their bucklers to supply the place of a breastwork, and fixing the heads of the deceased upon swords and lances, planted them all around the works, to strike the greater terror into the besieged, and keep awake in them a sense of our prowess. Amid these mournful objects did they find themselves shut in, when our men began the attack, which was conducted chiefly by the Gauls. Young Valerius, who had escaped to Corduba with some horse, informed Sextus Pompey of what had happened; who, upon receipt of the mournful news, distributing what money he had about him to the troopers, left the town about nine at night, under pretense of going to find out Caesar, to treat of an accommodation. On the other side, Cn. Pompey, attended by a few horse and foot, took the road to Carteia, where his fleet lay, and which was about a hundred and seventy miles distant from Corduba. When he was arrived within eight miles of the place, he sent P. Calvitius his camp-marshal before, to procure a litter to carry him to the town, as he found himself unwell. The litter came, and when he entered the town, those of his party waited on him privately, to receive his orders about the management of the war. As they assembled round the place in great crowds, Pompey quitting his litter put himself under their protection.
[33] After the encounter, Caesar seeing the circumvallation of Munda completed, marched to Corduba. Those of the enemy who had escaped the slaughter, possessing themselves of a bridge, upon the approach of our men, called out to them with an air of derision- "What! we who are no more than a handful of men escaped from the battle, shall we be allowed no place of retreat?" They immediately prepared to defend the bridge. Caesar passed the river and encamped. Scapula, who had stirred up the freedmen to a revolt, escaping after the battle to Corduba, when he found himself besieged, assembled all his followers, ordered a funeral pile to be erected and a magnificent supper served up; when, putting on his richest dress, he distributed his plate and money among his domestics, supped cheerfully, anointed himself several times, and, last of all, ordered one of his freedmen to dispatch him, and another to set fire to the pile.
[34] Caesar had no sooner encamped before the place than a division arose among the inhabitants, between the parties of Caesar and Pompey, till the dispute almost reached to our camps. During the contest, some legions, composed partly of deserters, partly of slaves made free by Pompey, came and surrendered themselves to Caesar. But the thirteenth legion prepared to defend the town, and with that view possessed themselves of the walls and some towers, in spite of all opposition, which obliged the other party to send deputies to Caesar for aid. Upon this those who had escaped out of the battle set fire to the place, and our men entering at the same time, slew about twenty-two thousand of them, besides those who were slain without the walls; thus Caesar obtained the town. While he was employed in this siege, those who, as we have said, were blockaded at Munda made a sally, but were driven back into the town with considerable loss.
[35] Thence Caesar marched to Hispalis, which sent deputies to sue for pardon. Though the citizens assured him that they were able to defend the town, he sent Caninius his lieutenant thither with some troops, and encamped before the place. There was in the town a strong party of Pompeians, who, displeased to see Caesar's troops received within the walls, secretly deputed one Philo, a zealous partisan of Pompey, and well known in Lusitania, to beg assistance of Cecilius Niger, one of the barbarians, who lay encamped near Lenius, with a strong army of Lusitanians. He is received into the town of Hispalis by night, surprises the sentinels and garrison, shuts the gates, and begins to defend the place.
[36] During these transactions deputies arrived from Carteia, with accounts of their having secured Pompey; hoping by this service to atone for their former fault of shutting their gates against Caesar. Meantime, the Lusitanians in Hispalis plundered the town, which, though known to Caesar, did not yet determine him to press it too hard, lest they should in despair set fire to it, and destroy the walls. It was resolved in council to suffer the Lusitanians to escape in the night by a sally, yet so that the thing might not appear designed. In this sally, they set fire to the ships that were in the river Guadalquivir, and while our men were employed in extinguishing the flames, endeavored to get off; but being overtaken by the cavalry, were mostly cut to pieces. Thence Caesar marched to Asta, which submitted. Munda having been now a long while besieged, many of those who had escaped out of the battle, despairing of safety, surrendered to us; and being formed into a legion, conspired among themselves, that upon a signal being given, the garrison should sally out in the night, while they at the same time should begin a massacre in the camp. But the plot being discovered, they were next night, at the changing of the third watch, all put to death outside the rampart.
[37] The Carteians, while Caesar was employed in reducing the other towns upon his route, began to disagree about young Pompey. One party had sent the deputies to Caesar, and another was in the Pompeian interest. These last prevailing, seized the gates, and made a dreadful slaughter of their adversaries. Pompey himself was wounded in the fray, but escaping to his ships, fled with about twenty galleys. Didius, who was at Gades with Caesar's fleet, hearing of what had happened, immediately sailed in pursuit of them; stationing at the same time some cavalry and infantry along the coast, to prevent his escaping by land. Pompey had left Carteia with so much precipitation, that he took no time to furnish himself with water, and this circumstance obliging him to stop by the way, Didius came up with him after four days' sailing, took some of his ships, and burned the rest.
[38] With a few friends, Pompey escaped to a place strongly fortified by nature; of which the troops sent in pursuit of him having certain intelligence by their scouts, followed day and night. He was wounded in the shoulder and left leg, and had besides sprained his ankle, all which greatly retarded his flight, and obliged him to make use of a litter. A Lusitanian having discovered the place of his retreat, he was quickly surrounded by our cavalry and cohorts. Seeing himself betrayed, he took refuge in a post fortified by nature, and which could easily be defended by a few men, the approach to it being extremely difficult. We attempted to storm it, but were repulsed, and pursued by the enemy; and meeting with no better success after several trials, we at length resolved to lay siege to the place, it seeming too hazardous to force it. Accordingly, a terrace was raised, and lines drawn round the place; which the enemy perceiving, thought it best to betake themselves to flight.
[39] Pompey as we have observed above being lame and wounded, was in no condition to make a speedy retreat; and the rather, because the place was such that he could use neither horse nor litter.  In this extremity he fled to a cave, where he could not easily be discovered, unless by the information of the captives. Here he was slain, his head was brought to Hispalis on the day before the ides of April, and exhibited before the people when Caesar was at Gades.
[40] After the death of young Pompey, Didius, proud of his success, retired to the nearest fortress and hauled some of his vessels on shore to be refitted. The Lusitanians, who had escaped from the battle, rallying in great bodies, advanced to Didius. Though the preservation of the fleet principally engaged his attention, he was obliged to leave his fort in order to restrain the frequent sallies of the enemy. These daily skirmishes gave them an opportunity of projecting an ambuscade; for which purpose they divided their troops into three bodies. Some were prepared to set fire to the fleet, and in the mean time others were to come to their relief. These were so arranged that they could advance to the battle without any one seeing them. Didius sallied out according to custom; when upon a signal being given, one of the parties advanced to set fire to the fleet; and another, counterfeiting a retreat, drew him insensibly into the ambuscade, where he was surrounded and slain with most of his followers, fighting valiantly. Some escaped in boats which they found upon the coast; others endeavored to reach the galleys by swimming; and, weighing anchor, stood out to sea. A great many saved themselves in this manner, but the Lusitanians got all the baggage. Caesar meanwhile returned from Gades to Hispalis.
[41] Fabius Maximus, whom he had left to continue the siege of Munda, conducted it with great zeal; so that the enemy, seeing themselves shut up on all sides, sallied out, but were repulsed with great loss. Our men seized this opportunity to get possession of the town, and took the rest prisoners, in number about fourteen thousand. Thence they retreated toward Ursao, a town exceedingly strong both by nature and art, and capable of resisting an enemy. Besides, there is not, within eight miles of the place any spring but that which supplies the town, which was a decided advantage to the besieged. In addition to all this, the wood necessary for building towers and other machines had to be fetched from a distance of six miles. And Pompey, to render the siege more difficult, had cut down all the timber round the place, and collected it within the walls, which obliged our men to bring all the materials for carrying on the siege from Munda, the nearest town which they had subdued.
[42] During these transactions at Munda and Ursao, Caesar, who had returned from Gades to Hispalis, assembled the citizens, and made the following speech: "That when he was advanced to the quaestorship, he had chosen their province in preference to all others, and during his continuance in that office, had done them every service in his power; that during his praetorship he had obtained for them from the senate the abolition of the taxes imposed by Metellus, declared himself their patron, procured their deputies a hearing at Rome, and made himself many enemies by undertaking the defense both of their private and public rights. In fine, that when he was consul, he had, though absent, rendered the province all the services in his power; that instead of making a suitable return for so many favors, they had always discovered the utmost ingratitude both toward him and the people of Rome; as well in this last war as the preceding. "You," says he, "though no strangers to the law of nations and the rights of Roman citizens, have yet like barbarians often violated the sacred persons of Roman magistrates. You attempted in open day, in the public square, to assassinate Cassius. You have been always such enemies to peace that the senate could never suffer the province to be without legions. You take favors for offenses, and insults for benefits, are insolent and restless in peace, and cowardly and effeminate in war. Young Pompey, though only a private citizen, nay a fugitive, was yet received among you, and suffered to assume the ensigns of magistracy. After putting many citizens to death, you still furnished him with forces, and even urged him to lay waste the country and province. Against whom do you hope to be victorious? Can you be ignorant that even if I should be destroyed, the people of Rome have still ten legions, capable not only of opposing you, but even of pulling down heaven? With whose praises and virtues ...
NOTE: The end of the book is lost