Flux

class Flux(flux=0.0)[source]

Bases: object

The Flux class implements a concept of a flux in Janskys.

This version adapted from the c++ and java implementations, originally authored by Allen Farris.

Methods Summary

almostEquals(otherFlux, toleranceFlux)

Return True if and only if otherFlux and toleranceFlux are both Flux instances are if the absolute value of the difference between this and otherFlux is less than the absolute value of toleranceFlux.

compareTo(otherFlux)

Compare this Flux to the specified otherFlux, which must be a Flux, returning -1, 0, or +1 if this flux is less than, equal to, or greater than the specified other Flux.

divide(a, factor)

Return a new Flux that is a specified flux divided by a specified factor, a / factor.

equals(otherFlux)

Return True if and only if the specified other flux is a Flux and its value is equal to this flux.

from1DBin(eis)

Read a list of binary Flux values, in Janskys, from an EndianInput instance and return the resulting list.

from2DBin(eis)

Read a 2D list of binary Flux values, in Janskys, from an EndianInput instance and return the resulting list.

from3DBin(eis)

Read a 3D list of binary Flux values, in Janskys, from an EndianInput instance and return the resulting list.

fromBin(eis)

Read the binary representation of an Flux, in Janskys, from an EndianInput instance and use the read value to set a Flux.

get()

Return the value of this flux as a double in Janskys.

getInstance(stringList)

Retrieve a value from a list of strings and convert that to a Flux.

isZero()

Return True if and only if this flux is zero (0.0).

listTo1DBin(fluxList, eos)

Write a 1D list of Flux to the EndianOutput

listTo2DBin(fluxList, eos)

Write a 2D list of Flux to the EndianOutput

listTo3DBin(fluxList, eos)

Write a 3D list of Flux to the EndianOutput

listToBin(fluxList, eos)

Write a list of Flux to the EndianOutput.

multiply(a, factor)

Return a new Flux that is the product of a specified flux and some specified factor, a * factor.

set(flux)

Set the value of this flux to the specified flux in Janskys.

subtract(a, b)

Return a new Flux that is the difference of the specified Janskys, a - b.

sum(a, b)

Return a new Flux that is the sum of the specified Janskys, a + b.

toBin(eos)

Write this Flux out, in Janskys, to a EndianOutput.

values(items)

return a list of floats containing the value of the list of Flux objects passed in the items argument.

Methods Documentation

almostEquals(otherFlux, toleranceFlux)[source]

Return True if and only if otherFlux and toleranceFlux are both Flux instances are if the absolute value of the difference between this and otherFlux is less than the absolute value of toleranceFlux.

compareTo(otherFlux)[source]

Compare this Flux to the specified otherFlux, which must be a Flux, returning -1, 0, or +1 if this flux is less than, equal to, or greater than the specified other Flux.

static divide(a, factor)[source]

Return a new Flux that is a specified flux divided by a specified factor, a / factor. param a The base flux param factor The factor that is used to divide the value. return A new Flux that is the product of a specified flux and some specified factor, a / factor.

equals(otherFlux)[source]

Return True if and only if the specified other flux is a Flux and its value is equal to this flux. param otherFlux The other flux to which this flux is being compared. return True if and only if the specified other flux is an Flux and its value is equal to this flux.

static from1DBin(eis)[source]

Read a list of binary Flux values, in Janskys, from an EndianInput instance and return the resulting list.

static from2DBin(eis)[source]

Read a 2D list of binary Flux values, in Janskys, from an EndianInput instance and return the resulting list.

static from3DBin(eis)[source]

Read a 3D list of binary Flux values, in Janskys, from an EndianInput instance and return the resulting list.

static fromBin(eis)[source]

Read the binary representation of an Flux, in Janskys, from an EndianInput instance and use the read value to set a Flux.

return a Flux

get()[source]

Return the value of this flux as a double in Janskys.

static getInstance(stringList)[source]

Retrieve a value from a list of strings and convert that to a Flux.

This is used when parsing Flux lists from an XML representation to eventually construct a list of Flux instances. The string values are float representation of flux in Janskys.

Returns a tuple of (Flux, stringList) where Flux is the new Flux created by this call and stringList is the remaining, unused, part of stringList after removing the first element.

isZero()[source]

Return True if and only if this flux is zero (0.0).

static listTo1DBin(fluxList, eos)[source]

Write a 1D list of Flux to the EndianOutput

static listTo2DBin(fluxList, eos)[source]

Write a 2D list of Flux to the EndianOutput

static listTo3DBin(fluxList, eos)[source]

Write a 3D list of Flux to the EndianOutput

static listToBin(fluxList, eos)[source]

Write a list of Flux to the EndianOutput. The list may have 1, 2 or 3 dimensions.

static multiply(a, factor)[source]

Return a new Flux that is the product of a specified flux and some specified factor, a * factor. param a The base flux param factor The factor that is used to multiply the value. return A new Flux that is the product of a specified flux and some specified factor, a * factor.

set(flux)[source]

Set the value of this flux to the specified flux in Janskys. Any flux is valid so long as it can be converted into a float using float(flux) (including a parseable string).

static subtract(a, b)[source]

Return a new Flux that is the difference of the specified Janskys, a - b. param a The first Flux of the pair. param b The second Flux of the pair. return A new Flux that is the difference of the specified Janskys, a - b.

static sum(a, b)[source]

Return a new Flux that is the sum of the specified Janskys, a + b. param a The first Flux of the pair. param b The second Flux of the pair. return A new Flux that is the sum of the specified Janskys, a + b.

toBin(eos)[source]

Write this Flux out, in Janskys, to a EndianOutput.

static values(items)[source]

return a list of floats containing the value of the list of Flux objects passed in the items argument. items may also be a list of lists(2D array) of Flux objects. If the first item is a list then this method assumes that items is a list of lists and the return value is a list of lists of floats. The list of lists case is done by calling this method recursively and so it should work for higher orders of lists of lists. That use case is not tested.