hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a9f8180423b62c16e81cdec36540d5393e5edd35 | ska-telescope/algorithm-reference-library | deprecated_code/workflows/mpi/imaging/imaging_mpi.py | [
"Apache-2.0"
] | Python | predict_list_mpi_workflow | <not_specific> | def predict_list_mpi_workflow(vis_list, model_imagelist, context, vis_slices=1, facets=1,
gcfcf=None, comm=MPI.COMM_WORLD, **kwargs):
"""Predict, iterating over both the scattered vis_list and image
The visibility and image are scattered, the visibility is predicted on ... | Predict, iterating over both the scattered vis_list and image
The visibility and image are scattered, the visibility is predicted on each part, and then the
parts are assembled. About data distribution: vis_list and model_imagelist
live in rank 0; vis_slices, facets, context are replicated in all nodes... | Predict, iterating over both the scattered vis_list and image
The visibility and image are scattered, the visibility is predicted on each part, and then the
parts are assembled. About data distribution: vis_list and model_imagelist
live in rank 0; vis_slices, facets, context are replicated in all nodes.
gcfcf if exists... | [
"Predict",
"iterating",
"over",
"both",
"the",
"scattered",
"vis_list",
"and",
"image",
"The",
"visibility",
"and",
"image",
"are",
"scattered",
"the",
"visibility",
"is",
"predicted",
"on",
"each",
"part",
"and",
"then",
"the",
"parts",
"are",
"assembled",
".... | def predict_list_mpi_workflow(vis_list, model_imagelist, context, vis_slices=1, facets=1,
gcfcf=None, comm=MPI.COMM_WORLD, **kwargs):
rank = comm.Get_rank()
size = comm.Get_size()
log.info('%d: In predict_list_mpi_workflow: %d elements in vis_list' % (rank,len(vis_list))... | [
"def",
"predict_list_mpi_workflow",
"(",
"vis_list",
",",
"model_imagelist",
",",
"context",
",",
"vis_slices",
"=",
"1",
",",
"facets",
"=",
"1",
",",
"gcfcf",
"=",
"None",
",",
"comm",
"=",
"MPI",
".",
"COMM_WORLD",
",",
"**",
"kwargs",
")",
":",
"rank... | Predict, iterating over both the scattered vis_list and image
The visibility and image are scattered, the visibility is predicted on each part, and then the
parts are assembled. | [
"Predict",
"iterating",
"over",
"both",
"the",
"scattered",
"vis_list",
"and",
"image",
"The",
"visibility",
"and",
"image",
"are",
"scattered",
"the",
"visibility",
"is",
"predicted",
"on",
"each",
"part",
"and",
"then",
"the",
"parts",
"are",
"assembled",
".... | [
"\"\"\"Predict, iterating over both the scattered vis_list and image\n \n The visibility and image are scattered, the visibility is predicted on each part, and then the\n parts are assembled. About data distribution: vis_list and model_imagelist\n live in rank 0; vis_slices, facets, context are replicat... | [
{
"param": "vis_list",
"type": null
},
{
"param": "model_imagelist",
"type": null
},
{
"param": "context",
"type": null
},
{
"param": "vis_slices",
"type": null
},
{
"param": "facets",
"type": null
},
{
"param": "gcfcf",
"type": null
},
{
"... | {
"returns": [
{
"docstring": "List of vis_lists",
"docstring_tokens": [
"List",
"of",
"vis_lists"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis_list",
"type": null,
"docstring": null,
"docstring_tokens": [... |
a9f8180423b62c16e81cdec36540d5393e5edd35 | ska-telescope/algorithm-reference-library | deprecated_code/workflows/mpi/imaging/imaging_mpi.py | [
"Apache-2.0"
] | Python | invert_list_mpi_workflow | <not_specific> | def invert_list_mpi_workflow(vis_list, template_model_imagelist, context, dopsf=False, normalize=True,
facets=1, vis_slices=1, gcfcf=None,
comm=MPI.COMM_WORLD, **kwargs):
""" Sum results from invert, iterating over the scattered image and vis_list... | Sum results from invert, iterating over the scattered image and vis_list
:param vis_list: Only full for rank==0
:param template_model_imagelist: Model used to determine image parameters
(in rank=0)
:param dopsf: Make the PSF instead of the dirty image
:param facets: Number of facets
:param nor... | Sum results from invert, iterating over the scattered image and vis_list | [
"Sum",
"results",
"from",
"invert",
"iterating",
"over",
"the",
"scattered",
"image",
"and",
"vis_list"
] | def invert_list_mpi_workflow(vis_list, template_model_imagelist, context, dopsf=False, normalize=True,
facets=1, vis_slices=1, gcfcf=None,
comm=MPI.COMM_WORLD, **kwargs):
def concat_tuples(list_of_tuples):
if len(list_of_tuples)<2:
... | [
"def",
"invert_list_mpi_workflow",
"(",
"vis_list",
",",
"template_model_imagelist",
",",
"context",
",",
"dopsf",
"=",
"False",
",",
"normalize",
"=",
"True",
",",
"facets",
"=",
"1",
",",
"vis_slices",
"=",
"1",
",",
"gcfcf",
"=",
"None",
",",
"comm",
"=... | Sum results from invert, iterating over the scattered image and vis_list | [
"Sum",
"results",
"from",
"invert",
"iterating",
"over",
"the",
"scattered",
"image",
"and",
"vis_list"
] | [
"\"\"\" Sum results from invert, iterating over the scattered image and vis_list\n\n :param vis_list: Only full for rank==0\n :param template_model_imagelist: Model used to determine image parameters\n (in rank=0)\n :param dopsf: Make the PSF instead of the dirty image\n :param facets: Number of face... | [
{
"param": "vis_list",
"type": null
},
{
"param": "template_model_imagelist",
"type": null
},
{
"param": "context",
"type": null
},
{
"param": "dopsf",
"type": null
},
{
"param": "normalize",
"type": null
},
{
"param": "facets",
"type": null
},
... | {
"returns": [
{
"docstring": "List of (image, sumwt) tuple",
"docstring_tokens": [
"List",
"of",
"(",
"image",
"sumwt",
")",
"tuple"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis_list",
... |
a9f8180423b62c16e81cdec36540d5393e5edd35 | ska-telescope/algorithm-reference-library | deprecated_code/workflows/mpi/imaging/imaging_mpi.py | [
"Apache-2.0"
] | Python | residual_list_mpi_workflow | <not_specific> | def residual_list_mpi_workflow(vis, model_imagelist, context='2d', gcfcf=None,comm=MPI.COMM_WORLD, **kwargs):
""" Create a graph to calculate residual image using w stacking and faceting
:param context:
:param vis: rank0
:param model_imagelist: Model used to determine image parameters rank0
:param ... | Create a graph to calculate residual image using w stacking and faceting
:param context:
:param vis: rank0
:param model_imagelist: Model used to determine image parameters rank0
:param gcfcg: tuple containing grid correction and convolution function
:param kwargs: Parameters for functions in compo... | Create a graph to calculate residual image using w stacking and faceting | [
"Create",
"a",
"graph",
"to",
"calculate",
"residual",
"image",
"using",
"w",
"stacking",
"and",
"faceting"
] | def residual_list_mpi_workflow(vis, model_imagelist, context='2d', gcfcf=None,comm=MPI.COMM_WORLD, **kwargs):
rank = comm.Get_rank()
size = comm.Get_size()
model_vis = zero_list_mpi_workflow(vis)
log.info('%d: In residual_list_mpi_workflow vis len %d model_imagelist len %d model_vis len %d'
%(... | [
"def",
"residual_list_mpi_workflow",
"(",
"vis",
",",
"model_imagelist",
",",
"context",
"=",
"'2d'",
",",
"gcfcf",
"=",
"None",
",",
"comm",
"=",
"MPI",
".",
"COMM_WORLD",
",",
"**",
"kwargs",
")",
":",
"rank",
"=",
"comm",
".",
"Get_rank",
"(",
")",
... | Create a graph to calculate residual image using w stacking and faceting | [
"Create",
"a",
"graph",
"to",
"calculate",
"residual",
"image",
"using",
"w",
"stacking",
"and",
"faceting"
] | [
"\"\"\" Create a graph to calculate residual image using w stacking and faceting\n\n :param context:\n :param vis: rank0\n :param model_imagelist: Model used to determine image parameters rank0\n :param gcfcg: tuple containing grid correction and convolution function\n :param kwargs: Parameters for f... | [
{
"param": "vis",
"type": null
},
{
"param": "model_imagelist",
"type": null
},
{
"param": "context",
"type": null
},
{
"param": "gcfcf",
"type": null
},
{
"param": "comm",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"... |
a9f8180423b62c16e81cdec36540d5393e5edd35 | ska-telescope/algorithm-reference-library | deprecated_code/workflows/mpi/imaging/imaging_mpi.py | [
"Apache-2.0"
] | Python | restore_list_mpi_workflow | <not_specific> | def restore_list_mpi_workflow(model_imagelist, psf_imagelist,
residual_imagelist,comm=MPI.COMM_WORLD, **kwargs):
""" Create a graph to calculate the restored image
:param model_imagelist: Model list (rank0)
:param psf_imagelist: PSF list (rank0)
:param residual_imagelist: ... | Create a graph to calculate the restored image
:param model_imagelist: Model list (rank0)
:param psf_imagelist: PSF list (rank0)
:param residual_imagelist: Residual list (rank0)
:param kwargs: Parameters for functions in components
:return:
| Create a graph to calculate the restored image | [
"Create",
"a",
"graph",
"to",
"calculate",
"the",
"restored",
"image"
] | def restore_list_mpi_workflow(model_imagelist, psf_imagelist,
residual_imagelist,comm=MPI.COMM_WORLD, **kwargs):
from workflows.serial.imaging.imaging_serial import restore_list_serial_workflow_nosumwt
rank = comm.Get_rank()
size = comm.Get_size()
if residual_imagelist is N... | [
"def",
"restore_list_mpi_workflow",
"(",
"model_imagelist",
",",
"psf_imagelist",
",",
"residual_imagelist",
",",
"comm",
"=",
"MPI",
".",
"COMM_WORLD",
",",
"**",
"kwargs",
")",
":",
"from",
"workflows",
".",
"serial",
".",
"imaging",
".",
"imaging_serial",
"im... | Create a graph to calculate the restored image | [
"Create",
"a",
"graph",
"to",
"calculate",
"the",
"restored",
"image"
] | [
"\"\"\" Create a graph to calculate the restored image\n\n :param model_imagelist: Model list (rank0)\n :param psf_imagelist: PSF list (rank0)\n :param residual_imagelist: Residual list (rank0)\n :param kwargs: Parameters for functions in components\n :return:\n \"\"\"",
"#TODO Parallelize! and ... | [
{
"param": "model_imagelist",
"type": null
},
{
"param": "psf_imagelist",
"type": null
},
{
"param": "residual_imagelist",
"type": null
},
{
"param": "comm",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "model_imagelist",
"type": null,
"docstring": "Model list (rank0)",
"docstring_tokens": [
"Model",
"... |
a9f8180423b62c16e81cdec36540d5393e5edd35 | ska-telescope/algorithm-reference-library | deprecated_code/workflows/mpi/imaging/imaging_mpi.py | [
"Apache-2.0"
] | Python | deconvolve_list_mpi_workflow | <not_specific> | def deconvolve_list_mpi_workflow(dirty_list, psf_list, model_imagelist,
prefix='',
mask=None,comm=MPI.COMM_WORLD, **kwargs):
"""Create a graph for deconvolution, adding to the model
:param dirty_list: in rank0
:param psf_list: ... | Create a graph for deconvolution, adding to the model
:param dirty_list: in rank0
:param psf_list: in rank0
:param model_imagelist: in rank0
:param prefix: Informative prefix to log messages
:param mask: Mask for deconvolution
:param comm: MPI communicator
:param kwargs: Parameters for func... | Create a graph for deconvolution, adding to the model | [
"Create",
"a",
"graph",
"for",
"deconvolution",
"adding",
"to",
"the",
"model"
] | def deconvolve_list_mpi_workflow(dirty_list, psf_list, model_imagelist,
prefix='',
mask=None,comm=MPI.COMM_WORLD, **kwargs):
rank = comm.Get_rank()
size = comm.Get_size()
nchan = len(dirty_list)
log.info('%d: deconvolve_list... | [
"def",
"deconvolve_list_mpi_workflow",
"(",
"dirty_list",
",",
"psf_list",
",",
"model_imagelist",
",",
"prefix",
"=",
"''",
",",
"mask",
"=",
"None",
",",
"comm",
"=",
"MPI",
".",
"COMM_WORLD",
",",
"**",
"kwargs",
")",
":",
"rank",
"=",
"comm",
".",
"G... | Create a graph for deconvolution, adding to the model | [
"Create",
"a",
"graph",
"for",
"deconvolution",
"adding",
"to",
"the",
"model"
] | [
"\"\"\"Create a graph for deconvolution, adding to the model\n\n :param dirty_list: in rank0\n :param psf_list: in rank0\n :param model_imagelist: in rank0\n :param prefix: Informative prefix to log messages\n :param mask: Mask for deconvolution\n :param comm: MPI communicator\n :param kwargs: ... | [
{
"param": "dirty_list",
"type": null
},
{
"param": "psf_list",
"type": null
},
{
"param": "model_imagelist",
"type": null
},
{
"param": "prefix",
"type": null
},
{
"param": "mask",
"type": null
},
{
"param": "comm",
"type": null
}
] | {
"returns": [
{
"docstring": "graph for the deconvolution",
"docstring_tokens": [
"graph",
"for",
"the",
"deconvolution"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "dirty_list",
"type": null,
"docstring": ... |
a9f8180423b62c16e81cdec36540d5393e5edd35 | ska-telescope/algorithm-reference-library | deprecated_code/workflows/mpi/imaging/imaging_mpi.py | [
"Apache-2.0"
] | Python | deconvolve_list_channel_mpi_workflow | <not_specific> | def deconvolve_list_channel_mpi_workflow(dirty_list, psf_list, model_imagelist,
subimages, comm=MPI.COMM_WORLD,**kwargs):
"""Create a graph for deconvolution by channels, adding to the model
Does deconvolution channel by channel.
:param subimages: MONTSE: number of ... | Create a graph for deconvolution by channels, adding to the model
Does deconvolution channel by channel.
:param subimages: MONTSE: number of subimages (= freqchannels?)
:param dirty_list: in rank=0
:param psf_list: Must be the size of a facet in rank=0
:param model_imagelist: Current model in rank=... | Create a graph for deconvolution by channels, adding to the model
Does deconvolution channel by channel. | [
"Create",
"a",
"graph",
"for",
"deconvolution",
"by",
"channels",
"adding",
"to",
"the",
"model",
"Does",
"deconvolution",
"channel",
"by",
"channel",
"."
] | def deconvolve_list_channel_mpi_workflow(dirty_list, psf_list, model_imagelist,
subimages, comm=MPI.COMM_WORLD,**kwargs):
def deconvolve_subimage(dirty, psf):
assert isinstance(dirty, Image)
assert isinstance(psf, Image)
comp = deconvolve_cube(dirty, ... | [
"def",
"deconvolve_list_channel_mpi_workflow",
"(",
"dirty_list",
",",
"psf_list",
",",
"model_imagelist",
",",
"subimages",
",",
"comm",
"=",
"MPI",
".",
"COMM_WORLD",
",",
"**",
"kwargs",
")",
":",
"def",
"deconvolve_subimage",
"(",
"dirty",
",",
"psf",
")",
... | Create a graph for deconvolution by channels, adding to the model
Does deconvolution channel by channel. | [
"Create",
"a",
"graph",
"for",
"deconvolution",
"by",
"channels",
"adding",
"to",
"the",
"model",
"Does",
"deconvolution",
"channel",
"by",
"channel",
"."
] | [
"\"\"\"Create a graph for deconvolution by channels, adding to the model\n\n Does deconvolution channel by channel.\n :param subimages: MONTSE: number of subimages (= freqchannels?)\n :param dirty_list: in rank=0\n :param psf_list: Must be the size of a facet in rank=0\n :param model_imagelist: Curre... | [
{
"param": "dirty_list",
"type": null
},
{
"param": "psf_list",
"type": null
},
{
"param": "model_imagelist",
"type": null
},
{
"param": "subimages",
"type": null
},
{
"param": "comm",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "dirty_list",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
a9f8180423b62c16e81cdec36540d5393e5edd35 | ska-telescope/algorithm-reference-library | deprecated_code/workflows/mpi/imaging/imaging_mpi.py | [
"Apache-2.0"
] | Python | weight_list_mpi_workflow | <not_specific> | def weight_list_mpi_workflow(vis_list, model_imagelist, gcfcf=None,
weighting='uniform',comm=MPI.COMM_WORLD, **kwargs):
""" Weight the visibility data
This is done collectively so the weights are summed over all vis_lists and then
corrected
:param vis_list:
:param ... | Weight the visibility data
This is done collectively so the weights are summed over all vis_lists and then
corrected
:param vis_list:
:param model_imagelist: Model required to determine weighting parameters
:param weighting: Type of weighting
:param kwargs: Parameters for functions in gra... | Weight the visibility data
This is done collectively so the weights are summed over all vis_lists and then
corrected | [
"Weight",
"the",
"visibility",
"data",
"This",
"is",
"done",
"collectively",
"so",
"the",
"weights",
"are",
"summed",
"over",
"all",
"vis_lists",
"and",
"then",
"corrected"
] | def weight_list_mpi_workflow(vis_list, model_imagelist, gcfcf=None,
weighting='uniform',comm=MPI.COMM_WORLD, **kwargs):
centre = len(model_imagelist) // 2
rank = comm.Get_rank()
size = comm.Get_size()
if gcfcf is None:
if rank==0:
gcfcf = [create_pswf_con... | [
"def",
"weight_list_mpi_workflow",
"(",
"vis_list",
",",
"model_imagelist",
",",
"gcfcf",
"=",
"None",
",",
"weighting",
"=",
"'uniform'",
",",
"comm",
"=",
"MPI",
".",
"COMM_WORLD",
",",
"**",
"kwargs",
")",
":",
"centre",
"=",
"len",
"(",
"model_imagelist"... | Weight the visibility data
This is done collectively so the weights are summed over all vis_lists and then
corrected | [
"Weight",
"the",
"visibility",
"data",
"This",
"is",
"done",
"collectively",
"so",
"the",
"weights",
"are",
"summed",
"over",
"all",
"vis_lists",
"and",
"then",
"corrected"
] | [
"\"\"\" Weight the visibility data\n \n This is done collectively so the weights are summed over all vis_lists and then\n corrected\n\n :param vis_list:\n :param model_imagelist: Model required to determine weighting parameters\n :param weighting: Type of weighting\n :param kwargs: Parameters f... | [
{
"param": "vis_list",
"type": null
},
{
"param": "model_imagelist",
"type": null
},
{
"param": "gcfcf",
"type": null
},
{
"param": "weighting",
"type": null
},
{
"param": "comm",
"type": null
}
] | {
"returns": [
{
"docstring": "List of vis_graphs",
"docstring_tokens": [
"List",
"of",
"vis_graphs"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis_list",
"type": null,
"docstring": null,
"docstring_tokens":... |
a9f8180423b62c16e81cdec36540d5393e5edd35 | ska-telescope/algorithm-reference-library | deprecated_code/workflows/mpi/imaging/imaging_mpi.py | [
"Apache-2.0"
] | Python | zero_list_mpi_workflow | <not_specific> | def zero_list_mpi_workflow(vis_list,comm=MPI.COMM_WORLD ):
""" Initialise vis to zero: creates new data holders
:param vis_list:
:return: List of vis_lists
"""
def zero(vis):
if vis is not None:
zerovis = copy_visibility(vis)
zerovis.data['vis'][...] = 0.0
... | Initialise vis to zero: creates new data holders
:param vis_list:
:return: List of vis_lists
| Initialise vis to zero: creates new data holders | [
"Initialise",
"vis",
"to",
"zero",
":",
"creates",
"new",
"data",
"holders"
] | def zero_list_mpi_workflow(vis_list,comm=MPI.COMM_WORLD ):
def zero(vis):
if vis is not None:
zerovis = copy_visibility(vis)
zerovis.data['vis'][...] = 0.0
return zerovis
else:
return None
rank = comm.Get_rank()
size = comm.Get_size()
sub_v... | [
"def",
"zero_list_mpi_workflow",
"(",
"vis_list",
",",
"comm",
"=",
"MPI",
".",
"COMM_WORLD",
")",
":",
"def",
"zero",
"(",
"vis",
")",
":",
"if",
"vis",
"is",
"not",
"None",
":",
"zerovis",
"=",
"copy_visibility",
"(",
"vis",
")",
"zerovis",
".",
"dat... | Initialise vis to zero: creates new data holders | [
"Initialise",
"vis",
"to",
"zero",
":",
"creates",
"new",
"data",
"holders"
] | [
"\"\"\" Initialise vis to zero: creates new data holders\n\n :param vis_list:\n :return: List of vis_lists\n \"\"\""
] | [
{
"param": "vis_list",
"type": null
},
{
"param": "comm",
"type": null
}
] | {
"returns": [
{
"docstring": "List of vis_lists",
"docstring_tokens": [
"List",
"of",
"vis_lists"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis_list",
"type": null,
"docstring": null,
"docstring_tokens": [... |
09147283af13340c8a196801e540be6e679c309a | ska-telescope/algorithm-reference-library | processing_components/calibration/operations.py | [
"Apache-2.0"
] | Python | create_gaintable_from_blockvisibility | GainTable | def create_gaintable_from_blockvisibility(vis: BlockVisibility, timeslice=None,
frequencyslice: float = None, **kwargs) -> GainTable:
""" Create gain table from visibility.
This makes an empty gain table consistent with the BlockVisibility.
:param vis: Blo... | Create gain table from visibility.
This makes an empty gain table consistent with the BlockVisibility.
:param vis: BlockVisibilty
:param timeslice: Time interval between solutions (s)
:param frequency_width: Frequency solution width (Hz)
:return: GainTable
| Create gain table from visibility.
This makes an empty gain table consistent with the BlockVisibility. | [
"Create",
"gain",
"table",
"from",
"visibility",
".",
"This",
"makes",
"an",
"empty",
"gain",
"table",
"consistent",
"with",
"the",
"BlockVisibility",
"."
] | def create_gaintable_from_blockvisibility(vis: BlockVisibility, timeslice=None,
frequencyslice: float = None, **kwargs) -> GainTable:
assert isinstance(vis, BlockVisibility), "vis is not a BlockVisibility: %r" % vis
nants = vis.nants
if timeslice is None or timeslic... | [
"def",
"create_gaintable_from_blockvisibility",
"(",
"vis",
":",
"BlockVisibility",
",",
"timeslice",
"=",
"None",
",",
"frequencyslice",
":",
"float",
"=",
"None",
",",
"**",
"kwargs",
")",
"->",
"GainTable",
":",
"assert",
"isinstance",
"(",
"vis",
",",
"Blo... | Create gain table from visibility. | [
"Create",
"gain",
"table",
"from",
"visibility",
"."
] | [
"\"\"\" Create gain table from visibility.\n \n This makes an empty gain table consistent with the BlockVisibility.\n \n :param vis: BlockVisibilty\n :param timeslice: Time interval between solutions (s)\n :param frequency_width: Frequency solution width (Hz)\n :return: GainTable\n \n \"\... | [
{
"param": "vis",
"type": "BlockVisibility"
},
{
"param": "timeslice",
"type": null
},
{
"param": "frequencyslice",
"type": "float"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis",
"type": "BlockVisibility",
"docstring": null,
"docstring_tokens": [
"None"
],
"default": ... |
09147283af13340c8a196801e540be6e679c309a | ska-telescope/algorithm-reference-library | processing_components/calibration/operations.py | [
"Apache-2.0"
] | Python | apply_gaintable | BlockVisibility | def apply_gaintable(vis: BlockVisibility, gt: GainTable, inverse=False, vis_slices=None, **kwargs) -> BlockVisibility:
"""Apply a gain table to a block visibility
The corrected visibility is::
V_corrected = {g_i * g_j^*}^-1 V_obs
If the visibility data are polarised e.g. polarisat... | Apply a gain table to a block visibility
The corrected visibility is::
V_corrected = {g_i * g_j^*}^-1 V_obs
If the visibility data are polarised e.g. polarisation_frame("linear") then the inverse operator
represents an actual inverse of the gains.
:param vis: Visibility t... | Apply a gain table to a block visibility
The corrected visibility is:.
If the visibility data are polarised e.g. polarisation_frame("linear") then the inverse operator
represents an actual inverse of the gains. | [
"Apply",
"a",
"gain",
"table",
"to",
"a",
"block",
"visibility",
"The",
"corrected",
"visibility",
"is",
":",
".",
"If",
"the",
"visibility",
"data",
"are",
"polarised",
"e",
".",
"g",
".",
"polarisation_frame",
"(",
"\"",
"linear",
"\"",
")",
"then",
"t... | def apply_gaintable(vis: BlockVisibility, gt: GainTable, inverse=False, vis_slices=None, **kwargs) -> BlockVisibility:
assert isinstance(vis, BlockVisibility), "vis is not a BlockVisibility: %r" % vis
assert isinstance(gt, GainTable), "gt is not a GainTable: %r" % gt
assert_vis_gt_compatible(vis, gt)
if... | [
"def",
"apply_gaintable",
"(",
"vis",
":",
"BlockVisibility",
",",
"gt",
":",
"GainTable",
",",
"inverse",
"=",
"False",
",",
"vis_slices",
"=",
"None",
",",
"**",
"kwargs",
")",
"->",
"BlockVisibility",
":",
"assert",
"isinstance",
"(",
"vis",
",",
"Block... | Apply a gain table to a block visibility
The corrected visibility is:: | [
"Apply",
"a",
"gain",
"table",
"to",
"a",
"block",
"visibility",
"The",
"corrected",
"visibility",
"is",
"::"
] | [
"\"\"\"Apply a gain table to a block visibility\n \n The corrected visibility is::\n \n V_corrected = {g_i * g_j^*}^-1 V_obs\n \n If the visibility data are polarised e.g. polarisation_frame(\"linear\") then the inverse operator\n represents an actual inverse of the gains.\n \n :p... | [
{
"param": "vis",
"type": "BlockVisibility"
},
{
"param": "gt",
"type": "GainTable"
},
{
"param": "inverse",
"type": null
},
{
"param": "vis_slices",
"type": null
}
] | {
"returns": [
{
"docstring": "input vis with gains applied",
"docstring_tokens": [
"input",
"vis",
"with",
"gains",
"applied"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis",
"type": "BlockVisibility",
... |
c7158077b194a57ff72a60ad79b5c8aa34f57c48 | ska-telescope/algorithm-reference-library | deprecated_code/workflows/mpi/pipelines/pipeline_mpi.py | [
"Apache-2.0"
] | Python | continuum_imaging_list_mpi_workflow | <not_specific> | def continuum_imaging_list_mpi_workflow(vis_list, model_imagelist,
context,gcfcf=None,
vis_slices=1, facets=1, comm=MPI.COMM_WORLD,
**kwargs):
""" Create graph for the continuum imaging pi... | Create graph for the continuum imaging pipeline.
Same as ICAL but with no selfcal.
:param vis_list: rank0
:param model_imagelist: rank0
:param context: Imaging context
:param kwargs: Parameters for functions in components
:return:
| Create graph for the continuum imaging pipeline.
Same as ICAL but with no selfcal. | [
"Create",
"graph",
"for",
"the",
"continuum",
"imaging",
"pipeline",
".",
"Same",
"as",
"ICAL",
"but",
"with",
"no",
"selfcal",
"."
] | def continuum_imaging_list_mpi_workflow(vis_list, model_imagelist,
context,gcfcf=None,
vis_slices=1, facets=1, comm=MPI.COMM_WORLD,
**kwargs):
rank = comm.Get_rank()
size = comm.Get_si... | [
"def",
"continuum_imaging_list_mpi_workflow",
"(",
"vis_list",
",",
"model_imagelist",
",",
"context",
",",
"gcfcf",
"=",
"None",
",",
"vis_slices",
"=",
"1",
",",
"facets",
"=",
"1",
",",
"comm",
"=",
"MPI",
".",
"COMM_WORLD",
",",
"**",
"kwargs",
")",
":... | Create graph for the continuum imaging pipeline. | [
"Create",
"graph",
"for",
"the",
"continuum",
"imaging",
"pipeline",
"."
] | [
"\"\"\" Create graph for the continuum imaging pipeline.\n\n Same as ICAL but with no selfcal.\n\n :param vis_list: rank0\n :param model_imagelist: rank0\n :param context: Imaging context\n :param kwargs: Parameters for functions in components\n :return:\n \"\"\""
] | [
{
"param": "vis_list",
"type": null
},
{
"param": "model_imagelist",
"type": null
},
{
"param": "context",
"type": null
},
{
"param": "gcfcf",
"type": null
},
{
"param": "vis_slices",
"type": null
},
{
"param": "facets",
"type": null
},
{
"... | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis_list",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
c7158077b194a57ff72a60ad79b5c8aa34f57c48 | ska-telescope/algorithm-reference-library | deprecated_code/workflows/mpi/pipelines/pipeline_mpi.py | [
"Apache-2.0"
] | Python | spectral_line_imaging_list_mpi_workflow | <not_specific> | def spectral_line_imaging_list_mpi_workflow(vis_list, model_imagelist, context, continuum_model_imagelist=None,
vis_slices=1, facets=1, gcfcf=None, **kwargs):
"""Create graph for spectral line imaging pipeline
Uses the continuum imaging serial pipeline after ... | Create graph for spectral line imaging pipeline
Uses the continuum imaging serial pipeline after subtraction of a continuum model
:param vis_list: List of visibility components
:param model_imagelist: Spectral line model graph
:param continuum_model_imagelist: Continuum model list
:param context: ... | Create graph for spectral line imaging pipeline
Uses the continuum imaging serial pipeline after subtraction of a continuum model | [
"Create",
"graph",
"for",
"spectral",
"line",
"imaging",
"pipeline",
"Uses",
"the",
"continuum",
"imaging",
"serial",
"pipeline",
"after",
"subtraction",
"of",
"a",
"continuum",
"model"
] | def spectral_line_imaging_list_mpi_workflow(vis_list, model_imagelist, context, continuum_model_imagelist=None,
vis_slices=1, facets=1, gcfcf=None, **kwargs):
if continuum_model_imagelist is not None:
vis_list = predict_list_mpi_workflow(vis_list, continuu... | [
"def",
"spectral_line_imaging_list_mpi_workflow",
"(",
"vis_list",
",",
"model_imagelist",
",",
"context",
",",
"continuum_model_imagelist",
"=",
"None",
",",
"vis_slices",
"=",
"1",
",",
"facets",
"=",
"1",
",",
"gcfcf",
"=",
"None",
",",
"**",
"kwargs",
")",
... | Create graph for spectral line imaging pipeline
Uses the continuum imaging serial pipeline after subtraction of a continuum model | [
"Create",
"graph",
"for",
"spectral",
"line",
"imaging",
"pipeline",
"Uses",
"the",
"continuum",
"imaging",
"serial",
"pipeline",
"after",
"subtraction",
"of",
"a",
"continuum",
"model"
] | [
"\"\"\"Create graph for spectral line imaging pipeline\n\n Uses the continuum imaging serial pipeline after subtraction of a continuum model\n\n :param vis_list: List of visibility components\n :param model_imagelist: Spectral line model graph\n :param continuum_model_imagelist: Continuum model list\n ... | [
{
"param": "vis_list",
"type": null
},
{
"param": "model_imagelist",
"type": null
},
{
"param": "context",
"type": null
},
{
"param": "continuum_model_imagelist",
"type": null
},
{
"param": "vis_slices",
"type": null
},
{
"param": "facets",
"type":... | {
"returns": [
{
"docstring": "(deconvolved model, residual, restored)",
"docstring_tokens": [
"(",
"deconvolved",
"model",
"residual",
"restored",
")"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis_li... |
c9631bf839abb48a47df85483b68d59dfc3eee5d | ska-telescope/algorithm-reference-library | processing_components/imaging/primary_beams.py | [
"Apache-2.0"
] | Python | create_vp | <not_specific> | def create_vp(model, telescope='MID', pointingcentre=None, padding=4, use_local=True):
"""
Make an image like model and fill it with an analytical model of the voltage pattern
:param model: Template image
:param telescope: 'VLA' or 'ASKAP'
:return: Primary beam image
"""
if telescope == 'MID... |
Make an image like model and fill it with an analytical model of the voltage pattern
:param model: Template image
:param telescope: 'VLA' or 'ASKAP'
:return: Primary beam image
| Make an image like model and fill it with an analytical model of the voltage pattern | [
"Make",
"an",
"image",
"like",
"model",
"and",
"fill",
"it",
"with",
"an",
"analytical",
"model",
"of",
"the",
"voltage",
"pattern"
] | def create_vp(model, telescope='MID', pointingcentre=None, padding=4, use_local=True):
if telescope == 'MID_GAUSS':
log.debug("create_vp: Using numeric tapered Gaussian model for MID voltage pattern")
edge = numpy.power(10, -0.6)
return create_vp_generic_numeric(model, pointingcentre=pointin... | [
"def",
"create_vp",
"(",
"model",
",",
"telescope",
"=",
"'MID'",
",",
"pointingcentre",
"=",
"None",
",",
"padding",
"=",
"4",
",",
"use_local",
"=",
"True",
")",
":",
"if",
"telescope",
"==",
"'MID_GAUSS'",
":",
"log",
".",
"debug",
"(",
"\"create_vp: ... | Make an image like model and fill it with an analytical model of the voltage pattern | [
"Make",
"an",
"image",
"like",
"model",
"and",
"fill",
"it",
"with",
"an",
"analytical",
"model",
"of",
"the",
"voltage",
"pattern"
] | [
"\"\"\"\n Make an image like model and fill it with an analytical model of the voltage pattern\n :param model: Template image\n :param telescope: 'VLA' or 'ASKAP'\n :return: Primary beam image\n \"\"\""
] | [
{
"param": "model",
"type": null
},
{
"param": "telescope",
"type": null
},
{
"param": "pointingcentre",
"type": null
},
{
"param": "padding",
"type": null
},
{
"param": "use_local",
"type": null
}
] | {
"returns": [
{
"docstring": "Primary beam image",
"docstring_tokens": [
"Primary",
"beam",
"image"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "model",
"type": null,
"docstring": null,
"docstring_tokens": [
... |
c9631bf839abb48a47df85483b68d59dfc3eee5d | ska-telescope/algorithm-reference-library | processing_components/imaging/primary_beams.py | [
"Apache-2.0"
] | Python | mosaic_pb | <not_specific> | def mosaic_pb(model, telescope, pointingcentres, use_local=True):
""" Create a mosaic primary beam by adding primary beams for a set of pointing centres
Note that the addition is root sum of squares
:param model: Template image
:param telescope:
:param pointingcentres: list of pointing c... | Create a mosaic primary beam by adding primary beams for a set of pointing centres
Note that the addition is root sum of squares
:param model: Template image
:param telescope:
:param pointingcentres: list of pointing centres
:return:
| Create a mosaic primary beam by adding primary beams for a set of pointing centres
Note that the addition is root sum of squares | [
"Create",
"a",
"mosaic",
"primary",
"beam",
"by",
"adding",
"primary",
"beams",
"for",
"a",
"set",
"of",
"pointing",
"centres",
"Note",
"that",
"the",
"addition",
"is",
"root",
"sum",
"of",
"squares"
] | def mosaic_pb(model, telescope, pointingcentres, use_local=True):
assert isinstance(pointingcentres, collections.Iterable), "Need a list of pointing centres"
sumpb = create_empty_image_like(model)
for pc in pointingcentres:
pb = create_pb(model, telescope, pointingcentre=pc, use_local=use_local)
... | [
"def",
"mosaic_pb",
"(",
"model",
",",
"telescope",
",",
"pointingcentres",
",",
"use_local",
"=",
"True",
")",
":",
"assert",
"isinstance",
"(",
"pointingcentres",
",",
"collections",
".",
"Iterable",
")",
",",
"\"Need a list of pointing centres\"",
"sumpb",
"=",... | Create a mosaic primary beam by adding primary beams for a set of pointing centres
Note that the addition is root sum of squares | [
"Create",
"a",
"mosaic",
"primary",
"beam",
"by",
"adding",
"primary",
"beams",
"for",
"a",
"set",
"of",
"pointing",
"centres",
"Note",
"that",
"the",
"addition",
"is",
"root",
"sum",
"of",
"squares"
] | [
"\"\"\" Create a mosaic primary beam by adding primary beams for a set of pointing centres\n \n Note that the addition is root sum of squares\n \n :param model: Template image\n :param telescope:\n :param pointingcentres: list of pointing centres\n :return:\n \"\"\""
] | [
{
"param": "model",
"type": null
},
{
"param": "telescope",
"type": null
},
{
"param": "pointingcentres",
"type": null
},
{
"param": "use_local",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "model",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
c9631bf839abb48a47df85483b68d59dfc3eee5d | ska-telescope/algorithm-reference-library | processing_components/imaging/primary_beams.py | [
"Apache-2.0"
] | Python | create_vp_generic | <not_specific> | def create_vp_generic(model, pointingcentre=None, diameter=25.0, blockage=1.8, use_local=True):
"""
Make an image like model and fill it with an analytical model of the primary beam
:param model:
:return:
"""
beam = create_empty_image_like(model)
beam.data = numpy.zeros(beam.data.shape, dtyp... |
Make an image like model and fill it with an analytical model of the primary beam
:param model:
:return:
| Make an image like model and fill it with an analytical model of the primary beam | [
"Make",
"an",
"image",
"like",
"model",
"and",
"fill",
"it",
"with",
"an",
"analytical",
"model",
"of",
"the",
"primary",
"beam"
] | def create_vp_generic(model, pointingcentre=None, diameter=25.0, blockage=1.8, use_local=True):
beam = create_empty_image_like(model)
beam.data = numpy.zeros(beam.data.shape, dtype='complex')
nchan, npol, ny, nx = model.shape
if pointingcentre is not None:
cx, cy = pointingcentre.to_pixel(model.... | [
"def",
"create_vp_generic",
"(",
"model",
",",
"pointingcentre",
"=",
"None",
",",
"diameter",
"=",
"25.0",
",",
"blockage",
"=",
"1.8",
",",
"use_local",
"=",
"True",
")",
":",
"beam",
"=",
"create_empty_image_like",
"(",
"model",
")",
"beam",
".",
"data"... | Make an image like model and fill it with an analytical model of the primary beam | [
"Make",
"an",
"image",
"like",
"model",
"and",
"fill",
"it",
"with",
"an",
"analytical",
"model",
"of",
"the",
"primary",
"beam"
] | [
"\"\"\"\n Make an image like model and fill it with an analytical model of the primary beam\n :param model:\n :return:\n \"\"\"",
"# The frequency axis is the second to last in the beam",
"# Radius of each cell in radians"
] | [
{
"param": "model",
"type": null
},
{
"param": "pointingcentre",
"type": null
},
{
"param": "diameter",
"type": null
},
{
"param": "blockage",
"type": null
},
{
"param": "use_local",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "model",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
c9631bf839abb48a47df85483b68d59dfc3eee5d | ska-telescope/algorithm-reference-library | processing_components/imaging/primary_beams.py | [
"Apache-2.0"
] | Python | create_vp_generic_numeric | <not_specific> | def create_vp_generic_numeric(model, pointingcentre=None, diameter=15.0, blockage=0.0, taper='gaussian',
edge=0.03162278, zernikes=None, padding=4, use_local=True, rho=0.0, diff=0.0):
"""
Make an image like model and fill it with an analytical model of the primary beam
The... |
Make an image like model and fill it with an analytical model of the primary beam
The elements of the analytical model are:
- dish, optionally blocked
- Gaussian taper, default is -12dB at the edge
- Offset to pointing centre (optional)
- zernikes in a list of dictionaries. Each list eleme... | Make an image like model and fill it with an analytical model of the primary beam
The elements of the analytical model are:
dish, optionally blocked
Gaussian taper, default is -12dB at the edge
Offset to pointing centre (optional)
zernikes in a list of dictionaries. Each list element is of the form {"coeff":0.1, "noll"... | [
"Make",
"an",
"image",
"like",
"model",
"and",
"fill",
"it",
"with",
"an",
"analytical",
"model",
"of",
"the",
"primary",
"beam",
"The",
"elements",
"of",
"the",
"analytical",
"model",
"are",
":",
"dish",
"optionally",
"blocked",
"Gaussian",
"taper",
"defaul... | def create_vp_generic_numeric(model, pointingcentre=None, diameter=15.0, blockage=0.0, taper='gaussian',
edge=0.03162278, zernikes=None, padding=4, use_local=True, rho=0.0, diff=0.0):
beam = create_empty_image_like(model)
nchan, npol, ny, nx = beam.shape
padded_shape = [nchan, ... | [
"def",
"create_vp_generic_numeric",
"(",
"model",
",",
"pointingcentre",
"=",
"None",
",",
"diameter",
"=",
"15.0",
",",
"blockage",
"=",
"0.0",
",",
"taper",
"=",
"'gaussian'",
",",
"edge",
"=",
"0.03162278",
",",
"zernikes",
"=",
"None",
",",
"padding",
... | Make an image like model and fill it with an analytical model of the primary beam
The elements of the analytical model are:
dish, optionally blocked
Gaussian taper, default is -12dB at the edge
Offset to pointing centre (optional)
zernikes in a list of dictionaries. | [
"Make",
"an",
"image",
"like",
"model",
"and",
"fill",
"it",
"with",
"an",
"analytical",
"model",
"of",
"the",
"primary",
"beam",
"The",
"elements",
"of",
"the",
"analytical",
"model",
"are",
":",
"dish",
"optionally",
"blocked",
"Gaussian",
"taper",
"defaul... | [
"\"\"\"\n Make an image like model and fill it with an analytical model of the primary beam\n \n The elements of the analytical model are:\n - dish, optionally blocked\n - Gaussian taper, default is -12dB at the edge\n - Offset to pointing centre (optional)\n - zernikes in a list of dictionarie... | [
{
"param": "model",
"type": null
},
{
"param": "pointingcentre",
"type": null
},
{
"param": "diameter",
"type": null
},
{
"param": "blockage",
"type": null
},
{
"param": "taper",
"type": null
},
{
"param": "edge",
"type": null
},
{
"param":... | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "model",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
3f3c4c4574b55fffee85f94d95adc6091da337d9 | ska-telescope/algorithm-reference-library | processing_components/visibility/msv2fund.py | [
"Apache-2.0"
] | Python | add_data_set | null | def add_data_set(self, obstime, inttime, baselines, visibilities, weights=None, pol='XX', source=None):
"""
Create a UVData object to store a collection of visibilities.
"""
if type(pol) == str:
numericPol = self._STOKES_CODES[pol.upper()]
el... |
Create a UVData object to store a collection of visibilities.
| Create a UVData object to store a collection of visibilities. | [
"Create",
"a",
"UVData",
"object",
"to",
"store",
"a",
"collection",
"of",
"visibilities",
"."
] | def add_data_set(self, obstime, inttime, baselines, visibilities, weights=None, pol='XX', source=None):
if type(pol) == str:
numericPol = self._STOKES_CODES[pol.upper()]
else:
numericPol = pol
self.data.append(
MS_UVData(obstime, inttim... | [
"def",
"add_data_set",
"(",
"self",
",",
"obstime",
",",
"inttime",
",",
"baselines",
",",
"visibilities",
",",
"weights",
"=",
"None",
",",
"pol",
"=",
"'XX'",
",",
"source",
"=",
"None",
")",
":",
"if",
"type",
"(",
"pol",
")",
"==",
"str",
":",
... | Create a UVData object to store a collection of visibilities. | [
"Create",
"a",
"UVData",
"object",
"to",
"store",
"a",
"collection",
"of",
"visibilities",
"."
] | [
"\"\"\"\n Create a UVData object to store a collection of visibilities.\n\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "obstime",
"type": null
},
{
"param": "inttime",
"type": null
},
{
"param": "baselines",
"type": null
},
{
"param": "visibilities",
"type": null
},
{
"param": "weights",
"type": null
},
{
"param... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "obstime",
"type": null,
"docstring": null,
"docstring_tokens"... |
a3d51a7c7ef8879558ca7a7e501728cc2508348b | ska-telescope/algorithm-reference-library | workflows/serial/pipelines/pipeline_serial.py | [
"Apache-2.0"
] | Python | continuum_imaging_list_serial_workflow | <not_specific> | def continuum_imaging_list_serial_workflow(vis_list, model_imagelist, context, gcfcf=None,
vis_slices=1, facets=1, **kwargs):
""" Create graph for the continuum imaging pipeline.
Same as ICAL but with no selfcal.
:param vis_list:
:param model_imagelist:
:... | Create graph for the continuum imaging pipeline.
Same as ICAL but with no selfcal.
:param vis_list:
:param model_imagelist:
:param context: Imaging context
:param kwargs: Parameters for functions in components
:return:
| Create graph for the continuum imaging pipeline.
Same as ICAL but with no selfcal. | [
"Create",
"graph",
"for",
"the",
"continuum",
"imaging",
"pipeline",
".",
"Same",
"as",
"ICAL",
"but",
"with",
"no",
"selfcal",
"."
] | def continuum_imaging_list_serial_workflow(vis_list, model_imagelist, context, gcfcf=None,
vis_slices=1, facets=1, **kwargs):
if gcfcf is None:
gcfcf = [create_pswf_convolutionfunction(model_imagelist[0])]
psf_imagelist = invert_list_serial_workflow(vis_list, m... | [
"def",
"continuum_imaging_list_serial_workflow",
"(",
"vis_list",
",",
"model_imagelist",
",",
"context",
",",
"gcfcf",
"=",
"None",
",",
"vis_slices",
"=",
"1",
",",
"facets",
"=",
"1",
",",
"**",
"kwargs",
")",
":",
"if",
"gcfcf",
"is",
"None",
":",
"gcf... | Create graph for the continuum imaging pipeline. | [
"Create",
"graph",
"for",
"the",
"continuum",
"imaging",
"pipeline",
"."
] | [
"\"\"\" Create graph for the continuum imaging pipeline.\n\n Same as ICAL but with no selfcal.\n\n :param vis_list:\n :param model_imagelist:\n :param context: Imaging context\n :param kwargs: Parameters for functions in components\n :return:\n \"\"\""
] | [
{
"param": "vis_list",
"type": null
},
{
"param": "model_imagelist",
"type": null
},
{
"param": "context",
"type": null
},
{
"param": "gcfcf",
"type": null
},
{
"param": "vis_slices",
"type": null
},
{
"param": "facets",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis_list",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
a3d51a7c7ef8879558ca7a7e501728cc2508348b | ska-telescope/algorithm-reference-library | workflows/serial/pipelines/pipeline_serial.py | [
"Apache-2.0"
] | Python | spectral_line_imaging_list_serial_workflow | <not_specific> | def spectral_line_imaging_list_serial_workflow(vis_list, model_imagelist, context, continuum_model_imagelist=None,
vis_slices=1, facets=1, gcfcf=None, **kwargs):
"""Create graph for spectral line imaging pipeline
Uses the continuum imaging arlexecute pipeline afte... | Create graph for spectral line imaging pipeline
Uses the continuum imaging arlexecute pipeline after subtraction of a continuum model
:param vis_list: List of visibility components
:param model_imagelist: Spectral line model graph
:param continuum_model_imagelist: Continuum model list
:param conte... | Create graph for spectral line imaging pipeline
Uses the continuum imaging arlexecute pipeline after subtraction of a continuum model | [
"Create",
"graph",
"for",
"spectral",
"line",
"imaging",
"pipeline",
"Uses",
"the",
"continuum",
"imaging",
"arlexecute",
"pipeline",
"after",
"subtraction",
"of",
"a",
"continuum",
"model"
] | def spectral_line_imaging_list_serial_workflow(vis_list, model_imagelist, context, continuum_model_imagelist=None,
vis_slices=1, facets=1, gcfcf=None, **kwargs):
if continuum_model_imagelist is not None:
vis_list = predict_list_serial_workflow(vis_list, continu... | [
"def",
"spectral_line_imaging_list_serial_workflow",
"(",
"vis_list",
",",
"model_imagelist",
",",
"context",
",",
"continuum_model_imagelist",
"=",
"None",
",",
"vis_slices",
"=",
"1",
",",
"facets",
"=",
"1",
",",
"gcfcf",
"=",
"None",
",",
"**",
"kwargs",
")"... | Create graph for spectral line imaging pipeline
Uses the continuum imaging arlexecute pipeline after subtraction of a continuum model | [
"Create",
"graph",
"for",
"spectral",
"line",
"imaging",
"pipeline",
"Uses",
"the",
"continuum",
"imaging",
"arlexecute",
"pipeline",
"after",
"subtraction",
"of",
"a",
"continuum",
"model"
] | [
"\"\"\"Create graph for spectral line imaging pipeline\n\n Uses the continuum imaging arlexecute pipeline after subtraction of a continuum model\n\n :param vis_list: List of visibility components\n :param model_imagelist: Spectral line model graph\n :param continuum_model_imagelist: Continuum model list... | [
{
"param": "vis_list",
"type": null
},
{
"param": "model_imagelist",
"type": null
},
{
"param": "context",
"type": null
},
{
"param": "continuum_model_imagelist",
"type": null
},
{
"param": "vis_slices",
"type": null
},
{
"param": "facets",
"type":... | {
"returns": [
{
"docstring": "(deconvolved model, residual, restored)",
"docstring_tokens": [
"(",
"deconvolved",
"model",
"residual",
"restored",
")"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis_li... |
304d89e148d57e12b6c1d11e42bfec75313e0f04 | ska-telescope/algorithm-reference-library | processing_library/fourier_transforms/convolutional_gridding.py | [
"Apache-2.0"
] | Python | coordinates2Offset | <not_specific> | def coordinates2Offset(npixel: int, cx: int, cy: int, quadrant=False):
"""Two dimensional grids of coordinates centred on an arbitrary point.
This is used for A and w beams.
1. a step size of 2/npixel and
2. (0,0) at pixel (cx, cy,floor(n/2))
"""
if cx is None:
cx = npixel // 2
if ... | Two dimensional grids of coordinates centred on an arbitrary point.
This is used for A and w beams.
1. a step size of 2/npixel and
2. (0,0) at pixel (cx, cy,floor(n/2))
| Two dimensional grids of coordinates centred on an arbitrary point.
This is used for A and w beams.
1. a step size of 2/npixel and
2. | [
"Two",
"dimensional",
"grids",
"of",
"coordinates",
"centred",
"on",
"an",
"arbitrary",
"point",
".",
"This",
"is",
"used",
"for",
"A",
"and",
"w",
"beams",
".",
"1",
".",
"a",
"step",
"size",
"of",
"2",
"/",
"npixel",
"and",
"2",
"."
] | def coordinates2Offset(npixel: int, cx: int, cy: int, quadrant=False):
if cx is None:
cx = npixel // 2
if cy is None:
cy = npixel // 2
if quadrant == False:
mg = numpy.mgrid[0:npixel, 0:npixel]
else:
mg = numpy.mgrid[0:npixel//2+1, 0:npixel//2+1]
return (mg[0] - cy) /... | [
"def",
"coordinates2Offset",
"(",
"npixel",
":",
"int",
",",
"cx",
":",
"int",
",",
"cy",
":",
"int",
",",
"quadrant",
"=",
"False",
")",
":",
"if",
"cx",
"is",
"None",
":",
"cx",
"=",
"npixel",
"//",
"2",
"if",
"cy",
"is",
"None",
":",
"cy",
"... | Two dimensional grids of coordinates centred on an arbitrary point. | [
"Two",
"dimensional",
"grids",
"of",
"coordinates",
"centred",
"on",
"an",
"arbitrary",
"point",
"."
] | [
"\"\"\"Two dimensional grids of coordinates centred on an arbitrary point.\n\n This is used for A and w beams.\n\n 1. a step size of 2/npixel and\n 2. (0,0) at pixel (cx, cy,floor(n/2))\n \"\"\"",
"# If npixel is even, we should create a grid with npixel//2+1"
] | [
{
"param": "npixel",
"type": "int"
},
{
"param": "cx",
"type": "int"
},
{
"param": "cy",
"type": "int"
},
{
"param": "quadrant",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "npixel",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cx",
"type": "int",
"docstring": null,
"docstring_tokens":... |
304d89e148d57e12b6c1d11e42bfec75313e0f04 | ska-telescope/algorithm-reference-library | processing_library/fourier_transforms/convolutional_gridding.py | [
"Apache-2.0"
] | Python | frac_coord | <not_specific> | def frac_coord(npixel, kernel_oversampling, p):
""" Compute whole and fractional parts of coordinates, rounded to
kernel_oversampling-th fraction of pixel size
The fractional values are rounded to nearest 1/kernel_oversampling pixel value. At
fractional values greater than (kernel_oversampling-0.5)/ker... | Compute whole and fractional parts of coordinates, rounded to
kernel_oversampling-th fraction of pixel size
The fractional values are rounded to nearest 1/kernel_oversampling pixel value. At
fractional values greater than (kernel_oversampling-0.5)/kernel_oversampling coordinates are
rounded to next in... | Compute whole and fractional parts of coordinates, rounded to
kernel_oversampling-th fraction of pixel size
The fractional values are rounded to nearest 1/kernel_oversampling pixel value. At
fractional values greater than (kernel_oversampling-0.5)/kernel_oversampling coordinates are
rounded to next integer index. | [
"Compute",
"whole",
"and",
"fractional",
"parts",
"of",
"coordinates",
"rounded",
"to",
"kernel_oversampling",
"-",
"th",
"fraction",
"of",
"pixel",
"size",
"The",
"fractional",
"values",
"are",
"rounded",
"to",
"nearest",
"1",
"/",
"kernel_oversampling",
"pixel",... | def frac_coord(npixel, kernel_oversampling, p):
assert numpy.array(p >= -0.5).all() and numpy.array(
p < 0.5).all(), "Cellsize is too large: uv overflows grid uv= %s" % str(p)
x = npixel // 2 + p * npixel
flx = numpy.floor(x + 0.5 / kernel_oversampling)
fracx = numpy.around((x - flx) * kernel_ov... | [
"def",
"frac_coord",
"(",
"npixel",
",",
"kernel_oversampling",
",",
"p",
")",
":",
"assert",
"numpy",
".",
"array",
"(",
"p",
">=",
"-",
"0.5",
")",
".",
"all",
"(",
")",
"and",
"numpy",
".",
"array",
"(",
"p",
"<",
"0.5",
")",
".",
"all",
"(",
... | Compute whole and fractional parts of coordinates, rounded to
kernel_oversampling-th fraction of pixel size | [
"Compute",
"whole",
"and",
"fractional",
"parts",
"of",
"coordinates",
"rounded",
"to",
"kernel_oversampling",
"-",
"th",
"fraction",
"of",
"pixel",
"size"
] | [
"\"\"\" Compute whole and fractional parts of coordinates, rounded to\n kernel_oversampling-th fraction of pixel size\n\n The fractional values are rounded to nearest 1/kernel_oversampling pixel value. At\n fractional values greater than (kernel_oversampling-0.5)/kernel_oversampling coordinates are\n ro... | [
{
"param": "npixel",
"type": null
},
{
"param": "kernel_oversampling",
"type": null
},
{
"param": "p",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "npixel",
"type": null,
"docstring": "Number of pixels in total",
"docstring_tokens": [
"Number",
"of",
"pixels",
"in",
"total"
],
"default": null,
"is_optional": null
... |
552f14916e48aabc4808ffd58973183ffa15450d | ska-telescope/algorithm-reference-library | processing_components/visibility/gather_scatter.py | [
"Apache-2.0"
] | Python | visibility_scatter | List[Visibility] | def visibility_scatter(vis: Visibility, vis_iter, vis_slices=1) -> List[Visibility]:
"""Scatter a visibility into a list of subvisibilities
If vis_iter is over time then the type of the outvisibilities will be the same as inout
If vis_iter is over w then the type of the output visibilities will always ... | Scatter a visibility into a list of subvisibilities
If vis_iter is over time then the type of the outvisibilities will be the same as inout
If vis_iter is over w then the type of the output visibilities will always be Visibility
:param vis: Visibility
:param vis_iter: visibility iterator
:para... | Scatter a visibility into a list of subvisibilities
If vis_iter is over time then the type of the outvisibilities will be the same as inout
If vis_iter is over w then the type of the output visibilities will always be Visibility | [
"Scatter",
"a",
"visibility",
"into",
"a",
"list",
"of",
"subvisibilities",
"If",
"vis_iter",
"is",
"over",
"time",
"then",
"the",
"type",
"of",
"the",
"outvisibilities",
"will",
"be",
"the",
"same",
"as",
"inout",
"If",
"vis_iter",
"is",
"over",
"w",
"the... | def visibility_scatter(vis: Visibility, vis_iter, vis_slices=1) -> List[Visibility]:
assert vis is not None
if vis_slices == 1:
return [vis]
visibility_list = list()
for i, rows in enumerate(vis_iter(vis, vis_slices=vis_slices)):
subvis = create_visibility_from_rows(vis, rows)
vi... | [
"def",
"visibility_scatter",
"(",
"vis",
":",
"Visibility",
",",
"vis_iter",
",",
"vis_slices",
"=",
"1",
")",
"->",
"List",
"[",
"Visibility",
"]",
":",
"assert",
"vis",
"is",
"not",
"None",
"if",
"vis_slices",
"==",
"1",
":",
"return",
"[",
"vis",
"]... | Scatter a visibility into a list of subvisibilities
If vis_iter is over time then the type of the outvisibilities will be the same as inout
If vis_iter is over w then the type of the output visibilities will always be Visibility | [
"Scatter",
"a",
"visibility",
"into",
"a",
"list",
"of",
"subvisibilities",
"If",
"vis_iter",
"is",
"over",
"time",
"then",
"the",
"type",
"of",
"the",
"outvisibilities",
"will",
"be",
"the",
"same",
"as",
"inout",
"If",
"vis_iter",
"is",
"over",
"w",
"the... | [
"\"\"\"Scatter a visibility into a list of subvisibilities\n \n If vis_iter is over time then the type of the outvisibilities will be the same as inout\n If vis_iter is over w then the type of the output visibilities will always be Visibility\n\n :param vis: Visibility\n :param vis_iter: visibility i... | [
{
"param": "vis",
"type": "Visibility"
},
{
"param": "vis_iter",
"type": null
},
{
"param": "vis_slices",
"type": null
}
] | {
"returns": [
{
"docstring": "list of subvisibilitys",
"docstring_tokens": [
"list",
"of",
"subvisibilitys"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis",
"type": "Visibility",
"docstring": null,
"docstri... |
552f14916e48aabc4808ffd58973183ffa15450d | ska-telescope/algorithm-reference-library | processing_components/visibility/gather_scatter.py | [
"Apache-2.0"
] | Python | visibility_gather | Visibility | def visibility_gather(visibility_list: List[Visibility], vis: Visibility, vis_iter, vis_slices=None) -> Visibility:
"""Gather a list of subvisibilities back into a visibility
The iterator setup must be the same as used in the scatter.
:param visibility_list: List of subvisibilities
:param vis: Out... | Gather a list of subvisibilities back into a visibility
The iterator setup must be the same as used in the scatter.
:param visibility_list: List of subvisibilities
:param vis: Output visibility
:param vis_iter: visibility iterator
:param vis_slices: Number of slices to be gathered (optional)
... | Gather a list of subvisibilities back into a visibility
The iterator setup must be the same as used in the scatter. | [
"Gather",
"a",
"list",
"of",
"subvisibilities",
"back",
"into",
"a",
"visibility",
"The",
"iterator",
"setup",
"must",
"be",
"the",
"same",
"as",
"used",
"in",
"the",
"scatter",
"."
] | def visibility_gather(visibility_list: List[Visibility], vis: Visibility, vis_iter, vis_slices=None) -> Visibility:
if vis_slices == 1:
return visibility_list[0]
if vis_slices is None:
vis_slices = len(visibility_list)
rowses = []
for i, rows in enumerate(vis_iter(vis, vis_slices=vis_sli... | [
"def",
"visibility_gather",
"(",
"visibility_list",
":",
"List",
"[",
"Visibility",
"]",
",",
"vis",
":",
"Visibility",
",",
"vis_iter",
",",
"vis_slices",
"=",
"None",
")",
"->",
"Visibility",
":",
"if",
"vis_slices",
"==",
"1",
":",
"return",
"visibility_l... | Gather a list of subvisibilities back into a visibility
The iterator setup must be the same as used in the scatter. | [
"Gather",
"a",
"list",
"of",
"subvisibilities",
"back",
"into",
"a",
"visibility",
"The",
"iterator",
"setup",
"must",
"be",
"the",
"same",
"as",
"used",
"in",
"the",
"scatter",
"."
] | [
"\"\"\"Gather a list of subvisibilities back into a visibility\n \n The iterator setup must be the same as used in the scatter.\n\n :param visibility_list: List of subvisibilities\n :param vis: Output visibility\n :param vis_iter: visibility iterator\n :param vis_slices: Number of slices to be gat... | [
{
"param": "visibility_list",
"type": "List[Visibility]"
},
{
"param": "vis",
"type": "Visibility"
},
{
"param": "vis_iter",
"type": null
},
{
"param": "vis_slices",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "visibility_list",
"type": "List[Visibility]",
"docstring": "List of subvisibilities",
"docstring_tokens": [
... |
04f58a1531f31e755c6cd02d19210d5658d80793 | ska-telescope/algorithm-reference-library | processing_components/simulation/simulation_helpers.py | [
"Apache-2.0"
] | Python | plot_azel | null | def plot_azel(bvis_list, plot_file='azel.png', **kwargs):
""" Standard plot of az el coverage
:param bvis_list:
:param plot_file:
:param kwargs:
:return:
"""
plt.clf()
r2d = 180.0 / numpy.pi
for ibvis, bvis in enumerate(bvis_list):
ha = numpy.pi * bvis.time / 43200.0
... | Standard plot of az el coverage
:param bvis_list:
:param plot_file:
:param kwargs:
:return:
| Standard plot of az el coverage | [
"Standard",
"plot",
"of",
"az",
"el",
"coverage"
] | def plot_azel(bvis_list, plot_file='azel.png', **kwargs):
plt.clf()
r2d = 180.0 / numpy.pi
for ibvis, bvis in enumerate(bvis_list):
ha = numpy.pi * bvis.time / 43200.0
dec = bvis.phasecentre.dec.rad
latitude = bvis.configuration.location.lat.rad
az, el = hadec_to_azel(ha, dec... | [
"def",
"plot_azel",
"(",
"bvis_list",
",",
"plot_file",
"=",
"'azel.png'",
",",
"**",
"kwargs",
")",
":",
"plt",
".",
"clf",
"(",
")",
"r2d",
"=",
"180.0",
"/",
"numpy",
".",
"pi",
"for",
"ibvis",
",",
"bvis",
"in",
"enumerate",
"(",
"bvis_list",
")"... | Standard plot of az el coverage | [
"Standard",
"plot",
"of",
"az",
"el",
"coverage"
] | [
"\"\"\" Standard plot of az el coverage\n \n :param bvis_list:\n :param plot_file:\n :param kwargs:\n :return:\n \"\"\""
] | [
{
"param": "bvis_list",
"type": null
},
{
"param": "plot_file",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "bvis_list",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
105f3cd61220f07455efb755a5d66c2227f3c2f8 | ska-telescope/algorithm-reference-library | data_models/data_model_helpers.py | [
"Apache-2.0"
] | Python | convert_hdf_to_gaintable | <not_specific> | def convert_hdf_to_gaintable(f):
""" Convert HDF root to a GainTable
:param f:
:return:
"""
assert f.attrs['ARL_data_model'] == "GainTable", "Not a GainTable"
receptor_frame = ReceptorFrame(f.attrs['receptor_frame'])
frequency = numpy.array(f.attrs['frequency'])
data = numpy.array(f['da... | Convert HDF root to a GainTable
:param f:
:return:
| Convert HDF root to a GainTable | [
"Convert",
"HDF",
"root",
"to",
"a",
"GainTable"
] | def convert_hdf_to_gaintable(f):
assert f.attrs['ARL_data_model'] == "GainTable", "Not a GainTable"
receptor_frame = ReceptorFrame(f.attrs['receptor_frame'])
frequency = numpy.array(f.attrs['frequency'])
data = numpy.array(f['data'])
s = f.attrs['phasecentre_coords'].split()
ss = [float(s[0]), f... | [
"def",
"convert_hdf_to_gaintable",
"(",
"f",
")",
":",
"assert",
"f",
".",
"attrs",
"[",
"'ARL_data_model'",
"]",
"==",
"\"GainTable\"",
",",
"\"Not a GainTable\"",
"receptor_frame",
"=",
"ReceptorFrame",
"(",
"f",
".",
"attrs",
"[",
"'receptor_frame'",
"]",
")"... | Convert HDF root to a GainTable | [
"Convert",
"HDF",
"root",
"to",
"a",
"GainTable"
] | [
"\"\"\" Convert HDF root to a GainTable\n\n :param f:\n :return:\n \"\"\""
] | [
{
"param": "f",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "f",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"is... |
105f3cd61220f07455efb755a5d66c2227f3c2f8 | ska-telescope/algorithm-reference-library | data_models/data_model_helpers.py | [
"Apache-2.0"
] | Python | convert_hdf_to_pointingtable | <not_specific> | def convert_hdf_to_pointingtable(f):
""" Convert HDF root to a PointingTable
:param f:
:return:
"""
assert f.attrs['ARL_data_model'] == "PointingTable", "Not a PointingTable"
receptor_frame = ReceptorFrame(f.attrs['receptor_frame'])
frequency = numpy.array(f.attrs['frequency'])
data = n... | Convert HDF root to a PointingTable
:param f:
:return:
| Convert HDF root to a PointingTable | [
"Convert",
"HDF",
"root",
"to",
"a",
"PointingTable"
] | def convert_hdf_to_pointingtable(f):
assert f.attrs['ARL_data_model'] == "PointingTable", "Not a PointingTable"
receptor_frame = ReceptorFrame(f.attrs['receptor_frame'])
frequency = numpy.array(f.attrs['frequency'])
data = numpy.array(f['data'])
s = f.attrs['pointingcentre_coords'].split()
ss = ... | [
"def",
"convert_hdf_to_pointingtable",
"(",
"f",
")",
":",
"assert",
"f",
".",
"attrs",
"[",
"'ARL_data_model'",
"]",
"==",
"\"PointingTable\"",
",",
"\"Not a PointingTable\"",
"receptor_frame",
"=",
"ReceptorFrame",
"(",
"f",
".",
"attrs",
"[",
"'receptor_frame'",
... | Convert HDF root to a PointingTable | [
"Convert",
"HDF",
"root",
"to",
"a",
"PointingTable"
] | [
"\"\"\" Convert HDF root to a PointingTable\n\n :param f:\n :return:\n \"\"\""
] | [
{
"param": "f",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "f",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"is... |
105f3cd61220f07455efb755a5d66c2227f3c2f8 | ska-telescope/algorithm-reference-library | data_models/data_model_helpers.py | [
"Apache-2.0"
] | Python | export_pointingtable_to_hdf5 | null | def export_pointingtable_to_hdf5(pt: PointingTable, filename):
""" Export a PointingTable to HDF5 format
:param pt:
:param filename:
:return:
"""
if not isinstance(pt, collections.Iterable):
pt = [pt]
with h5py.File(filename, 'w') as f:
f.attrs['number_data_models'] = l... | Export a PointingTable to HDF5 format
:param pt:
:param filename:
:return:
| Export a PointingTable to HDF5 format | [
"Export",
"a",
"PointingTable",
"to",
"HDF5",
"format"
] | def export_pointingtable_to_hdf5(pt: PointingTable, filename):
if not isinstance(pt, collections.Iterable):
pt = [pt]
with h5py.File(filename, 'w') as f:
f.attrs['number_data_models'] = len(pt)
for i, g in enumerate(pt):
assert isinstance(g, PointingTable)
gf = f.... | [
"def",
"export_pointingtable_to_hdf5",
"(",
"pt",
":",
"PointingTable",
",",
"filename",
")",
":",
"if",
"not",
"isinstance",
"(",
"pt",
",",
"collections",
".",
"Iterable",
")",
":",
"pt",
"=",
"[",
"pt",
"]",
"with",
"h5py",
".",
"File",
"(",
"filename... | Export a PointingTable to HDF5 format | [
"Export",
"a",
"PointingTable",
"to",
"HDF5",
"format"
] | [
"\"\"\" Export a PointingTable to HDF5 format\n\n :param pt:\n :param filename:\n :return:\n \"\"\""
] | [
{
"param": "pt",
"type": "PointingTable"
},
{
"param": "filename",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "pt",
"type": "PointingTable",
"docstring": null,
"docstring_tokens": [
"None"
],
"default": nul... |
105f3cd61220f07455efb755a5d66c2227f3c2f8 | ska-telescope/algorithm-reference-library | data_models/data_model_helpers.py | [
"Apache-2.0"
] | Python | import_pointingtable_from_hdf5 | <not_specific> | def import_pointingtable_from_hdf5(filename):
"""Import PointingTable(s) from HDF5 format
:param filename:
:return: single pointingtable or list of pointingtables
"""
with h5py.File(filename, 'r') as f:
nptlist = f.attrs['number_data_models']
ptlist = [convert_hdf_to_pointingta... | Import PointingTable(s) from HDF5 format
:param filename:
:return: single pointingtable or list of pointingtables
| Import PointingTable(s) from HDF5 format | [
"Import",
"PointingTable",
"(",
"s",
")",
"from",
"HDF5",
"format"
] | def import_pointingtable_from_hdf5(filename):
with h5py.File(filename, 'r') as f:
nptlist = f.attrs['number_data_models']
ptlist = [convert_hdf_to_pointingtable(f['PointingTable%d' % i]) for i in range(nptlist)]
if nptlist == 1:
return ptlist[0]
else:
return p... | [
"def",
"import_pointingtable_from_hdf5",
"(",
"filename",
")",
":",
"with",
"h5py",
".",
"File",
"(",
"filename",
",",
"'r'",
")",
"as",
"f",
":",
"nptlist",
"=",
"f",
".",
"attrs",
"[",
"'number_data_models'",
"]",
"ptlist",
"=",
"[",
"convert_hdf_to_pointi... | Import PointingTable(s) from HDF5 format | [
"Import",
"PointingTable",
"(",
"s",
")",
"from",
"HDF5",
"format"
] | [
"\"\"\"Import PointingTable(s) from HDF5 format\n\n :param filename:\n :return: single pointingtable or list of pointingtables\n \"\"\""
] | [
{
"param": "filename",
"type": null
}
] | {
"returns": [
{
"docstring": "single pointingtable or list of pointingtables",
"docstring_tokens": [
"single",
"pointingtable",
"or",
"list",
"of",
"pointingtables"
],
"type": null
}
],
"raises": [],
"params": [
{
"identi... |
105f3cd61220f07455efb755a5d66c2227f3c2f8 | ska-telescope/algorithm-reference-library | data_models/data_model_helpers.py | [
"Apache-2.0"
] | Python | convert_hdf_to_image | <not_specific> | def convert_hdf_to_image(f):
""" Convert HDF root to an Image
:param f:
:return:
"""
if 'ARL_data_model' in f.attrs.keys() and f.attrs['ARL_data_model'] == "Image":
data = numpy.array(f['data'])
polarisation_frame = PolarisationFrame(f.attrs['polarisation_frame'])
wcs = WCS(... | Convert HDF root to an Image
:param f:
:return:
| Convert HDF root to an Image | [
"Convert",
"HDF",
"root",
"to",
"an",
"Image"
] | def convert_hdf_to_image(f):
if 'ARL_data_model' in f.attrs.keys() and f.attrs['ARL_data_model'] == "Image":
data = numpy.array(f['data'])
polarisation_frame = PolarisationFrame(f.attrs['polarisation_frame'])
wcs = WCS(f.attrs['wcs'])
im = create_image_from_array(data, wcs=wcs,
... | [
"def",
"convert_hdf_to_image",
"(",
"f",
")",
":",
"if",
"'ARL_data_model'",
"in",
"f",
".",
"attrs",
".",
"keys",
"(",
")",
"and",
"f",
".",
"attrs",
"[",
"'ARL_data_model'",
"]",
"==",
"\"Image\"",
":",
"data",
"=",
"numpy",
".",
"array",
"(",
"f",
... | Convert HDF root to an Image | [
"Convert",
"HDF",
"root",
"to",
"an",
"Image"
] | [
"\"\"\" Convert HDF root to an Image\n\n :param f:\n :return:\n \"\"\""
] | [
{
"param": "f",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "f",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"is... |
105f3cd61220f07455efb755a5d66c2227f3c2f8 | ska-telescope/algorithm-reference-library | data_models/data_model_helpers.py | [
"Apache-2.0"
] | Python | export_skymodel_to_hdf5 | null | def export_skymodel_to_hdf5(sm, filename):
""" Export a Skymodel to HDF5 format
:param sm:
:param filename:
:return:
"""
if not isinstance(sm, collections.Iterable):
sm = [sm]
with h5py.File(filename, 'w') as f:
f.attrs['number_data_models'] = len(sm)
for i... | Export a Skymodel to HDF5 format
:param sm:
:param filename:
:return:
| Export a Skymodel to HDF5 format | [
"Export",
"a",
"Skymodel",
"to",
"HDF5",
"format"
] | def export_skymodel_to_hdf5(sm, filename):
if not isinstance(sm, collections.Iterable):
sm = [sm]
with h5py.File(filename, 'w') as f:
f.attrs['number_data_models'] = len(sm)
for i, s in enumerate(sm):
assert isinstance(s, SkyModel)
sf = f.create_group('SkyModel%d'... | [
"def",
"export_skymodel_to_hdf5",
"(",
"sm",
",",
"filename",
")",
":",
"if",
"not",
"isinstance",
"(",
"sm",
",",
"collections",
".",
"Iterable",
")",
":",
"sm",
"=",
"[",
"sm",
"]",
"with",
"h5py",
".",
"File",
"(",
"filename",
",",
"'w'",
")",
"as... | Export a Skymodel to HDF5 format | [
"Export",
"a",
"Skymodel",
"to",
"HDF5",
"format"
] | [
"\"\"\" Export a Skymodel to HDF5 format\n\n :param sm:\n :param filename:\n :return:\n \"\"\""
] | [
{
"param": "sm",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "sm",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"i... |
105f3cd61220f07455efb755a5d66c2227f3c2f8 | ska-telescope/algorithm-reference-library | data_models/data_model_helpers.py | [
"Apache-2.0"
] | Python | import_skymodel_from_hdf5 | <not_specific> | def import_skymodel_from_hdf5(filename):
"""Import a Skymodel from HDF5 format
:param filename:
:return: SkyModel
"""
with h5py.File(filename, 'r') as f:
nsmlist = f.attrs['number_data_models']
smlist = [convert_hdf_to_skymodel(f['SkyModel%d' % i]) for i in range(nsmlist)]
... | Import a Skymodel from HDF5 format
:param filename:
:return: SkyModel
| Import a Skymodel from HDF5 format | [
"Import",
"a",
"Skymodel",
"from",
"HDF5",
"format"
] | def import_skymodel_from_hdf5(filename):
with h5py.File(filename, 'r') as f:
nsmlist = f.attrs['number_data_models']
smlist = [convert_hdf_to_skymodel(f['SkyModel%d' % i]) for i in range(nsmlist)]
if nsmlist == 1:
return smlist[0]
else:
return smlist | [
"def",
"import_skymodel_from_hdf5",
"(",
"filename",
")",
":",
"with",
"h5py",
".",
"File",
"(",
"filename",
",",
"'r'",
")",
"as",
"f",
":",
"nsmlist",
"=",
"f",
".",
"attrs",
"[",
"'number_data_models'",
"]",
"smlist",
"=",
"[",
"convert_hdf_to_skymodel",
... | Import a Skymodel from HDF5 format | [
"Import",
"a",
"Skymodel",
"from",
"HDF5",
"format"
] | [
"\"\"\"Import a Skymodel from HDF5 format\n\n :param filename:\n :return: SkyModel\n \"\"\""
] | [
{
"param": "filename",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
105f3cd61220f07455efb755a5d66c2227f3c2f8 | ska-telescope/algorithm-reference-library | data_models/data_model_helpers.py | [
"Apache-2.0"
] | Python | convert_hdf_to_griddata | <not_specific> | def convert_hdf_to_griddata(f):
""" Convert HDF root to a GridData
:param f:
:return:
"""
assert f.attrs['ARL_data_model'] == "GridData", "Not a GridData"
data = numpy.array(f['data'])
polarisation_frame = PolarisationFrame(f.attrs['polarisation_frame'])
grid_wcs = WCS(f.attrs['grid_wcs... | Convert HDF root to a GridData
:param f:
:return:
| Convert HDF root to a GridData | [
"Convert",
"HDF",
"root",
"to",
"a",
"GridData"
] | def convert_hdf_to_griddata(f):
assert f.attrs['ARL_data_model'] == "GridData", "Not a GridData"
data = numpy.array(f['data'])
polarisation_frame = PolarisationFrame(f.attrs['polarisation_frame'])
grid_wcs = WCS(f.attrs['grid_wcs'])
projection_wcs = WCS(f.attrs['projection_wcs'])
gd = create_gri... | [
"def",
"convert_hdf_to_griddata",
"(",
"f",
")",
":",
"assert",
"f",
".",
"attrs",
"[",
"'ARL_data_model'",
"]",
"==",
"\"GridData\"",
",",
"\"Not a GridData\"",
"data",
"=",
"numpy",
".",
"array",
"(",
"f",
"[",
"'data'",
"]",
")",
"polarisation_frame",
"="... | Convert HDF root to a GridData | [
"Convert",
"HDF",
"root",
"to",
"a",
"GridData"
] | [
"\"\"\" Convert HDF root to a GridData\n\n :param f:\n :return:\n \"\"\""
] | [
{
"param": "f",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "f",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"is... |
105f3cd61220f07455efb755a5d66c2227f3c2f8 | ska-telescope/algorithm-reference-library | data_models/data_model_helpers.py | [
"Apache-2.0"
] | Python | export_griddata_to_hdf5 | null | def export_griddata_to_hdf5(gd, filename):
""" Export a GridData to HDF5 format
:param gd:
:param filename:
:return:
"""
if not isinstance(gd, collections.Iterable):
gd = [gd]
with h5py.File(filename, 'w') as f:
f.attrs['number_data_models'] = len(gd)
for i, m i... | Export a GridData to HDF5 format
:param gd:
:param filename:
:return:
| Export a GridData to HDF5 format | [
"Export",
"a",
"GridData",
"to",
"HDF5",
"format"
] | def export_griddata_to_hdf5(gd, filename):
if not isinstance(gd, collections.Iterable):
gd = [gd]
with h5py.File(filename, 'w') as f:
f.attrs['number_data_models'] = len(gd)
for i, m in enumerate(gd):
assert isinstance(m, GridData)
mf = f.create_group('GridData%d'... | [
"def",
"export_griddata_to_hdf5",
"(",
"gd",
",",
"filename",
")",
":",
"if",
"not",
"isinstance",
"(",
"gd",
",",
"collections",
".",
"Iterable",
")",
":",
"gd",
"=",
"[",
"gd",
"]",
"with",
"h5py",
".",
"File",
"(",
"filename",
",",
"'w'",
")",
"as... | Export a GridData to HDF5 format | [
"Export",
"a",
"GridData",
"to",
"HDF5",
"format"
] | [
"\"\"\" Export a GridData to HDF5 format\n\n :param gd:\n :param filename:\n :return:\n \"\"\""
] | [
{
"param": "gd",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "gd",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"i... |
105f3cd61220f07455efb755a5d66c2227f3c2f8 | ska-telescope/algorithm-reference-library | data_models/data_model_helpers.py | [
"Apache-2.0"
] | Python | convert_hdf_to_convolutionfunction | <not_specific> | def convert_hdf_to_convolutionfunction(f):
""" Convert HDF root to a ConvolutionFunction
:param f:
:return:
"""
assert f.attrs['ARL_data_model'] == "ConvolutionFunction", "Not a ConvolutionFunction"
data = numpy.array(f['data'])
polarisation_frame = PolarisationFrame(f.attrs['polarisation_f... | Convert HDF root to a ConvolutionFunction
:param f:
:return:
| Convert HDF root to a ConvolutionFunction | [
"Convert",
"HDF",
"root",
"to",
"a",
"ConvolutionFunction"
] | def convert_hdf_to_convolutionfunction(f):
assert f.attrs['ARL_data_model'] == "ConvolutionFunction", "Not a ConvolutionFunction"
data = numpy.array(f['data'])
polarisation_frame = PolarisationFrame(f.attrs['polarisation_frame'])
grid_wcs = WCS(f.attrs['grid_wcs'])
projection_wcs = WCS(f.attrs['proj... | [
"def",
"convert_hdf_to_convolutionfunction",
"(",
"f",
")",
":",
"assert",
"f",
".",
"attrs",
"[",
"'ARL_data_model'",
"]",
"==",
"\"ConvolutionFunction\"",
",",
"\"Not a ConvolutionFunction\"",
"data",
"=",
"numpy",
".",
"array",
"(",
"f",
"[",
"'data'",
"]",
"... | Convert HDF root to a ConvolutionFunction | [
"Convert",
"HDF",
"root",
"to",
"a",
"ConvolutionFunction"
] | [
"\"\"\" Convert HDF root to a ConvolutionFunction\n\n :param f:\n :return:\n \"\"\""
] | [
{
"param": "f",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "f",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"is... |
105f3cd61220f07455efb755a5d66c2227f3c2f8 | ska-telescope/algorithm-reference-library | data_models/data_model_helpers.py | [
"Apache-2.0"
] | Python | export_convolutionfunction_to_hdf5 | null | def export_convolutionfunction_to_hdf5(cf, filename):
""" Export a ConvolutionFunction to HDF5 format
:param cf:
:param filename:
:return:
"""
if not isinstance(cf, collections.Iterable):
cf = [cf]
with h5py.File(filename, 'w') as f:
f.attrs['number_data_models'] = len(... | Export a ConvolutionFunction to HDF5 format
:param cf:
:param filename:
:return:
| Export a ConvolutionFunction to HDF5 format | [
"Export",
"a",
"ConvolutionFunction",
"to",
"HDF5",
"format"
] | def export_convolutionfunction_to_hdf5(cf, filename):
if not isinstance(cf, collections.Iterable):
cf = [cf]
with h5py.File(filename, 'w') as f:
f.attrs['number_data_models'] = len(cf)
for i, m in enumerate(cf):
assert isinstance(m, ConvolutionFunction)
mf = f.cre... | [
"def",
"export_convolutionfunction_to_hdf5",
"(",
"cf",
",",
"filename",
")",
":",
"if",
"not",
"isinstance",
"(",
"cf",
",",
"collections",
".",
"Iterable",
")",
":",
"cf",
"=",
"[",
"cf",
"]",
"with",
"h5py",
".",
"File",
"(",
"filename",
",",
"'w'",
... | Export a ConvolutionFunction to HDF5 format | [
"Export",
"a",
"ConvolutionFunction",
"to",
"HDF5",
"format"
] | [
"\"\"\" Export a ConvolutionFunction to HDF5 format\n\n :param cf:\n :param filename:\n :return:\n \"\"\""
] | [
{
"param": "cf",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "cf",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"i... |
105f3cd61220f07455efb755a5d66c2227f3c2f8 | ska-telescope/algorithm-reference-library | data_models/data_model_helpers.py | [
"Apache-2.0"
] | Python | memory_data_model_to_buffer | <not_specific> | def memory_data_model_to_buffer(model, jbuff, dm):
""" Copy a memory data model to a buffer data model
The file type is derived from the file extension. All are hdf only with the exception of Imaghe which can also be
fits.
:param model: Memory data model to be sent to buffer
:param jbuff: JSON des... | Copy a memory data model to a buffer data model
The file type is derived from the file extension. All are hdf only with the exception of Imaghe which can also be
fits.
:param model: Memory data model to be sent to buffer
:param jbuff: JSON describing buffer
:param dm: JSON describing data model
... | Copy a memory data model to a buffer data model
The file type is derived from the file extension. All are hdf only with the exception of Imaghe which can also be
fits. | [
"Copy",
"a",
"memory",
"data",
"model",
"to",
"a",
"buffer",
"data",
"model",
"The",
"file",
"type",
"is",
"derived",
"from",
"the",
"file",
"extension",
".",
"All",
"are",
"hdf",
"only",
"with",
"the",
"exception",
"of",
"Imaghe",
"which",
"can",
"also"... | def memory_data_model_to_buffer(model, jbuff, dm):
name = jbuff["directory"] + dm["name"]
import os
_, file_extension = os.path.splitext(dm["name"])
if dm["data_model"] == "BlockVisibility":
return export_blockvisibility_to_hdf5(model, name)
elif dm["data_model"] == "Image":
if file_... | [
"def",
"memory_data_model_to_buffer",
"(",
"model",
",",
"jbuff",
",",
"dm",
")",
":",
"name",
"=",
"jbuff",
"[",
"\"directory\"",
"]",
"+",
"dm",
"[",
"\"name\"",
"]",
"import",
"os",
"_",
",",
"file_extension",
"=",
"os",
".",
"path",
".",
"splitext",
... | Copy a memory data model to a buffer data model
The file type is derived from the file extension. | [
"Copy",
"a",
"memory",
"data",
"model",
"to",
"a",
"buffer",
"data",
"model",
"The",
"file",
"type",
"is",
"derived",
"from",
"the",
"file",
"extension",
"."
] | [
"\"\"\" Copy a memory data model to a buffer data model\n\n The file type is derived from the file extension. All are hdf only with the exception of Imaghe which can also be\n fits.\n\n :param model: Memory data model to be sent to buffer\n :param jbuff: JSON describing buffer\n :param dm: JSON descr... | [
{
"param": "model",
"type": null
},
{
"param": "jbuff",
"type": null
},
{
"param": "dm",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "model",
"type": null,
"docstring": "Memory data model to be sent to buffer",
"docstring_tokens": [
"Memory",
"data",
"model",
"to",
"be",
"sent",
"to",
"buffer"
... |
105f3cd61220f07455efb755a5d66c2227f3c2f8 | ska-telescope/algorithm-reference-library | data_models/data_model_helpers.py | [
"Apache-2.0"
] | Python | buffer_data_model_to_memory | <not_specific> | def buffer_data_model_to_memory(jbuff, dm):
"""Copy a buffer data model into memory data model
The file type is derived from the file extension. All are hdf only with the exception of Imaghe which can also be
fits.
:param jbuff: JSON describing buffer
:param dm: JSON describing data model
:ret... | Copy a buffer data model into memory data model
The file type is derived from the file extension. All are hdf only with the exception of Imaghe which can also be
fits.
:param jbuff: JSON describing buffer
:param dm: JSON describing data model
:return: data model
| Copy a buffer data model into memory data model
The file type is derived from the file extension. All are hdf only with the exception of Imaghe which can also be
fits. | [
"Copy",
"a",
"buffer",
"data",
"model",
"into",
"memory",
"data",
"model",
"The",
"file",
"type",
"is",
"derived",
"from",
"the",
"file",
"extension",
".",
"All",
"are",
"hdf",
"only",
"with",
"the",
"exception",
"of",
"Imaghe",
"which",
"can",
"also",
"... | def buffer_data_model_to_memory(jbuff, dm):
import os
name = os.path.join(jbuff["directory"], dm["name"])
import os
_, file_extension = os.path.splitext(dm["name"])
if dm["data_model"] == "BlockVisibility":
return import_blockvisibility_from_hdf5(name)
elif dm["data_model"] == "Image":
... | [
"def",
"buffer_data_model_to_memory",
"(",
"jbuff",
",",
"dm",
")",
":",
"import",
"os",
"name",
"=",
"os",
".",
"path",
".",
"join",
"(",
"jbuff",
"[",
"\"directory\"",
"]",
",",
"dm",
"[",
"\"name\"",
"]",
")",
"import",
"os",
"_",
",",
"file_extensi... | Copy a buffer data model into memory data model
The file type is derived from the file extension. | [
"Copy",
"a",
"buffer",
"data",
"model",
"into",
"memory",
"data",
"model",
"The",
"file",
"type",
"is",
"derived",
"from",
"the",
"file",
"extension",
"."
] | [
"\"\"\"Copy a buffer data model into memory data model\n\n The file type is derived from the file extension. All are hdf only with the exception of Imaghe which can also be\n fits.\n\n :param jbuff: JSON describing buffer\n :param dm: JSON describing data model\n :return: data model\n \"\"\""
] | [
{
"param": "jbuff",
"type": null
},
{
"param": "dm",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "jbuff",
"type": null,
"docstring": "JSON describing buffer",
"docstring_tokens": [
"JSON",
"describ... |
1068899a1b710db312865da748e3c222d117fc7d | ska-telescope/algorithm-reference-library | workflows/arlexecute/pipelines/pipeline_arlexecute.py | [
"Apache-2.0"
] | Python | continuum_imaging_list_arlexecute_workflow | <not_specific> | def continuum_imaging_list_arlexecute_workflow(vis_list, model_imagelist, context, gcfcf=None,
vis_slices=1, facets=1, **kwargs):
""" Create graph for the continuum imaging pipeline.
Same as ICAL but with no selfcal.
:param vis_list:
:param model_... | Create graph for the continuum imaging pipeline.
Same as ICAL but with no selfcal.
:param vis_list:
:param model_imagelist:
:param context: Imaging context
:param kwargs: Parameters for functions in components
:return:
| Create graph for the continuum imaging pipeline.
Same as ICAL but with no selfcal. | [
"Create",
"graph",
"for",
"the",
"continuum",
"imaging",
"pipeline",
".",
"Same",
"as",
"ICAL",
"but",
"with",
"no",
"selfcal",
"."
] | def continuum_imaging_list_arlexecute_workflow(vis_list, model_imagelist, context, gcfcf=None,
vis_slices=1, facets=1, **kwargs):
if gcfcf is None:
gcfcf = [arlexecute.execute(create_pswf_convolutionfunction)(model_imagelist[0])]
psf_imagelist = invert_list... | [
"def",
"continuum_imaging_list_arlexecute_workflow",
"(",
"vis_list",
",",
"model_imagelist",
",",
"context",
",",
"gcfcf",
"=",
"None",
",",
"vis_slices",
"=",
"1",
",",
"facets",
"=",
"1",
",",
"**",
"kwargs",
")",
":",
"if",
"gcfcf",
"is",
"None",
":",
... | Create graph for the continuum imaging pipeline. | [
"Create",
"graph",
"for",
"the",
"continuum",
"imaging",
"pipeline",
"."
] | [
"\"\"\" Create graph for the continuum imaging pipeline.\n \n Same as ICAL but with no selfcal.\n \n :param vis_list:\n :param model_imagelist:\n :param context: Imaging context\n :param kwargs: Parameters for functions in components\n :return:\n \"\"\""
] | [
{
"param": "vis_list",
"type": null
},
{
"param": "model_imagelist",
"type": null
},
{
"param": "context",
"type": null
},
{
"param": "gcfcf",
"type": null
},
{
"param": "vis_slices",
"type": null
},
{
"param": "facets",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis_list",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
1068899a1b710db312865da748e3c222d117fc7d | ska-telescope/algorithm-reference-library | workflows/arlexecute/pipelines/pipeline_arlexecute.py | [
"Apache-2.0"
] | Python | spectral_line_imaging_list_arlexecute_workflow | <not_specific> | def spectral_line_imaging_list_arlexecute_workflow(vis_list, model_imagelist, context, continuum_model_imagelist=None,
vis_slices=1, facets=1, gcfcf=None, **kwargs):
"""Create graph for spectral line imaging pipeline
Uses the continuum imaging arlexecute pipel... | Create graph for spectral line imaging pipeline
Uses the continuum imaging arlexecute pipeline after subtraction of a continuum model
:param vis_list: List of visibility components
:param model_imagelist: Spectral line model graph
:param continuum_model_imagelist: Continuum model list
:param c... | Create graph for spectral line imaging pipeline
Uses the continuum imaging arlexecute pipeline after subtraction of a continuum model | [
"Create",
"graph",
"for",
"spectral",
"line",
"imaging",
"pipeline",
"Uses",
"the",
"continuum",
"imaging",
"arlexecute",
"pipeline",
"after",
"subtraction",
"of",
"a",
"continuum",
"model"
] | def spectral_line_imaging_list_arlexecute_workflow(vis_list, model_imagelist, context, continuum_model_imagelist=None,
vis_slices=1, facets=1, gcfcf=None, **kwargs):
if continuum_model_imagelist is not None:
vis_list = predict_list_arlexecute_workflow(vis_l... | [
"def",
"spectral_line_imaging_list_arlexecute_workflow",
"(",
"vis_list",
",",
"model_imagelist",
",",
"context",
",",
"continuum_model_imagelist",
"=",
"None",
",",
"vis_slices",
"=",
"1",
",",
"facets",
"=",
"1",
",",
"gcfcf",
"=",
"None",
",",
"**",
"kwargs",
... | Create graph for spectral line imaging pipeline
Uses the continuum imaging arlexecute pipeline after subtraction of a continuum model | [
"Create",
"graph",
"for",
"spectral",
"line",
"imaging",
"pipeline",
"Uses",
"the",
"continuum",
"imaging",
"arlexecute",
"pipeline",
"after",
"subtraction",
"of",
"a",
"continuum",
"model"
] | [
"\"\"\"Create graph for spectral line imaging pipeline\n\n Uses the continuum imaging arlexecute pipeline after subtraction of a continuum model\n \n :param vis_list: List of visibility components\n :param model_imagelist: Spectral line model graph\n :param continuum_model_imagelist: Continuum model ... | [
{
"param": "vis_list",
"type": null
},
{
"param": "model_imagelist",
"type": null
},
{
"param": "context",
"type": null
},
{
"param": "continuum_model_imagelist",
"type": null
},
{
"param": "vis_slices",
"type": null
},
{
"param": "facets",
"type":... | {
"returns": [
{
"docstring": "(deconvolved model, residual, restored)",
"docstring_tokens": [
"(",
"deconvolved",
"model",
"residual",
"restored",
")"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis_li... |
f0a58a524840573c35f43d989c05950bd997fcb8 | ska-telescope/algorithm-reference-library | processing_components/skycomponent/operations.py | [
"Apache-2.0"
] | Python | remove_neighbouring_components | <not_specific> | def remove_neighbouring_components(comps, distance):
""" Remove the faintest of a pair of components that are within a specified distance
:param comps:
:param target_comps:
:param distance: Minimum distance
:return: Indices of components in target_comps, selected components
"""
ncomps = len... | Remove the faintest of a pair of components that are within a specified distance
:param comps:
:param target_comps:
:param distance: Minimum distance
:return: Indices of components in target_comps, selected components
| Remove the faintest of a pair of components that are within a specified distance | [
"Remove",
"the",
"faintest",
"of",
"a",
"pair",
"of",
"components",
"that",
"are",
"within",
"a",
"specified",
"distance"
] | def remove_neighbouring_components(comps, distance):
ncomps = len(comps)
ok = ncomps * [True]
for i in range(ncomps):
if ok[i]:
for j in range(i+1, ncomps):
if ok[j]:
d = comps[i].direction.separation(comps[j].direction).rad
if d < ... | [
"def",
"remove_neighbouring_components",
"(",
"comps",
",",
"distance",
")",
":",
"ncomps",
"=",
"len",
"(",
"comps",
")",
"ok",
"=",
"ncomps",
"*",
"[",
"True",
"]",
"for",
"i",
"in",
"range",
"(",
"ncomps",
")",
":",
"if",
"ok",
"[",
"i",
"]",
":... | Remove the faintest of a pair of components that are within a specified distance | [
"Remove",
"the",
"faintest",
"of",
"a",
"pair",
"of",
"components",
"that",
"are",
"within",
"a",
"specified",
"distance"
] | [
"\"\"\" Remove the faintest of a pair of components that are within a specified distance\n\n :param comps:\n :param target_comps:\n :param distance: Minimum distance\n :return: Indices of components in target_comps, selected components\n \"\"\""
] | [
{
"param": "comps",
"type": null
},
{
"param": "distance",
"type": null
}
] | {
"returns": [
{
"docstring": "Indices of components in target_comps, selected components",
"docstring_tokens": [
"Indices",
"of",
"components",
"in",
"target_comps",
"selected",
"components"
],
"type": null
}
],
"raises": [],... |
f0a58a524840573c35f43d989c05950bd997fcb8 | ska-telescope/algorithm-reference-library | processing_components/skycomponent/operations.py | [
"Apache-2.0"
] | Python | find_skycomponents | List[Skycomponent] | def find_skycomponents(im: Image, fwhm=1.0, threshold=1.0, npixels=5) -> List[Skycomponent]:
""" Find gaussian components in Image above a certain threshold as Skycomponent
:param im: Image to be searched
:param fwhm: Full width half maximum of gaussian in pixels
:param threshold: Threshold for compone... | Find gaussian components in Image above a certain threshold as Skycomponent
:param im: Image to be searched
:param fwhm: Full width half maximum of gaussian in pixels
:param threshold: Threshold for component detection. Default: 1 Jy.
:param npixels: Number of connected pixels required
:return: li... | Find gaussian components in Image above a certain threshold as Skycomponent | [
"Find",
"gaussian",
"components",
"in",
"Image",
"above",
"a",
"certain",
"threshold",
"as",
"Skycomponent"
] | def find_skycomponents(im: Image, fwhm=1.0, threshold=1.0, npixels=5) -> List[Skycomponent]:
assert isinstance(im, Image)
log.info("find_skycomponents: Finding components in Image by segmentation")
sigma = fwhm * gaussian_fwhm_to_sigma
kernel = Gaussian2DKernel(sigma, x_size=int(1.5 * fwhm), y_size=int(... | [
"def",
"find_skycomponents",
"(",
"im",
":",
"Image",
",",
"fwhm",
"=",
"1.0",
",",
"threshold",
"=",
"1.0",
",",
"npixels",
"=",
"5",
")",
"->",
"List",
"[",
"Skycomponent",
"]",
":",
"assert",
"isinstance",
"(",
"im",
",",
"Image",
")",
"log",
".",... | Find gaussian components in Image above a certain threshold as Skycomponent | [
"Find",
"gaussian",
"components",
"in",
"Image",
"above",
"a",
"certain",
"threshold",
"as",
"Skycomponent"
] | [
"\"\"\" Find gaussian components in Image above a certain threshold as Skycomponent\n\n :param im: Image to be searched\n :param fwhm: Full width half maximum of gaussian in pixels\n :param threshold: Threshold for component detection. Default: 1 Jy.\n :param npixels: Number of connected pixels required... | [
{
"param": "im",
"type": "Image"
},
{
"param": "fwhm",
"type": null
},
{
"param": "threshold",
"type": null
},
{
"param": "npixels",
"type": null
}
] | {
"returns": [
{
"docstring": "list of sky components",
"docstring_tokens": [
"list",
"of",
"sky",
"components"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "im",
"type": "Image",
"docstring": "Image to be se... |
f0a58a524840573c35f43d989c05950bd997fcb8 | ska-telescope/algorithm-reference-library | processing_components/skycomponent/operations.py | [
"Apache-2.0"
] | Python | apply_beam_to_skycomponent | Union[Skycomponent, List[Skycomponent]] | def apply_beam_to_skycomponent(sc: Union[Skycomponent, List[Skycomponent]], beam: Image) \
-> Union[Skycomponent, List[Skycomponent]]:
""" Insert a Skycomponent into an image
:param beam:
:param sc: SkyComponent or list of SkyComponents
:return: List of skycomponents
"""
assert isinstan... | Insert a Skycomponent into an image
:param beam:
:param sc: SkyComponent or list of SkyComponents
:return: List of skycomponents
| Insert a Skycomponent into an image | [
"Insert",
"a",
"Skycomponent",
"into",
"an",
"image"
] | def apply_beam_to_skycomponent(sc: Union[Skycomponent, List[Skycomponent]], beam: Image) \
-> Union[Skycomponent, List[Skycomponent]]:
assert isinstance(beam, Image)
single = not isinstance(sc, collections.Iterable)
if single:
sc = [sc]
nchan, npol, ny, nx = beam.shape
log.debug('app... | [
"def",
"apply_beam_to_skycomponent",
"(",
"sc",
":",
"Union",
"[",
"Skycomponent",
",",
"List",
"[",
"Skycomponent",
"]",
"]",
",",
"beam",
":",
"Image",
")",
"->",
"Union",
"[",
"Skycomponent",
",",
"List",
"[",
"Skycomponent",
"]",
"]",
":",
"assert",
... | Insert a Skycomponent into an image | [
"Insert",
"a",
"Skycomponent",
"into",
"an",
"image"
] | [
"\"\"\" Insert a Skycomponent into an image\n\n :param beam:\n :param sc: SkyComponent or list of SkyComponents\n :return: List of skycomponents\n \"\"\""
] | [
{
"param": "sc",
"type": "Union[Skycomponent, List[Skycomponent]]"
},
{
"param": "beam",
"type": "Image"
}
] | {
"returns": [
{
"docstring": "List of skycomponents",
"docstring_tokens": [
"List",
"of",
"skycomponents"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "sc",
"type": "Union[Skycomponent, List[Skycomponent]]",
"docstr... |
f0a58a524840573c35f43d989c05950bd997fcb8 | ska-telescope/algorithm-reference-library | processing_components/skycomponent/operations.py | [
"Apache-2.0"
] | Python | insert_skycomponent | Image | def insert_skycomponent(im: Image, sc: Union[Skycomponent, List[Skycomponent]], insert_method='Nearest',
bandwidth=1.0, support=8) -> Image:
""" Insert a Skycomponent into an image
:param im:
:param sc: SkyComponent or list of SkyComponents
:param insert_method: '' | 'Sinc' ... | Insert a Skycomponent into an image
:param im:
:param sc: SkyComponent or list of SkyComponents
:param insert_method: '' | 'Sinc' | 'Lanczos'
:param bandwidth: Fractional of uv plane to optimise over (1.0)
:param support: Support of kernel (7)
:return: image
| Insert a Skycomponent into an image | [
"Insert",
"a",
"Skycomponent",
"into",
"an",
"image"
] | def insert_skycomponent(im: Image, sc: Union[Skycomponent, List[Skycomponent]], insert_method='Nearest',
bandwidth=1.0, support=8) -> Image:
assert isinstance(im, Image)
support = int(support / bandwidth)
nchan, npol, ny, nx = im.data.shape
if not isinstance(sc, collections.Itera... | [
"def",
"insert_skycomponent",
"(",
"im",
":",
"Image",
",",
"sc",
":",
"Union",
"[",
"Skycomponent",
",",
"List",
"[",
"Skycomponent",
"]",
"]",
",",
"insert_method",
"=",
"'Nearest'",
",",
"bandwidth",
"=",
"1.0",
",",
"support",
"=",
"8",
")",
"->",
... | Insert a Skycomponent into an image | [
"Insert",
"a",
"Skycomponent",
"into",
"an",
"image"
] | [
"\"\"\" Insert a Skycomponent into an image\n \n :param im:\n :param sc: SkyComponent or list of SkyComponents\n :param insert_method: '' | 'Sinc' | 'Lanczos'\n :param bandwidth: Fractional of uv plane to optimise over (1.0)\n :param support: Support of kernel (7)\n :return: image\n \"\"\""
... | [
{
"param": "im",
"type": "Image"
},
{
"param": "sc",
"type": "Union[Skycomponent, List[Skycomponent]]"
},
{
"param": "insert_method",
"type": null
},
{
"param": "bandwidth",
"type": null
},
{
"param": "support",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "im",
"type": "Image",
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
f0a58a524840573c35f43d989c05950bd997fcb8 | ska-telescope/algorithm-reference-library | processing_components/skycomponent/operations.py | [
"Apache-2.0"
] | Python | image_voronoi_iter | collections.Iterable | def image_voronoi_iter(im: Image, components: Skycomponent) -> collections.Iterable:
"""Iterate through Voronoi decomposition, returning a generator yielding fullsize images
:param im: Image
:param components: Components to define Voronoi decomposition
"""
if len(components) == 1:
mask = nu... | Iterate through Voronoi decomposition, returning a generator yielding fullsize images
:param im: Image
:param components: Components to define Voronoi decomposition
| Iterate through Voronoi decomposition, returning a generator yielding fullsize images | [
"Iterate",
"through",
"Voronoi",
"decomposition",
"returning",
"a",
"generator",
"yielding",
"fullsize",
"images"
] | def image_voronoi_iter(im: Image, components: Skycomponent) -> collections.Iterable:
if len(components) == 1:
mask = numpy.ones(im.data.shape)
yield create_image_from_array(mask, wcs=im.wcs,
polarisation_frame=im.polarisation_frame)
else:
vor, vertex... | [
"def",
"image_voronoi_iter",
"(",
"im",
":",
"Image",
",",
"components",
":",
"Skycomponent",
")",
"->",
"collections",
".",
"Iterable",
":",
"if",
"len",
"(",
"components",
")",
"==",
"1",
":",
"mask",
"=",
"numpy",
".",
"ones",
"(",
"im",
".",
"data"... | Iterate through Voronoi decomposition, returning a generator yielding fullsize images | [
"Iterate",
"through",
"Voronoi",
"decomposition",
"returning",
"a",
"generator",
"yielding",
"fullsize",
"images"
] | [
"\"\"\"Iterate through Voronoi decomposition, returning a generator yielding fullsize images\n\n :param im: Image\n :param components: Components to define Voronoi decomposition\n \"\"\""
] | [
{
"param": "im",
"type": "Image"
},
{
"param": "components",
"type": "Skycomponent"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "im",
"type": "Image",
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"is_optional": null
},
{
"identifier": "components",
"type": "Skycomponent",
"docstr... |
84cb04d08b89fb67a952ce6c34745a84cce8db14 | ska-telescope/algorithm-reference-library | workflows/arlexecute/skymodel/skymodel_arlexecute.py | [
"Apache-2.0"
] | Python | predict_skymodel_list_arlexecute_workflow | <not_specific> | def predict_skymodel_list_arlexecute_workflow(obsvis, skymodel_list, context, vis_slices=1, facets=1,
gcfcf=None, docal=False, **kwargs):
"""Predict from a list of skymodels, producing one visibility per skymodel
:param obsvis: "Observed Visibility"
:param skym... | Predict from a list of skymodels, producing one visibility per skymodel
:param obsvis: "Observed Visibility"
:param skymodel_list: skymodel list
:param vis_slices: Number of vis slices (w stack or timeslice)
:param facets: Number of facets (per axis)
:param context: Type of processing e.g. 2d, wsta... | Predict from a list of skymodels, producing one visibility per skymodel | [
"Predict",
"from",
"a",
"list",
"of",
"skymodels",
"producing",
"one",
"visibility",
"per",
"skymodel"
] | def predict_skymodel_list_arlexecute_workflow(obsvis, skymodel_list, context, vis_slices=1, facets=1,
gcfcf=None, docal=False, **kwargs):
def ft_cal_sm(ov, sm, g):
assert isinstance(ov, Visibility) or isinstance(ov, BlockVisibility), ov
assert isinstance... | [
"def",
"predict_skymodel_list_arlexecute_workflow",
"(",
"obsvis",
",",
"skymodel_list",
",",
"context",
",",
"vis_slices",
"=",
"1",
",",
"facets",
"=",
"1",
",",
"gcfcf",
"=",
"None",
",",
"docal",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"def",
"ft_... | Predict from a list of skymodels, producing one visibility per skymodel | [
"Predict",
"from",
"a",
"list",
"of",
"skymodels",
"producing",
"one",
"visibility",
"per",
"skymodel"
] | [
"\"\"\"Predict from a list of skymodels, producing one visibility per skymodel\n\n :param obsvis: \"Observed Visibility\"\n :param skymodel_list: skymodel list\n :param vis_slices: Number of vis slices (w stack or timeslice)\n :param facets: Number of facets (per axis)\n :param context: Type of proce... | [
{
"param": "obsvis",
"type": null
},
{
"param": "skymodel_list",
"type": null
},
{
"param": "context",
"type": null
},
{
"param": "vis_slices",
"type": null
},
{
"param": "facets",
"type": null
},
{
"param": "gcfcf",
"type": null
},
{
"para... | {
"returns": [
{
"docstring": "List of vis_lists",
"docstring_tokens": [
"List",
"of",
"vis_lists"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "obsvis",
"type": null,
"docstring": null,
"docstring_tokens": [
... |
84cb04d08b89fb67a952ce6c34745a84cce8db14 | ska-telescope/algorithm-reference-library | workflows/arlexecute/skymodel/skymodel_arlexecute.py | [
"Apache-2.0"
] | Python | predict_skymodel_list_compsonly_arlexecute_workflow | <not_specific> | def predict_skymodel_list_compsonly_arlexecute_workflow(obsvis, skymodel_list, docal=False, **kwargs):
"""Predict from a list of component-only skymodels, producing one visibility per skymodel
This is an optimised version of predict_skymodel_list_arlexecute_workflow, working on block
visibilities and i... | Predict from a list of component-only skymodels, producing one visibility per skymodel
This is an optimised version of predict_skymodel_list_arlexecute_workflow, working on block
visibilities and ignoring the image in a skymodel
:param obsvis: "Observed Block Visibility"
:param skymodel_list: skym... | Predict from a list of component-only skymodels, producing one visibility per skymodel
This is an optimised version of predict_skymodel_list_arlexecute_workflow, working on block
visibilities and ignoring the image in a skymodel | [
"Predict",
"from",
"a",
"list",
"of",
"component",
"-",
"only",
"skymodels",
"producing",
"one",
"visibility",
"per",
"skymodel",
"This",
"is",
"an",
"optimised",
"version",
"of",
"predict_skymodel_list_arlexecute_workflow",
"working",
"on",
"block",
"visibilities",
... | def predict_skymodel_list_compsonly_arlexecute_workflow(obsvis, skymodel_list, docal=False, **kwargs):
def ft_cal_sm(obv, sm):
assert isinstance(obv, BlockVisibility), obv
bv = copy_visibility(obv)
bv.data['vis'][...] = 0.0 + 0.0j
assert len(sm.components) > 0
if isinstance(s... | [
"def",
"predict_skymodel_list_compsonly_arlexecute_workflow",
"(",
"obsvis",
",",
"skymodel_list",
",",
"docal",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"def",
"ft_cal_sm",
"(",
"obv",
",",
"sm",
")",
":",
"assert",
"isinstance",
"(",
"obv",
",",
"BlockVi... | Predict from a list of component-only skymodels, producing one visibility per skymodel
This is an optimised version of predict_skymodel_list_arlexecute_workflow, working on block
visibilities and ignoring the image in a skymodel | [
"Predict",
"from",
"a",
"list",
"of",
"component",
"-",
"only",
"skymodels",
"producing",
"one",
"visibility",
"per",
"skymodel",
"This",
"is",
"an",
"optimised",
"version",
"of",
"predict_skymodel_list_arlexecute_workflow",
"working",
"on",
"block",
"visibilities",
... | [
"\"\"\"Predict from a list of component-only skymodels, producing one visibility per skymodel\n \n This is an optimised version of predict_skymodel_list_arlexecute_workflow, working on block\n visibilities and ignoring the image in a skymodel\n\n :param obsvis: \"Observed Block Visibility\"\n :param ... | [
{
"param": "obsvis",
"type": null
},
{
"param": "skymodel_list",
"type": null
},
{
"param": "docal",
"type": null
}
] | {
"returns": [
{
"docstring": "List of vis_lists",
"docstring_tokens": [
"List",
"of",
"vis_lists"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "obsvis",
"type": null,
"docstring": "\"Observed Block Visibility\"",
... |
84cb04d08b89fb67a952ce6c34745a84cce8db14 | ska-telescope/algorithm-reference-library | workflows/arlexecute/skymodel/skymodel_arlexecute.py | [
"Apache-2.0"
] | Python | invert_skymodel_list_arlexecute_workflow | <not_specific> | def invert_skymodel_list_arlexecute_workflow(vis_list, skymodel_list, context, vis_slices=1, facets=1,
gcfcf=None, docal=False, **kwargs):
"""Calibrate and invert from a skymodel, iterating over the skymodel
The visibility and image are scattered, the visibility is ... | Calibrate and invert from a skymodel, iterating over the skymodel
The visibility and image are scattered, the visibility is predicted and calibrated on each part, and then the
parts are assembled. The mask if present, is multiplied in at the end.
:param vis_list: List of Visibility data models
:param ... | Calibrate and invert from a skymodel, iterating over the skymodel
The visibility and image are scattered, the visibility is predicted and calibrated on each part, and then the
parts are assembled. The mask if present, is multiplied in at the end. | [
"Calibrate",
"and",
"invert",
"from",
"a",
"skymodel",
"iterating",
"over",
"the",
"skymodel",
"The",
"visibility",
"and",
"image",
"are",
"scattered",
"the",
"visibility",
"is",
"predicted",
"and",
"calibrated",
"on",
"each",
"part",
"and",
"then",
"the",
"pa... | def invert_skymodel_list_arlexecute_workflow(vis_list, skymodel_list, context, vis_slices=1, facets=1,
gcfcf=None, docal=False, **kwargs):
def ift_ical_sm(v, sm, g):
assert isinstance(v, Visibility) or isinstance(v, BlockVisibility), v
assert isinstance(s... | [
"def",
"invert_skymodel_list_arlexecute_workflow",
"(",
"vis_list",
",",
"skymodel_list",
",",
"context",
",",
"vis_slices",
"=",
"1",
",",
"facets",
"=",
"1",
",",
"gcfcf",
"=",
"None",
",",
"docal",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"def",
"if... | Calibrate and invert from a skymodel, iterating over the skymodel
The visibility and image are scattered, the visibility is predicted and calibrated on each part, and then the
parts are assembled. | [
"Calibrate",
"and",
"invert",
"from",
"a",
"skymodel",
"iterating",
"over",
"the",
"skymodel",
"The",
"visibility",
"and",
"image",
"are",
"scattered",
"the",
"visibility",
"is",
"predicted",
"and",
"calibrated",
"on",
"each",
"part",
"and",
"then",
"the",
"pa... | [
"\"\"\"Calibrate and invert from a skymodel, iterating over the skymodel\n\n The visibility and image are scattered, the visibility is predicted and calibrated on each part, and then the\n parts are assembled. The mask if present, is multiplied in at the end.\n\n :param vis_list: List of Visibility data mo... | [
{
"param": "vis_list",
"type": null
},
{
"param": "skymodel_list",
"type": null
},
{
"param": "context",
"type": null
},
{
"param": "vis_slices",
"type": null
},
{
"param": "facets",
"type": null
},
{
"param": "gcfcf",
"type": null
},
{
"pa... | {
"returns": [
{
"docstring": "List of (image, weight) tuples)",
"docstring_tokens": [
"List",
"of",
"(",
"image",
"weight",
")",
"tuples",
")"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier":... |
84cb04d08b89fb67a952ce6c34745a84cce8db14 | ska-telescope/algorithm-reference-library | workflows/arlexecute/skymodel/skymodel_arlexecute.py | [
"Apache-2.0"
] | Python | crosssubtract_datamodels_skymodel_list_arlexecute_workflow | <not_specific> | def crosssubtract_datamodels_skymodel_list_arlexecute_workflow(obsvis, modelvis_list):
"""Form data models by subtracting sum from the observed and adding back each model in turn
vmodel[p] = vobs - sum(i!=p) modelvis[i]
This is the E step in the Expectation-Maximisation algorithm.
:param obsv... | Form data models by subtracting sum from the observed and adding back each model in turn
vmodel[p] = vobs - sum(i!=p) modelvis[i]
This is the E step in the Expectation-Maximisation algorithm.
:param obsvis: "Observed" visibility
:param modelvis_list: List of Visibility data model predictions
... | Form data models by subtracting sum from the observed and adding back each model in turn
vmodel[p] = vobs - sum(i!=p) modelvis[i]
This is the E step in the Expectation-Maximisation algorithm. | [
"Form",
"data",
"models",
"by",
"subtracting",
"sum",
"from",
"the",
"observed",
"and",
"adding",
"back",
"each",
"model",
"in",
"turn",
"vmodel",
"[",
"p",
"]",
"=",
"vobs",
"-",
"sum",
"(",
"i!",
"=",
"p",
")",
"modelvis",
"[",
"i",
"]",
"This",
... | def crosssubtract_datamodels_skymodel_list_arlexecute_workflow(obsvis, modelvis_list):
def vsum(ov, mv):
verr = copy_visibility(ov)
for m in mv:
verr.data['vis'] -= m.data['vis']
result = list()
for m in mv:
vr = copy_visibility(verr)
vr.data['vis'... | [
"def",
"crosssubtract_datamodels_skymodel_list_arlexecute_workflow",
"(",
"obsvis",
",",
"modelvis_list",
")",
":",
"def",
"vsum",
"(",
"ov",
",",
"mv",
")",
":",
"verr",
"=",
"copy_visibility",
"(",
"ov",
")",
"for",
"m",
"in",
"mv",
":",
"verr",
".",
"data... | Form data models by subtracting sum from the observed and adding back each model in turn
vmodel[p] = vobs - sum(i!=p) modelvis[i] | [
"Form",
"data",
"models",
"by",
"subtracting",
"sum",
"from",
"the",
"observed",
"and",
"adding",
"back",
"each",
"model",
"in",
"turn",
"vmodel",
"[",
"p",
"]",
"=",
"vobs",
"-",
"sum",
"(",
"i!",
"=",
"p",
")",
"modelvis",
"[",
"i",
"]"
] | [
"\"\"\"Form data models by subtracting sum from the observed and adding back each model in turn\n \n vmodel[p] = vobs - sum(i!=p) modelvis[i]\n \n This is the E step in the Expectation-Maximisation algorithm.\n\n :param obsvis: \"Observed\" visibility\n :param modelvis_list: List of Visibility dat... | [
{
"param": "obsvis",
"type": null
},
{
"param": "modelvis_list",
"type": null
}
] | {
"returns": [
{
"docstring": "List of (image, weight) tuples)",
"docstring_tokens": [
"List",
"of",
"(",
"image",
"weight",
")",
"tuples",
")"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier":... |
84cb04d08b89fb67a952ce6c34745a84cce8db14 | ska-telescope/algorithm-reference-library | workflows/arlexecute/skymodel/skymodel_arlexecute.py | [
"Apache-2.0"
] | Python | convolve_skymodel_list_arlexecute_workflow | <not_specific> | def convolve_skymodel_list_arlexecute_workflow(obsvis, skymodel_list, context, vis_slices=1, facets=1,
gcfcf=None, **kwargs):
"""Form residual image from observed visibility and a set of skymodel without calibration
This is similar to convolving the skymodel images ... | Form residual image from observed visibility and a set of skymodel without calibration
This is similar to convolving the skymodel images with the PSF
:param vis_list: List of Visibility data models
:param skymodel_list: skymodel list
:param vis_slices: Number of vis slices (w stack or timeslice)
:... | Form residual image from observed visibility and a set of skymodel without calibration
This is similar to convolving the skymodel images with the PSF | [
"Form",
"residual",
"image",
"from",
"observed",
"visibility",
"and",
"a",
"set",
"of",
"skymodel",
"without",
"calibration",
"This",
"is",
"similar",
"to",
"convolving",
"the",
"skymodel",
"images",
"with",
"the",
"PSF"
] | def convolve_skymodel_list_arlexecute_workflow(obsvis, skymodel_list, context, vis_slices=1, facets=1,
gcfcf=None, **kwargs):
def ft_ift_sm(ov, sm, g):
assert isinstance(ov, Visibility) or isinstance(ov, BlockVisibility), ov
assert isinstance(sm, SkyModel... | [
"def",
"convolve_skymodel_list_arlexecute_workflow",
"(",
"obsvis",
",",
"skymodel_list",
",",
"context",
",",
"vis_slices",
"=",
"1",
",",
"facets",
"=",
"1",
",",
"gcfcf",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"def",
"ft_ift_sm",
"(",
"ov",
",",
"s... | Form residual image from observed visibility and a set of skymodel without calibration
This is similar to convolving the skymodel images with the PSF | [
"Form",
"residual",
"image",
"from",
"observed",
"visibility",
"and",
"a",
"set",
"of",
"skymodel",
"without",
"calibration",
"This",
"is",
"similar",
"to",
"convolving",
"the",
"skymodel",
"images",
"with",
"the",
"PSF"
] | [
"\"\"\"Form residual image from observed visibility and a set of skymodel without calibration\n\n This is similar to convolving the skymodel images with the PSF\n\n :param vis_list: List of Visibility data models\n :param skymodel_list: skymodel list\n :param vis_slices: Number of vis slices (w stack or... | [
{
"param": "obsvis",
"type": null
},
{
"param": "skymodel_list",
"type": null
},
{
"param": "context",
"type": null
},
{
"param": "vis_slices",
"type": null
},
{
"param": "facets",
"type": null
},
{
"param": "gcfcf",
"type": null
}
] | {
"returns": [
{
"docstring": "List of (image, weight) tuples)",
"docstring_tokens": [
"List",
"of",
"(",
"image",
"weight",
")",
"tuples",
")"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier":... |
84eb471a79d3ed013bbff7823cdc75a33689175d | ska-telescope/algorithm-reference-library | workflows/arlexecute/pipelines/pipeline_mpccal_arlexecute.py | [
"Apache-2.0"
] | Python | mpccal_skymodel_list_arlexecute_workflow | <not_specific> | def mpccal_skymodel_list_arlexecute_workflow(visobs, model, theta_list, nmajor=10, context='2d',
mpccal_progress=None, **kwargs):
"""Run MPC pipeline
This runs the Model Partition Calibration algorithm. See SDP Memo 97 for more details,
and see workflows/scr... | Run MPC pipeline
This runs the Model Partition Calibration algorithm. See SDP Memo 97 for more details,
and see workflows/scripts/pipelines/mpccal_arlexecute_pipeline.py for an example of the application
:param visobs: Visibility (not a list!)
:param model: Model image
:param theta_list: L... | Run MPC pipeline
This runs the Model Partition Calibration algorithm. See SDP Memo 97 for more details,
and see workflows/scripts/pipelines/mpccal_arlexecute_pipeline.py for an example of the application | [
"Run",
"MPC",
"pipeline",
"This",
"runs",
"the",
"Model",
"Partition",
"Calibration",
"algorithm",
".",
"See",
"SDP",
"Memo",
"97",
"for",
"more",
"details",
"and",
"see",
"workflows",
"/",
"scripts",
"/",
"pipelines",
"/",
"mpccal_arlexecute_pipeline",
".",
"... | def mpccal_skymodel_list_arlexecute_workflow(visobs, model, theta_list, nmajor=10, context='2d',
mpccal_progress=None, **kwargs):
psf_obs = invert_list_arlexecute_workflow([visobs], [model], context=context, dopsf=True)
result = arlexecute.execute((theta_list, model)... | [
"def",
"mpccal_skymodel_list_arlexecute_workflow",
"(",
"visobs",
",",
"model",
",",
"theta_list",
",",
"nmajor",
"=",
"10",
",",
"context",
"=",
"'2d'",
",",
"mpccal_progress",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"psf_obs",
"=",
"invert_list_arlexecute_... | Run MPC pipeline
This runs the Model Partition Calibration algorithm. | [
"Run",
"MPC",
"pipeline",
"This",
"runs",
"the",
"Model",
"Partition",
"Calibration",
"algorithm",
"."
] | [
"\"\"\"Run MPC pipeline\n \n This runs the Model Partition Calibration algorithm. See SDP Memo 97 for more details,\n and see workflows/scripts/pipelines/mpccal_arlexecute_pipeline.py for an example of the application\n \n :param visobs: Visibility (not a list!)\n :param model: Model image\n :p... | [
{
"param": "visobs",
"type": null
},
{
"param": "model",
"type": null
},
{
"param": "theta_list",
"type": null
},
{
"param": "nmajor",
"type": null
},
{
"param": "context",
"type": null
},
{
"param": "mpccal_progress",
"type": null
}
] | {
"returns": [
{
"docstring": "Delayed tuple (theta_list, residual)",
"docstring_tokens": [
"Delayed",
"tuple",
"(",
"theta_list",
"residual",
")"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "visobs",
... |
6216ea7f2fcaee8f237c73a47ff9080599f6aa7d | ska-telescope/algorithm-reference-library | deprecated_code/workflows/mpi/calibration/calibration_mpi.py | [
"Apache-2.0"
] | Python | calibrate_list_mpi_workflow | <not_specific> | def calibrate_list_mpi_workflow(vis_list, model_vislist, calibration_context='TG', global_solution=True,
comm=MPI.COMM_WORLD,
**kwargs):
""" Create a set of components for (optionally global) calibration of a list of visibilities
If global ... | Create a set of components for (optionally global) calibration of a list of visibilities
If global solution is true then visibilities are gathered to a single visibility data set which is then
self-calibrated. The resulting gaintable is then effectively scattered out for application to each visibility
set... | Create a set of components for (optionally global) calibration of a list of visibilities
If global solution is true then visibilities are gathered to a single visibility data set which is then
self-calibrated. The resulting gaintable is then effectively scattered out for application to each visibility
set. If global so... | [
"Create",
"a",
"set",
"of",
"components",
"for",
"(",
"optionally",
"global",
")",
"calibration",
"of",
"a",
"list",
"of",
"visibilities",
"If",
"global",
"solution",
"is",
"true",
"then",
"visibilities",
"are",
"gathered",
"to",
"a",
"single",
"visibility",
... | def calibrate_list_mpi_workflow(vis_list, model_vislist, calibration_context='TG', global_solution=True,
comm=MPI.COMM_WORLD,
**kwargs):
rank = comm.Get_rank()
size = comm.Get_size()
log.debug('%d: In calibrate_list_mpi_workflow : %d ele... | [
"def",
"calibrate_list_mpi_workflow",
"(",
"vis_list",
",",
"model_vislist",
",",
"calibration_context",
"=",
"'TG'",
",",
"global_solution",
"=",
"True",
",",
"comm",
"=",
"MPI",
".",
"COMM_WORLD",
",",
"**",
"kwargs",
")",
":",
"rank",
"=",
"comm",
".",
"G... | Create a set of components for (optionally global) calibration of a list of visibilities
If global solution is true then visibilities are gathered to a single visibility data set which is then
self-calibrated. | [
"Create",
"a",
"set",
"of",
"components",
"for",
"(",
"optionally",
"global",
")",
"calibration",
"of",
"a",
"list",
"of",
"visibilities",
"If",
"global",
"solution",
"is",
"true",
"then",
"visibilities",
"are",
"gathered",
"to",
"a",
"single",
"visibility",
... | [
"\"\"\" Create a set of components for (optionally global) calibration of a list of visibilities\n\n If global solution is true then visibilities are gathered to a single visibility data set which is then\n self-calibrated. The resulting gaintable is then effectively scattered out for application to each visi... | [
{
"param": "vis_list",
"type": null
},
{
"param": "model_vislist",
"type": null
},
{
"param": "calibration_context",
"type": null
},
{
"param": "global_solution",
"type": null
},
{
"param": "comm",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis_list",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
6a78d6960d797e7aeb158b5a1f42d31bd42aedff | ska-telescope/algorithm-reference-library | processing_components/visibility/operations.py | [
"Apache-2.0"
] | Python | concatenate_blockvisibility_frequency | <not_specific> | def concatenate_blockvisibility_frequency(bvis_list):
"""Concatenate a list of BlockVisibility's in frequency
:param bvis_list:
:return: BlockVisibility
"""
assert len(bvis_list) > 0
nvis = bvis_list[0].nvis
time = bvis_list[0].time
frequency = numpy.array(numpy.array([bvis.fr... | Concatenate a list of BlockVisibility's in frequency
:param bvis_list:
:return: BlockVisibility
| Concatenate a list of BlockVisibility's in frequency | [
"Concatenate",
"a",
"list",
"of",
"BlockVisibility",
"'",
"s",
"in",
"frequency"
] | def concatenate_blockvisibility_frequency(bvis_list):
assert len(bvis_list) > 0
nvis = bvis_list[0].nvis
time = bvis_list[0].time
frequency = numpy.array(numpy.array([bvis.frequency for bvis in bvis_list]).flat)
channel_bandwidth = numpy.array(numpy.array([bvis.channel_bandwidth for bvis in bvis_lis... | [
"def",
"concatenate_blockvisibility_frequency",
"(",
"bvis_list",
")",
":",
"assert",
"len",
"(",
"bvis_list",
")",
">",
"0",
"nvis",
"=",
"bvis_list",
"[",
"0",
"]",
".",
"nvis",
"time",
"=",
"bvis_list",
"[",
"0",
"]",
".",
"time",
"frequency",
"=",
"n... | Concatenate a list of BlockVisibility's in frequency | [
"Concatenate",
"a",
"list",
"of",
"BlockVisibility",
"'",
"s",
"in",
"frequency"
] | [
"\"\"\"Concatenate a list of BlockVisibility's in frequency\n\n :param bvis_list:\n :return: BlockVisibility\n \"\"\""
] | [
{
"param": "bvis_list",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "bvis_list",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
6a78d6960d797e7aeb158b5a1f42d31bd42aedff | ska-telescope/algorithm-reference-library | processing_components/visibility/operations.py | [
"Apache-2.0"
] | Python | sum_visibility | numpy.array | def sum_visibility(vis: Visibility, direction: SkyCoord) -> numpy.array:
""" Direct Fourier summation in a given direction
:param vis: Visibility to be summed
:param direction: Direction of summation
:return: flux[nch,npol], weight[nch,pol]
"""
# TODO: Convert to Visibility or remove?
... | Direct Fourier summation in a given direction
:param vis: Visibility to be summed
:param direction: Direction of summation
:return: flux[nch,npol], weight[nch,pol]
| Direct Fourier summation in a given direction | [
"Direct",
"Fourier",
"summation",
"in",
"a",
"given",
"direction"
] | def sum_visibility(vis: Visibility, direction: SkyCoord) -> numpy.array:
assert isinstance(vis, Visibility) or isinstance(vis, BlockVisibility), vis
svis = copy_visibility(vis)
l, m, n = skycoord_to_lmn(direction, svis.phasecentre)
phasor = numpy.conjugate(simulate_point(svis.uvw, l, m))
_, frequenc... | [
"def",
"sum_visibility",
"(",
"vis",
":",
"Visibility",
",",
"direction",
":",
"SkyCoord",
")",
"->",
"numpy",
".",
"array",
":",
"assert",
"isinstance",
"(",
"vis",
",",
"Visibility",
")",
"or",
"isinstance",
"(",
"vis",
",",
"BlockVisibility",
")",
",",
... | Direct Fourier summation in a given direction | [
"Direct",
"Fourier",
"summation",
"in",
"a",
"given",
"direction"
] | [
"\"\"\" Direct Fourier summation in a given direction\n\n :param vis: Visibility to be summed\n :param direction: Direction of summation\n :return: flux[nch,npol], weight[nch,pol]\n \"\"\"",
"# TODO: Convert to Visibility or remove?",
"# Need to put correct mapping here"
] | [
{
"param": "vis",
"type": "Visibility"
},
{
"param": "direction",
"type": "SkyCoord"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis",
"type": "Visibility",
"docstring": "Visibility to be summed",
"docstring_tokens": [
"Visibility",
... |
6a78d6960d797e7aeb158b5a1f42d31bd42aedff | ska-telescope/algorithm-reference-library | processing_components/visibility/operations.py | [
"Apache-2.0"
] | Python | subtract_visibility | <not_specific> | def subtract_visibility(vis, model_vis, inplace=False):
""" Subtract model_vis from vis, returning new visibility
:param vis:
:param model_vis:
:return:
"""
if isinstance(vis, Visibility):
assert isinstance(model_vis, Visibility), model_vis
elif isinstance(vis, BlockVisibility):... | Subtract model_vis from vis, returning new visibility
:param vis:
:param model_vis:
:return:
| Subtract model_vis from vis, returning new visibility | [
"Subtract",
"model_vis",
"from",
"vis",
"returning",
"new",
"visibility"
] | def subtract_visibility(vis, model_vis, inplace=False):
if isinstance(vis, Visibility):
assert isinstance(model_vis, Visibility), model_vis
elif isinstance(vis, BlockVisibility):
assert isinstance(model_vis, BlockVisibility), model_vis
else:
raise RuntimeError("Types of vis and model... | [
"def",
"subtract_visibility",
"(",
"vis",
",",
"model_vis",
",",
"inplace",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"vis",
",",
"Visibility",
")",
":",
"assert",
"isinstance",
"(",
"model_vis",
",",
"Visibility",
")",
",",
"model_vis",
"elif",
"is... | Subtract model_vis from vis, returning new visibility | [
"Subtract",
"model_vis",
"from",
"vis",
"returning",
"new",
"visibility"
] | [
"\"\"\" Subtract model_vis from vis, returning new visibility\n \n :param vis:\n :param model_vis:\n :return:\n \"\"\""
] | [
{
"param": "vis",
"type": null
},
{
"param": "model_vis",
"type": null
},
{
"param": "inplace",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"... |
6a78d6960d797e7aeb158b5a1f42d31bd42aedff | ska-telescope/algorithm-reference-library | processing_components/visibility/operations.py | [
"Apache-2.0"
] | Python | divide_visibility | <not_specific> | def divide_visibility(vis: BlockVisibility, modelvis: BlockVisibility):
""" Divide visibility by model forming visibility for equivalent point source
This is a useful intermediate product for calibration. Variation of the visibility in time and
frequency due to the model structure is removed and the data c... | Divide visibility by model forming visibility for equivalent point source
This is a useful intermediate product for calibration. Variation of the visibility in time and
frequency due to the model structure is removed and the data can be averaged to a limit determined
by the instrumental stability. The wei... | Divide visibility by model forming visibility for equivalent point source
This is a useful intermediate product for calibration. Variation of the visibility in time and
frequency due to the model structure is removed and the data can be averaged to a limit determined
by the instrumental stability. The weight is adjuste... | [
"Divide",
"visibility",
"by",
"model",
"forming",
"visibility",
"for",
"equivalent",
"point",
"source",
"This",
"is",
"a",
"useful",
"intermediate",
"product",
"for",
"calibration",
".",
"Variation",
"of",
"the",
"visibility",
"in",
"time",
"and",
"frequency",
"... | def divide_visibility(vis: BlockVisibility, modelvis: BlockVisibility):
assert isinstance(vis, Visibility) or isinstance(vis, BlockVisibility), vis
isscalar = vis.polarisation_frame.npol == 1
if isscalar:
x = numpy.zeros_like(vis.vis)
xwt = numpy.abs(modelvis.vis) ** 2 * vis.weight
m... | [
"def",
"divide_visibility",
"(",
"vis",
":",
"BlockVisibility",
",",
"modelvis",
":",
"BlockVisibility",
")",
":",
"assert",
"isinstance",
"(",
"vis",
",",
"Visibility",
")",
"or",
"isinstance",
"(",
"vis",
",",
"BlockVisibility",
")",
",",
"vis",
"isscalar",
... | Divide visibility by model forming visibility for equivalent point source
This is a useful intermediate product for calibration. | [
"Divide",
"visibility",
"by",
"model",
"forming",
"visibility",
"for",
"equivalent",
"point",
"source",
"This",
"is",
"a",
"useful",
"intermediate",
"product",
"for",
"calibration",
"."
] | [
"\"\"\" Divide visibility by model forming visibility for equivalent point source\n\n This is a useful intermediate product for calibration. Variation of the visibility in time and\n frequency due to the model structure is removed and the data can be averaged to a limit determined\n by the instrumental sta... | [
{
"param": "vis",
"type": "BlockVisibility"
},
{
"param": "modelvis",
"type": "BlockVisibility"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis",
"type": "BlockVisibility",
"docstring": null,
"docstring_tokens": [
"None"
],
"default": ... |
6a78d6960d797e7aeb158b5a1f42d31bd42aedff | ska-telescope/algorithm-reference-library | processing_components/visibility/operations.py | [
"Apache-2.0"
] | Python | integrate_visibility_by_channel | BlockVisibility | def integrate_visibility_by_channel(vis: BlockVisibility) -> BlockVisibility:
""" Integrate visibility across channels, returning new visibility
:param vis:
:return: BlockVisibility
"""
assert isinstance(vis, Visibility) or isinstance(vis, BlockVisibility), vis
vis_shape = list(vi... | Integrate visibility across channels, returning new visibility
:param vis:
:return: BlockVisibility
| Integrate visibility across channels, returning new visibility | [
"Integrate",
"visibility",
"across",
"channels",
"returning",
"new",
"visibility"
] | def integrate_visibility_by_channel(vis: BlockVisibility) -> BlockVisibility:
assert isinstance(vis, Visibility) or isinstance(vis, BlockVisibility), vis
vis_shape = list(vis.vis.shape)
ntimes, nants, _, nchan, npol = vis_shape
vis_shape[-2] = 1
newvis = BlockVisibility(data=None,
... | [
"def",
"integrate_visibility_by_channel",
"(",
"vis",
":",
"BlockVisibility",
")",
"->",
"BlockVisibility",
":",
"assert",
"isinstance",
"(",
"vis",
",",
"Visibility",
")",
"or",
"isinstance",
"(",
"vis",
",",
"BlockVisibility",
")",
",",
"vis",
"vis_shape",
"="... | Integrate visibility across channels, returning new visibility | [
"Integrate",
"visibility",
"across",
"channels",
"returning",
"new",
"visibility"
] | [
"\"\"\" Integrate visibility across channels, returning new visibility\n \n :param vis:\n :return: BlockVisibility\n \"\"\""
] | [
{
"param": "vis",
"type": "BlockVisibility"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "vis",
"type": "BlockVisibility",
"docstring": null,
"docstring_tokens": [
"None"
],
"default": ... |
6a78d6960d797e7aeb158b5a1f42d31bd42aedff | ska-telescope/algorithm-reference-library | processing_components/visibility/operations.py | [
"Apache-2.0"
] | Python | convert_blockvisibility_to_stokes | <not_specific> | def convert_blockvisibility_to_stokes(vis):
"""Convert the polarisation frame data into Stokes parameters.
Args:
vis (obj): ARL visibility data.
Returns:
vis: Converted visibility data.
"""
poldef = vis.polarisation_frame
if poldef == PolarisationFrame('linear'):
vis.data['vis'... | Convert the polarisation frame data into Stokes parameters.
Args:
vis (obj): ARL visibility data.
Returns:
vis: Converted visibility data.
| Convert the polarisation frame data into Stokes parameters.
Args:
vis (obj): ARL visibility data.
Converted visibility data. | [
"Convert",
"the",
"polarisation",
"frame",
"data",
"into",
"Stokes",
"parameters",
".",
"Args",
":",
"vis",
"(",
"obj",
")",
":",
"ARL",
"visibility",
"data",
".",
"Converted",
"visibility",
"data",
"."
] | def convert_blockvisibility_to_stokes(vis):
poldef = vis.polarisation_frame
if poldef == PolarisationFrame('linear'):
vis.data['vis'] = convert_linear_to_stokes(vis.data['vis'], polaxis=4)
vis.polarisation_frame = PolarisationFrame('stokesIQUV')
elif poldef == PolarisationFrame('circular'):
... | [
"def",
"convert_blockvisibility_to_stokes",
"(",
"vis",
")",
":",
"poldef",
"=",
"vis",
".",
"polarisation_frame",
"if",
"poldef",
"==",
"PolarisationFrame",
"(",
"'linear'",
")",
":",
"vis",
".",
"data",
"[",
"'vis'",
"]",
"=",
"convert_linear_to_stokes",
"(",
... | Convert the polarisation frame data into Stokes parameters. | [
"Convert",
"the",
"polarisation",
"frame",
"data",
"into",
"Stokes",
"parameters",
"."
] | [
"\"\"\"Convert the polarisation frame data into Stokes parameters.\n\n Args:\n vis (obj): ARL visibility data.\n\n Returns:\n vis: Converted visibility data.\n \"\"\""
] | [
{
"param": "vis",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "vis",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a78d6960d797e7aeb158b5a1f42d31bd42aedff | ska-telescope/algorithm-reference-library | processing_components/visibility/operations.py | [
"Apache-2.0"
] | Python | convert_visibility_to_stokesI | <not_specific> | def convert_visibility_to_stokesI(vis):
"""Convert the polarisation frame data into Stokes I dropping other polarisations, return new Visibility
Args:
vis (obj): ARL visibility data.
Returns:
vis: New, converted visibility data.
"""
polarisation_frame = PolarisationFrame('stokesI')
pol... | Convert the polarisation frame data into Stokes I dropping other polarisations, return new Visibility
Args:
vis (obj): ARL visibility data.
Returns:
vis: New, converted visibility data.
| Convert the polarisation frame data into Stokes I dropping other polarisations, return new Visibility
Args:
vis (obj): ARL visibility data.
New, converted visibility data. | [
"Convert",
"the",
"polarisation",
"frame",
"data",
"into",
"Stokes",
"I",
"dropping",
"other",
"polarisations",
"return",
"new",
"Visibility",
"Args",
":",
"vis",
"(",
"obj",
")",
":",
"ARL",
"visibility",
"data",
".",
"New",
"converted",
"visibility",
"data",... | def convert_visibility_to_stokesI(vis):
polarisation_frame = PolarisationFrame('stokesI')
poldef = vis.polarisation_frame
if poldef == PolarisationFrame('linear'):
vis_data = convert_linear_to_stokesI(vis.data['vis'])
vis_weight = (vis.weight[..., 0] + vis.weight[..., 3])[..., numpy.newaxis]... | [
"def",
"convert_visibility_to_stokesI",
"(",
"vis",
")",
":",
"polarisation_frame",
"=",
"PolarisationFrame",
"(",
"'stokesI'",
")",
"poldef",
"=",
"vis",
".",
"polarisation_frame",
"if",
"poldef",
"==",
"PolarisationFrame",
"(",
"'linear'",
")",
":",
"vis_data",
... | Convert the polarisation frame data into Stokes I dropping other polarisations, return new Visibility
Args:
vis (obj): ARL visibility data. | [
"Convert",
"the",
"polarisation",
"frame",
"data",
"into",
"Stokes",
"I",
"dropping",
"other",
"polarisations",
"return",
"new",
"Visibility",
"Args",
":",
"vis",
"(",
"obj",
")",
":",
"ARL",
"visibility",
"data",
"."
] | [
"\"\"\"Convert the polarisation frame data into Stokes I dropping other polarisations, return new Visibility\n\n Args:\n vis (obj): ARL visibility data.\n\n Returns:\n vis: New, converted visibility data.\n \"\"\""
] | [
{
"param": "vis",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "vis",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6a78d6960d797e7aeb158b5a1f42d31bd42aedff | ska-telescope/algorithm-reference-library | processing_components/visibility/operations.py | [
"Apache-2.0"
] | Python | convert_blockvisibility_to_stokesI | <not_specific> | def convert_blockvisibility_to_stokesI(vis):
"""Convert the polarisation frame data into Stokes I dropping other polarisations, return new Visibility
Args:
vis (obj): ARL visibility data.
Returns:
vis: New, converted visibility data.
"""
polarisation_frame = PolarisationFrame('stokesI')
... | Convert the polarisation frame data into Stokes I dropping other polarisations, return new Visibility
Args:
vis (obj): ARL visibility data.
Returns:
vis: New, converted visibility data.
| Convert the polarisation frame data into Stokes I dropping other polarisations, return new Visibility
Args:
vis (obj): ARL visibility data.
New, converted visibility data. | [
"Convert",
"the",
"polarisation",
"frame",
"data",
"into",
"Stokes",
"I",
"dropping",
"other",
"polarisations",
"return",
"new",
"Visibility",
"Args",
":",
"vis",
"(",
"obj",
")",
":",
"ARL",
"visibility",
"data",
".",
"New",
"converted",
"visibility",
"data",... | def convert_blockvisibility_to_stokesI(vis):
polarisation_frame = PolarisationFrame('stokesI')
poldef = vis.polarisation_frame
if poldef == PolarisationFrame('linear'):
vis_data = convert_linear_to_stokesI(vis.data['vis'])
vis_weight = (vis.weight[..., 0] + vis.weight[..., 3])[..., numpy.new... | [
"def",
"convert_blockvisibility_to_stokesI",
"(",
"vis",
")",
":",
"polarisation_frame",
"=",
"PolarisationFrame",
"(",
"'stokesI'",
")",
"poldef",
"=",
"vis",
".",
"polarisation_frame",
"if",
"poldef",
"==",
"PolarisationFrame",
"(",
"'linear'",
")",
":",
"vis_data... | Convert the polarisation frame data into Stokes I dropping other polarisations, return new Visibility
Args:
vis (obj): ARL visibility data. | [
"Convert",
"the",
"polarisation",
"frame",
"data",
"into",
"Stokes",
"I",
"dropping",
"other",
"polarisations",
"return",
"new",
"Visibility",
"Args",
":",
"vis",
"(",
"obj",
")",
":",
"ARL",
"visibility",
"data",
"."
] | [
"\"\"\"Convert the polarisation frame data into Stokes I dropping other polarisations, return new Visibility\n\n Args:\n vis (obj): ARL visibility data.\n\n Returns:\n vis: New, converted visibility data.\n \"\"\""
] | [
{
"param": "vis",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "vis",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
96c18416a34ab41c8897ae741d15a6c3e347c7b6 | ska-telescope/algorithm-reference-library | deprecated_code/ffiwrappers/src/arlwrap_support.py | [
"Apache-2.0"
] | Python | cARLVis | <not_specific> | def cARLVis(visin):
"""
Convert a const ARLVis * into the ARL Visiblity structure
"""
npol=visin.npol
nvis=visin.nvis
#print (ARLDataVisSize(nvis, npol))
desc = [('index', 'i8'),
('uvw', 'f8', (3,)),
('time', 'f8'),
('frequency', 'f8'),
('chann... |
Convert a const ARLVis * into the ARL Visiblity structure
| Convert a const ARLVis * into the ARL Visiblity structure | [
"Convert",
"a",
"const",
"ARLVis",
"*",
"into",
"the",
"ARL",
"Visiblity",
"structure"
] | def cARLVis(visin):
npol=visin.npol
nvis=visin.nvis
desc = [('index', 'i8'),
('uvw', 'f8', (3,)),
('time', 'f8'),
('frequency', 'f8'),
('channel_bandwidth', 'f8'),
('integration_time', 'f8'),
('antenna1', 'i8'),
('antenna2',... | [
"def",
"cARLVis",
"(",
"visin",
")",
":",
"npol",
"=",
"visin",
".",
"npol",
"nvis",
"=",
"visin",
".",
"nvis",
"desc",
"=",
"[",
"(",
"'index'",
",",
"'i8'",
")",
",",
"(",
"'uvw'",
",",
"'f8'",
",",
"(",
"3",
",",
")",
")",
",",
"(",
"'time... | Convert a const ARLVis * into the ARL Visiblity structure | [
"Convert",
"a",
"const",
"ARLVis",
"*",
"into",
"the",
"ARL",
"Visiblity",
"structure"
] | [
"\"\"\"\n Convert a const ARLVis * into the ARL Visiblity structure\n \"\"\"",
"#print (ARLDataVisSize(nvis, npol))"
] | [
{
"param": "visin",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "visin",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
96c18416a34ab41c8897ae741d15a6c3e347c7b6 | ska-telescope/algorithm-reference-library | deprecated_code/ffiwrappers/src/arlwrap_support.py | [
"Apache-2.0"
] | Python | cARLBlockVis | <not_specific> | def cARLBlockVis(visin, nants, nchan):
"""
Convert a const ARLVis * into the ARL BlockVisiblity structure
"""
npol=visin.npol
ntimes=visin.nvis
#print (ARLDataVisSize(nvis, npol))
desc = [('index', 'i8'),
('uvw', 'f8', (nants, nants, 3)),
('time', 'f8'),
(... |
Convert a const ARLVis * into the ARL BlockVisiblity structure
| Convert a const ARLVis * into the ARL BlockVisiblity structure | [
"Convert",
"a",
"const",
"ARLVis",
"*",
"into",
"the",
"ARL",
"BlockVisiblity",
"structure"
] | def cARLBlockVis(visin, nants, nchan):
npol=visin.npol
ntimes=visin.nvis
desc = [('index', 'i8'),
('uvw', 'f8', (nants, nants, 3)),
('time', 'f8'),
('integration_time', 'f8'),
('vis', 'c16', (nants, nants, nchan, npol)),
('weight', 'f8', (nants, na... | [
"def",
"cARLBlockVis",
"(",
"visin",
",",
"nants",
",",
"nchan",
")",
":",
"npol",
"=",
"visin",
".",
"npol",
"ntimes",
"=",
"visin",
".",
"nvis",
"desc",
"=",
"[",
"(",
"'index'",
",",
"'i8'",
")",
",",
"(",
"'uvw'",
",",
"'f8'",
",",
"(",
"nant... | Convert a const ARLVis * into the ARL BlockVisiblity structure | [
"Convert",
"a",
"const",
"ARLVis",
"*",
"into",
"the",
"ARL",
"BlockVisiblity",
"structure"
] | [
"\"\"\"\n Convert a const ARLVis * into the ARL BlockVisiblity structure\n \"\"\"",
"#print (ARLDataVisSize(nvis, npol))"
] | [
{
"param": "visin",
"type": null
},
{
"param": "nants",
"type": null
},
{
"param": "nchan",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "visin",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "nants",
"type": null,
"docstring": null,
"docstring_tokens":... |
96c18416a34ab41c8897ae741d15a6c3e347c7b6 | ska-telescope/algorithm-reference-library | deprecated_code/ffiwrappers/src/arlwrap_support.py | [
"Apache-2.0"
] | Python | cARLGt | <not_specific> | def cARLGt(gtin, nants, nchan, nrec):
"""
Convert a const ARLGt * into the ARL GainTable structure
"""
ntimes=gtin.nrows
desc = [('gain', 'c16', (nants, nchan, nrec, nrec)),
('weight', 'f8', (nants, nchan, nrec, nrec)),
('residual', 'f8', (nchan, nrec, nrec)),
('... |
Convert a const ARLGt * into the ARL GainTable structure
| Convert a const ARLGt * into the ARL GainTable structure | [
"Convert",
"a",
"const",
"ARLGt",
"*",
"into",
"the",
"ARL",
"GainTable",
"structure"
] | def cARLGt(gtin, nants, nchan, nrec):
ntimes=gtin.nrows
desc = [('gain', 'c16', (nants, nchan, nrec, nrec)),
('weight', 'f8', (nants, nchan, nrec, nrec)),
('residual', 'f8', (nchan, nrec, nrec)),
('time', 'f8'),
('interval', 'f8')]
r=numpy.frombuffer(ff.buffer... | [
"def",
"cARLGt",
"(",
"gtin",
",",
"nants",
",",
"nchan",
",",
"nrec",
")",
":",
"ntimes",
"=",
"gtin",
".",
"nrows",
"desc",
"=",
"[",
"(",
"'gain'",
",",
"'c16'",
",",
"(",
"nants",
",",
"nchan",
",",
"nrec",
",",
"nrec",
")",
")",
",",
"(",
... | Convert a const ARLGt * into the ARL GainTable structure | [
"Convert",
"a",
"const",
"ARLGt",
"*",
"into",
"the",
"ARL",
"GainTable",
"structure"
] | [
"\"\"\"\n Convert a const ARLGt * into the ARL GainTable structure \n \"\"\""
] | [
{
"param": "gtin",
"type": null
},
{
"param": "nants",
"type": null
},
{
"param": "nchan",
"type": null
},
{
"param": "nrec",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "gtin",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "nants",
"type": null,
"docstring": null,
"docstring_tokens": ... |
26cda2991c598c5f134e5f92d815b00b67e6ac17 | ska-telescope/algorithm-reference-library | processing_components/image/deconvolution.py | [
"Apache-2.0"
] | Python | restore_cube | Image | def restore_cube(model: Image, psf: Image, residual=None, **kwargs) -> Image:
""" Restore the model image to the residuals
:params psf: Input PSF
:return: restored image
"""
assert isinstance(model, Image), model
assert isinstance(psf, Image), psf
assert residual is None or isinstance(resi... | Restore the model image to the residuals
:params psf: Input PSF
:return: restored image
| Restore the model image to the residuals | [
"Restore",
"the",
"model",
"image",
"to",
"the",
"residuals"
] | def restore_cube(model: Image, psf: Image, residual=None, **kwargs) -> Image:
assert isinstance(model, Image), model
assert isinstance(psf, Image), psf
assert residual is None or isinstance(residual, Image), residual
restored = copy_image(model)
npixel = psf.data.shape[3]
sl = slice(npixel // 2 ... | [
"def",
"restore_cube",
"(",
"model",
":",
"Image",
",",
"psf",
":",
"Image",
",",
"residual",
"=",
"None",
",",
"**",
"kwargs",
")",
"->",
"Image",
":",
"assert",
"isinstance",
"(",
"model",
",",
"Image",
")",
",",
"model",
"assert",
"isinstance",
"(",... | Restore the model image to the residuals | [
"Restore",
"the",
"model",
"image",
"to",
"the",
"residuals"
] | [
"\"\"\" Restore the model image to the residuals\n\n :params psf: Input PSF\n :return: restored image\n\n \"\"\"",
"# isotropic at the moment!",
"# By convention, we normalise the peak not the integral so this is the volume of the Gaussian"
] | [
{
"param": "model",
"type": "Image"
},
{
"param": "psf",
"type": "Image"
},
{
"param": "residual",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "model",
"type": "Image",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": nul... |
23ba139c7761f6391ea14f82b214ebdb9184123a | hippysurfer/family-camp | Archive/Old Shell Version/camp_records.py | [
"MIT"
] | Python | _normalize | <not_specific> | def _normalize(self):
"Take each of the camper field and move them so that we end up with"
"a row for each camper."
# Extract each camper.
campers = [self._df[GROUP_FIELDS+camper_fields(
" (Camper {})".format(i))] for i in range(1, MAX_NUM_OF_CAMPERS+1)]
for camper i... | Take each of the camper field and move them so that we end up with | Take each of the camper field and move them so that we end up with | [
"Take",
"each",
"of",
"the",
"camper",
"field",
"and",
"move",
"them",
"so",
"that",
"we",
"end",
"up",
"with"
] | def _normalize(self):
campers = [self._df[GROUP_FIELDS+camper_fields(
" (Camper {})".format(i))] for i in range(1, MAX_NUM_OF_CAMPERS+1)]
for camper in campers:
camper.columns = [GROUP_FIELDS+camper_fields('')]
norm = pd.concat(campers)
norm.reset_index(drop=True,... | [
"def",
"_normalize",
"(",
"self",
")",
":",
"\"a row for each camper.\"",
"campers",
"=",
"[",
"self",
".",
"_df",
"[",
"GROUP_FIELDS",
"+",
"camper_fields",
"(",
"\" (Camper {})\"",
".",
"format",
"(",
"i",
")",
")",
"]",
"for",
"i",
"in",
"range",
"(",
... | Take each of the camper field and move them so that we end up with | [
"Take",
"each",
"of",
"the",
"camper",
"field",
"and",
"move",
"them",
"so",
"that",
"we",
"end",
"up",
"with"
] | [
"\"Take each of the camper field and move them so that we end up with\"",
"\"a row for each camper.\"",
"# Extract each camper.",
"# Create booking reference column.",
"# remove rows where there is no camper"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
23ba139c7761f6391ea14f82b214ebdb9184123a | hippysurfer/family-camp | Archive/Old Shell Version/camp_records.py | [
"MIT"
] | Python | _get_campers | <not_specific> | def _get_campers(self):
"Create a table with a row for each camper and columns for the"
"camper specific information."
def priority(act, cell):
if act in [c.strip() for c in cell.split(',')]:
return 'P'
return None
def other(act, cell):
... | Create a table with a row for each camper and columns for the | Create a table with a row for each camper and columns for the | [
"Create",
"a",
"table",
"with",
"a",
"row",
"for",
"each",
"camper",
"and",
"columns",
"for",
"the"
] | def _get_campers(self):
def priority(act, cell):
if act in [c.strip() for c in cell.split(',')]:
return 'P'
return None
def other(act, cell):
if act in [c.strip() for c in cell.split(',')]:
return 'Y'
return 'N'
try:... | [
"def",
"_get_campers",
"(",
"self",
")",
":",
"\"camper specific information.\"",
"def",
"priority",
"(",
"act",
",",
"cell",
")",
":",
"if",
"act",
"in",
"[",
"c",
".",
"strip",
"(",
")",
"for",
"c",
"in",
"cell",
".",
"split",
"(",
"','",
")",
"]",... | Create a table with a row for each camper and columns for the | [
"Create",
"a",
"table",
"with",
"a",
"row",
"for",
"each",
"camper",
"and",
"columns",
"for",
"the"
] | [
"\"Create a table with a row for each camper and columns for the\"",
"\"camper specific information.\"",
"# Start with just the camper fields."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db6ed11ef7197aa43dfd4e8b584bb7bf955fa187 | hippysurfer/family-camp | family_camp/schedule/deep.py | [
"MIT"
] | Python | overlapping_sessions | <not_specific> | def overlapping_sessions(session, sessions):
"""Return a list of sessions from sessions that overlap
with session."""
return [_ for _ in sessions
if (_ != session
and sessions_overlap(
_, session))] | Return a list of sessions from sessions that overlap
with session. | Return a list of sessions from sessions that overlap
with session. | [
"Return",
"a",
"list",
"of",
"sessions",
"from",
"sessions",
"that",
"overlap",
"with",
"session",
"."
] | def overlapping_sessions(session, sessions):
return [_ for _ in sessions
if (_ != session
and sessions_overlap(
_, session))] | [
"def",
"overlapping_sessions",
"(",
"session",
",",
"sessions",
")",
":",
"return",
"[",
"_",
"for",
"_",
"in",
"sessions",
"if",
"(",
"_",
"!=",
"session",
"and",
"sessions_overlap",
"(",
"_",
",",
"session",
")",
")",
"]"
] | Return a list of sessions from sessions that overlap
with session. | [
"Return",
"a",
"list",
"of",
"sessions",
"from",
"sessions",
"that",
"overlap",
"with",
"session",
"."
] | [
"\"\"\"Return a list of sessions from sessions that overlap\n with session.\"\"\""
] | [
{
"param": "session",
"type": null
},
{
"param": "sessions",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "session",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sessions",
"type": null,
"docstring": null,
"docstring_tok... |
db6ed11ef7197aa43dfd4e8b584bb7bf955fa187 | hippysurfer/family-camp | family_camp/schedule/deep.py | [
"MIT"
] | Python | export_map | <not_specific> | def export_map(self):
"""Returns a row for each interval. A column for each activity.
Each cell is the percentage of the slots for that activity/session
that are used by the timetable."""
acts = set([s.activity for s in self.sessions])
# For each 15 period from the start to the e... | Returns a row for each interval. A column for each activity.
Each cell is the percentage of the slots for that activity/session
that are used by the timetable. | Returns a row for each interval. A column for each activity.
Each cell is the percentage of the slots for that activity/session
that are used by the timetable. | [
"Returns",
"a",
"row",
"for",
"each",
"interval",
".",
"A",
"column",
"for",
"each",
"activity",
".",
"Each",
"cell",
"is",
"the",
"percentage",
"of",
"the",
"slots",
"for",
"that",
"activity",
"/",
"session",
"that",
"are",
"used",
"by",
"the",
"timetab... | def export_map(self):
acts = set([s.activity for s in self.sessions])
days = set([s.start.day for s in self.sessions])
header = ['Time']
header.extend([act.name for act in acts])
out = [header, ]
for day in days:
start = sorted([s.start for s in self.sessions
... | [
"def",
"export_map",
"(",
"self",
")",
":",
"acts",
"=",
"set",
"(",
"[",
"s",
".",
"activity",
"for",
"s",
"in",
"self",
".",
"sessions",
"]",
")",
"days",
"=",
"set",
"(",
"[",
"s",
".",
"start",
".",
"day",
"for",
"s",
"in",
"self",
".",
"... | Returns a row for each interval. | [
"Returns",
"a",
"row",
"for",
"each",
"interval",
"."
] | [
"\"\"\"Returns a row for each interval. A column for each activity.\n Each cell is the percentage of the slots for that activity/session\n that are used by the timetable.\"\"\"",
"# For each 15 period from the start to the end of each day.",
"# Get list of days",
"# Get first and last time."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db6ed11ef7197aa43dfd4e8b584bb7bf955fa187 | hippysurfer/family-camp | family_camp/schedule/deep.py | [
"MIT"
] | Python | export_cvs | <not_specific> | def export_cvs(self):
"""Return a cvs format:
Group, Camper Name, Activity, Session
"""
out = []
for c, sessions in self.export_by_camper().items():
for session in sessions:
out.append(",".join([c.group, c.name,
ses... | Return a cvs format:
Group, Camper Name, Activity, Session
| Return a cvs format:
Group, Camper Name, Activity, Session | [
"Return",
"a",
"cvs",
"format",
":",
"Group",
"Camper",
"Name",
"Activity",
"Session"
] | def export_cvs(self):
out = []
for c, sessions in self.export_by_camper().items():
for session in sessions:
out.append(",".join([c.group, c.name,
session.session.label,
str(session.session.start)]))
... | [
"def",
"export_cvs",
"(",
"self",
")",
":",
"out",
"=",
"[",
"]",
"for",
"c",
",",
"sessions",
"in",
"self",
".",
"export_by_camper",
"(",
")",
".",
"items",
"(",
")",
":",
"for",
"session",
"in",
"sessions",
":",
"out",
".",
"append",
"(",
"\",\""... | Return a cvs format:
Group, Camper Name, Activity, Session | [
"Return",
"a",
"cvs",
"format",
":",
"Group",
"Camper",
"Name",
"Activity",
"Session"
] | [
"\"\"\"Return a cvs format:\n Group, Camper Name, Activity, Session\n \"\"\"",
"# @profile"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db6ed11ef7197aa43dfd4e8b584bb7bf955fa187 | hippysurfer/family-camp | family_camp/schedule/deep.py | [
"MIT"
] | Python | fitness | <not_specific> | def fitness(self, debug=False):
"""Measure the number of violations of the validity criteria.
The higher the number the worse it is.
A value of 1 means no violations.
"""
count = 1
for s in self.session_inst:
# Count the number of times we have the same campe... | Measure the number of violations of the validity criteria.
The higher the number the worse it is.
A value of 1 means no violations.
| Measure the number of violations of the validity criteria.
The higher the number the worse it is.
A value of 1 means no violations. | [
"Measure",
"the",
"number",
"of",
"violations",
"of",
"the",
"validity",
"criteria",
".",
"The",
"higher",
"the",
"number",
"the",
"worse",
"it",
"is",
".",
"A",
"value",
"of",
"1",
"means",
"no",
"violations",
"."
] | def fitness(self, debug=False):
count = 1
for s in self.session_inst:
count += len([other_s for c in s.campers
for other_s in self.overlapping_sessions_map[s.session]
if c in self.session_inst_map[other_s].campers])
split_famili... | [
"def",
"fitness",
"(",
"self",
",",
"debug",
"=",
"False",
")",
":",
"count",
"=",
"1",
"for",
"s",
"in",
"self",
".",
"session_inst",
":",
"count",
"+=",
"len",
"(",
"[",
"other_s",
"for",
"c",
"in",
"s",
".",
"campers",
"for",
"other_s",
"in",
... | Measure the number of violations of the validity criteria. | [
"Measure",
"the",
"number",
"of",
"violations",
"of",
"the",
"validity",
"criteria",
"."
] | [
"\"\"\"Measure the number of violations of the validity criteria.\n The higher the number the worse it is.\n A value of 1 means no violations.\n \"\"\"",
"# Count the number of times we have the same camper in two sessions",
"# that overlap.",
"# Count the number of times we have a family... | [
{
"param": "self",
"type": null
},
{
"param": "debug",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "debug",
"type": null,
"docstring": null,
"docstring_tokens": ... |
db6ed11ef7197aa43dfd4e8b584bb7bf955fa187 | hippysurfer/family-camp | family_camp/schedule/deep.py | [
"MIT"
] | Python | goodness | <not_specific> | def goodness(self, campers, debug=False):
"""Measure how many of the other activities we have met.
The higher the value the better."""
# What percentage of the other activities have been met?
# Total number of other activities requested.
other_total = sum([len(c.others) for c ... | Measure how many of the other activities we have met.
The higher the value the better. | Measure how many of the other activities we have met.
The higher the value the better. | [
"Measure",
"how",
"many",
"of",
"the",
"other",
"activities",
"we",
"have",
"met",
".",
"The",
"higher",
"the",
"value",
"the",
"better",
"."
] | def goodness(self, campers, debug=False):
other_total = sum([len(c.others) for c in self.campers])
met = 0
for c in self.campers:
activities = [s.session.activity for s in self.session_inst
if c in s.campers]
num_others = len(c.others)
... | [
"def",
"goodness",
"(",
"self",
",",
"campers",
",",
"debug",
"=",
"False",
")",
":",
"other_total",
"=",
"sum",
"(",
"[",
"len",
"(",
"c",
".",
"others",
")",
"for",
"c",
"in",
"self",
".",
"campers",
"]",
")",
"met",
"=",
"0",
"for",
"c",
"in... | Measure how many of the other activities we have met. | [
"Measure",
"how",
"many",
"of",
"the",
"other",
"activities",
"we",
"have",
"met",
"."
] | [
"\"\"\"Measure how many of the other activities we have met.\n\n The higher the value the better.\"\"\"",
"# What percentage of the other activities have been met?",
"# Total number of other activities requested.",
"# The intersection is the list of activities that have been met.",
"# we divide this ... | [
{
"param": "self",
"type": null
},
{
"param": "campers",
"type": null
},
{
"param": "debug",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "campers",
"type": null,
"docstring": null,
"docstring_tokens"... |
db6ed11ef7197aa43dfd4e8b584bb7bf955fa187 | hippysurfer/family-camp | family_camp/schedule/deep.py | [
"MIT"
] | Python | bestness | <not_specific> | def bestness(self):
"""Return a composite measure of how 'good' the individual is.
The smaller the value the better it is."""
count = 0
# Start by using a simple variance to favour a timetable
# where the sessions have an even spread of campers.
count += pvariance([len... | Return a composite measure of how 'good' the individual is.
The smaller the value the better it is. | Return a composite measure of how 'good' the individual is.
The smaller the value the better it is. | [
"Return",
"a",
"composite",
"measure",
"of",
"how",
"'",
"good",
"'",
"the",
"individual",
"is",
".",
"The",
"smaller",
"the",
"value",
"the",
"better",
"it",
"is",
"."
] | def bestness(self):
count = 0
count += pvariance([len(inst.campers) for inst in self.session_inst])
return count | [
"def",
"bestness",
"(",
"self",
")",
":",
"count",
"=",
"0",
"count",
"+=",
"pvariance",
"(",
"[",
"len",
"(",
"inst",
".",
"campers",
")",
"for",
"inst",
"in",
"self",
".",
"session_inst",
"]",
")",
"return",
"count"
] | Return a composite measure of how 'good' the individual is. | [
"Return",
"a",
"composite",
"measure",
"of",
"how",
"'",
"good",
"'",
"the",
"individual",
"is",
"."
] | [
"\"\"\"Return a composite measure of how 'good' the individual is.\n\n The smaller the value the better it is.\"\"\"",
"# Start by using a simple variance to favour a timetable",
"# where the sessions have an even spread of campers."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
db6ed11ef7197aa43dfd4e8b584bb7bf955fa187 | hippysurfer/family-camp | family_camp/schedule/deep.py | [
"MIT"
] | Python | individual_from_list | <not_specific> | def individual_from_list(schedule, campers, activities, sessions):
"""Generate an individual from a list of the form:
(group, camper, activity, start datetime)
"""
# create an empty individual
ind = [False, ] * len(sessions) * len(campers)
for (group, camper, activity, start_datetime) in ... | Generate an individual from a list of the form:
(group, camper, activity, start datetime)
| Generate an individual from a list of the form:
(group, camper, activity, start datetime) | [
"Generate",
"an",
"individual",
"from",
"a",
"list",
"of",
"the",
"form",
":",
"(",
"group",
"camper",
"activity",
"start",
"datetime",
")"
] | def individual_from_list(schedule, campers, activities, sessions):
ind = [False, ] * len(sessions) * len(campers)
for (group, camper, activity, start_datetime) in schedule:
c = [_ for _ in campers if _.group.strip() == group.strip() and _.name.strip() == camper.strip()]
if not c:
log... | [
"def",
"individual_from_list",
"(",
"schedule",
",",
"campers",
",",
"activities",
",",
"sessions",
")",
":",
"ind",
"=",
"[",
"False",
",",
"]",
"*",
"len",
"(",
"sessions",
")",
"*",
"len",
"(",
"campers",
")",
"for",
"(",
"group",
",",
"camper",
"... | Generate an individual from a list of the form:
(group, camper, activity, start datetime) | [
"Generate",
"an",
"individual",
"from",
"a",
"list",
"of",
"the",
"form",
":",
"(",
"group",
"camper",
"activity",
"start",
"datetime",
")"
] | [
"\"\"\"Generate an individual from a list of the form:\n\n (group, camper, activity, start datetime)\n\n \"\"\"",
"# create an empty individual",
"# Almost certainly the wrong date format, try again."
] | [
{
"param": "schedule",
"type": null
},
{
"param": "campers",
"type": null
},
{
"param": "activities",
"type": null
},
{
"param": "sessions",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "schedule",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "campers",
"type": null,
"docstring": null,
"docstring_tok... |
db6ed11ef7197aa43dfd4e8b584bb7bf955fa187 | hippysurfer/family-camp | family_camp/schedule/deep.py | [
"MIT"
] | Python | sessions_overlap | <not_specific> | def sessions_overlap(first, second):
"If the start of the first sesssion is between the start "
"and end of the second or the end of the first session is "
"between the start and end of the second or the start of "
"the second session is between the start and end of the first or"
"the end of the sec... | If the start of the first sesssion is between the start | If the start of the first sesssion is between the start | [
"If",
"the",
"start",
"of",
"the",
"first",
"sesssion",
"is",
"between",
"the",
"start"
] | def sessions_overlap(first, second):
if first.start >= second.start and first.start <= second.end:
return True
if first.end >= second.start and first.start <= second.end:
return True
if second.start >= first.start and second.start <= first.end:
return True
if second.end >= first.... | [
"def",
"sessions_overlap",
"(",
"first",
",",
"second",
")",
":",
"\"and end of the second or the end of the first session is \"",
"\"between the start and end of the second or the start of \"",
"\"the second session is between the start and end of the first or\"",
"\"the end of the second ses... | If the start of the first sesssion is between the start | [
"If",
"the",
"start",
"of",
"the",
"first",
"sesssion",
"is",
"between",
"the",
"start"
] | [
"\"If the start of the first sesssion is between the start \"",
"\"and end of the second or the end of the first session is \"",
"\"between the start and end of the second or the start of \"",
"\"the second session is between the start and end of the first or\"",
"\"the end of the second session is between ... | [
{
"param": "first",
"type": null
},
{
"param": "second",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "first",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "second",
"type": null,
"docstring": null,
"docstring_tokens"... |
db6ed11ef7197aa43dfd4e8b584bb7bf955fa187 | hippysurfer/family-camp | family_camp/schedule/deep.py | [
"MIT"
] | Python | dump_to_dir | null | def dump_to_dir(self, num_timetables=10):
"""Write details of the current hall to the output directory."""
dt = datetime.strftime(datetime.now(), "%Y_%m_%d_%H_%M")
for i in range(0, min(num_timetables, len(self))):
filename = "{} - {}".format(dt, i)
with open(os.path.j... | Write details of the current hall to the output directory. | Write details of the current hall to the output directory. | [
"Write",
"details",
"of",
"the",
"current",
"hall",
"to",
"the",
"output",
"directory",
"."
] | def dump_to_dir(self, num_timetables=10):
dt = datetime.strftime(datetime.now(), "%Y_%m_%d_%H_%M")
for i in range(0, min(num_timetables, len(self))):
filename = "{} - {}".format(dt, i)
with open(os.path.join(self.dest, filename + "_summary.txt"), "w") as summary:
... | [
"def",
"dump_to_dir",
"(",
"self",
",",
"num_timetables",
"=",
"10",
")",
":",
"dt",
"=",
"datetime",
".",
"strftime",
"(",
"datetime",
".",
"now",
"(",
")",
",",
"\"%Y_%m_%d_%H_%M\"",
")",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"min",
"(",
"num_t... | Write details of the current hall to the output directory. | [
"Write",
"details",
"of",
"the",
"current",
"hall",
"to",
"the",
"output",
"directory",
"."
] | [
"\"\"\"Write details of the current hall to the output directory.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "num_timetables",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "num_timetables",
"type": null,
"docstring": null,
"docstring_... |
db6ed11ef7197aa43dfd4e8b584bb7bf955fa187 | hippysurfer/family-camp | family_camp/schedule/deep.py | [
"MIT"
] | Python | mate | <not_specific> | def mate(ind1, ind2, campers, sessions):
"""Mate two timetables by selecting families at random and swaping
their schedules from one timetable to the other."""
# # create a list of all families to keep track of which have been
# # considered.
# families = list(set([_.group for _ in campers]))
... | Mate two timetables by selecting families at random and swaping
their schedules from one timetable to the other. | Mate two timetables by selecting families at random and swaping
their schedules from one timetable to the other. | [
"Mate",
"two",
"timetables",
"by",
"selecting",
"families",
"at",
"random",
"and",
"swaping",
"their",
"schedules",
"from",
"one",
"timetable",
"to",
"the",
"other",
"."
] | def mate(ind1, ind2, campers, sessions):
return (ind1, ind2) | [
"def",
"mate",
"(",
"ind1",
",",
"ind2",
",",
"campers",
",",
"sessions",
")",
":",
"return",
"(",
"ind1",
",",
"ind2",
")"
] | Mate two timetables by selecting families at random and swaping
their schedules from one timetable to the other. | [
"Mate",
"two",
"timetables",
"by",
"selecting",
"families",
"at",
"random",
"and",
"swaping",
"their",
"schedules",
"from",
"one",
"timetable",
"to",
"the",
"other",
"."
] | [
"\"\"\"Mate two timetables by selecting families at random and swaping\n their schedules from one timetable to the other.\"\"\"",
"# # create a list of all families to keep track of which have been",
"# # considered.",
"# families = list(set([_.group for _ in campers]))",
"# # Optimsations",
"# len_cam... | [
{
"param": "ind1",
"type": null
},
{
"param": "ind2",
"type": null
},
{
"param": "campers",
"type": null
},
{
"param": "sessions",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ind1",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ind2",
"type": null,
"docstring": null,
"docstring_tokens": [... |
125cd86b59bcde0b63658f4a2eb571bda272f338 | hippysurfer/family-camp | Archive/Old Shell Version/gen_invoices.py | [
"MIT"
] | Python | send_email_with_attachment | null | def send_email_with_attachment(subject, body_text, to_emails,
cc_emails, bcc_emails, file_to_attach):
"""
Send an email with an attachment
"""
header = ['Content-Disposition',
'attachment; filename="{}"'.format(file_to_attach)]
# create the message
m... |
Send an email with an attachment
| Send an email with an attachment | [
"Send",
"an",
"email",
"with",
"an",
"attachment"
] | def send_email_with_attachment(subject, body_text, to_emails,
cc_emails, bcc_emails, file_to_attach):
header = ['Content-Disposition',
'attachment; filename="{}"'.format(file_to_attach)]
msg = MIMEMultipart()
msg["From"] = FROM
msg["Subject"] = subject
ms... | [
"def",
"send_email_with_attachment",
"(",
"subject",
",",
"body_text",
",",
"to_emails",
",",
"cc_emails",
",",
"bcc_emails",
",",
"file_to_attach",
")",
":",
"header",
"=",
"[",
"'Content-Disposition'",
",",
"'attachment; filename=\"{}\"'",
".",
"format",
"(",
"fil... | Send an email with an attachment | [
"Send",
"an",
"email",
"with",
"an",
"attachment"
] | [
"\"\"\"\n Send an email with an attachment\n \"\"\"",
"# create the message"
] | [
{
"param": "subject",
"type": null
},
{
"param": "body_text",
"type": null
},
{
"param": "to_emails",
"type": null
},
{
"param": "cc_emails",
"type": null
},
{
"param": "bcc_emails",
"type": null
},
{
"param": "file_to_attach",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "subject",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "body_text",
"type": null,
"docstring": null,
"docstring_to... |
d4bb58d492695116f4882197afffe3342b3c6711 | hippysurfer/family-camp | family_camp/schedule/timetable_cps.py | [
"MIT"
] | Python | overlapping_sessions | <not_specific> | def overlapping_sessions(session, sessions):
"""Return a list of sessions from sessions that overlap
with session."""
return [sessions.index(_) for _ in sessions
if (_ != session
and sessions_overlap(
_, session))] | Return a list of sessions from sessions that overlap
with session. | Return a list of sessions from sessions that overlap
with session. | [
"Return",
"a",
"list",
"of",
"sessions",
"from",
"sessions",
"that",
"overlap",
"with",
"session",
"."
] | def overlapping_sessions(session, sessions):
return [sessions.index(_) for _ in sessions
if (_ != session
and sessions_overlap(
_, session))] | [
"def",
"overlapping_sessions",
"(",
"session",
",",
"sessions",
")",
":",
"return",
"[",
"sessions",
".",
"index",
"(",
"_",
")",
"for",
"_",
"in",
"sessions",
"if",
"(",
"_",
"!=",
"session",
"and",
"sessions_overlap",
"(",
"_",
",",
"session",
")",
"... | Return a list of sessions from sessions that overlap
with session. | [
"Return",
"a",
"list",
"of",
"sessions",
"from",
"sessions",
"that",
"overlap",
"with",
"session",
"."
] | [
"\"\"\"Return a list of sessions from sessions that overlap\n with session.\"\"\""
] | [
{
"param": "session",
"type": null
},
{
"param": "sessions",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "session",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sessions",
"type": null,
"docstring": null,
"docstring_tok... |
d4bb58d492695116f4882197afffe3342b3c6711 | hippysurfer/family-camp | family_camp/schedule/timetable_cps.py | [
"MIT"
] | Python | possible_family_arrangements_for_activity | <not_specific> | def possible_family_arrangements_for_activity(activity, groups):
"""Return the allowable arrangements of families for the given activity.
"""
# Get the indexes for all families that requested this activity.
filtered_groups = [_ for _ in range(len(groups)) if len(groups[_].activities[activity.name]) > 0... | Return the allowable arrangements of families for the given activity.
| Return the allowable arrangements of families for the given activity. | [
"Return",
"the",
"allowable",
"arrangements",
"of",
"families",
"for",
"the",
"given",
"activity",
"."
] | def possible_family_arrangements_for_activity(activity, groups):
filtered_groups = [_ for _ in range(len(groups)) if len(groups[_].activities[activity.name]) > 0]
members = [len(groups[_].activities[activity.name]) for _ in filtered_groups]
solver = pywrapcp.Solver("Act")
x = [solver.IntVar(0, 1, "x%d" ... | [
"def",
"possible_family_arrangements_for_activity",
"(",
"activity",
",",
"groups",
")",
":",
"filtered_groups",
"=",
"[",
"_",
"for",
"_",
"in",
"range",
"(",
"len",
"(",
"groups",
")",
")",
"if",
"len",
"(",
"groups",
"[",
"_",
"]",
".",
"activities",
... | Return the allowable arrangements of families for the given activity. | [
"Return",
"the",
"allowable",
"arrangements",
"of",
"families",
"for",
"the",
"given",
"activity",
"."
] | [
"\"\"\"Return the allowable arrangements of families for the given activity.\n \"\"\"",
"# Get the indexes for all families that requested this activity.",
"# - number of members of each family that want the activity",
"# x = [ 0,1,1,0 ] - boolean for each family",
"#",
"# sum (a[i] * b[i] ) for all i ... | [
{
"param": "activity",
"type": null
},
{
"param": "groups",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "activity",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "groups",
"type": null,
"docstring": null,
"docstring_toke... |
ac0b92bdbd7ba3cc41338e07fbee6177128bb14c | jarvis-cochrane/paranuara | paranuara_api/management/base.py | [
"BSD-3-Clause"
] | Python | _import | null | def _import(self, fp):
"""
Abstract method to import data from the supplied open file object
"""
pass |
Abstract method to import data from the supplied open file object
| Abstract method to import data from the supplied open file object | [
"Abstract",
"method",
"to",
"import",
"data",
"from",
"the",
"supplied",
"open",
"file",
"object"
] | def _import(self, fp):
pass | [
"def",
"_import",
"(",
"self",
",",
"fp",
")",
":",
"pass"
] | Abstract method to import data from the supplied open file object | [
"Abstract",
"method",
"to",
"import",
"data",
"from",
"the",
"supplied",
"open",
"file",
"object"
] | [
"\"\"\"\n Abstract method to import data from the supplied open file object\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "fp",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fp",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
da27ae329ffe64f08432721dcfa8f14369fee24e | metux/boost | debian/update-control.py | [
"BSL-1.0"
] | Python | replaceVersion | <not_specific> | def replaceVersion(self, string, replacement):
'''Replace either PackageVersion or SharedObjectVersion if contained in 'string',
with 'replacement'.'''
string = re.sub(self.SharedObjectVersion, replacement, string)
string = re.sub(self.PackageVersion, replacement, string)
return ... | Replace either PackageVersion or SharedObjectVersion if contained in 'string',
with 'replacement'. | Replace either PackageVersion or SharedObjectVersion if contained in 'string',
with 'replacement'. | [
"Replace",
"either",
"PackageVersion",
"or",
"SharedObjectVersion",
"if",
"contained",
"in",
"'",
"string",
"'",
"with",
"'",
"replacement",
"'",
"."
] | def replaceVersion(self, string, replacement):
string = re.sub(self.SharedObjectVersion, replacement, string)
string = re.sub(self.PackageVersion, replacement, string)
return string | [
"def",
"replaceVersion",
"(",
"self",
",",
"string",
",",
"replacement",
")",
":",
"string",
"=",
"re",
".",
"sub",
"(",
"self",
".",
"SharedObjectVersion",
",",
"replacement",
",",
"string",
")",
"string",
"=",
"re",
".",
"sub",
"(",
"self",
".",
"Pac... | Replace either PackageVersion or SharedObjectVersion if contained in 'string',
with 'replacement'. | [
"Replace",
"either",
"PackageVersion",
"or",
"SharedObjectVersion",
"if",
"contained",
"in",
"'",
"string",
"'",
"with",
"'",
"replacement",
"'",
"."
] | [
"'''Replace either PackageVersion or SharedObjectVersion if contained in 'string',\n with 'replacement'.'''"
] | [
{
"param": "self",
"type": null
},
{
"param": "string",
"type": null
},
{
"param": "replacement",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "string",
"type": null,
"docstring": null,
"docstring_tokens":... |
da27ae329ffe64f08432721dcfa8f14369fee24e | metux/boost | debian/update-control.py | [
"BSL-1.0"
] | Python | replaceVersion | <not_specific> | def replaceVersion(string, ver1, ver2):
'''Search 'string' for a BoostVersion ver1. If
SharedObjectVersion or PackageVersion of ver1 is found, replace by
corresponding ver2 version string. Return the updated string.'''
string = re.sub(ver1.SharedObjectVersion, ver2.SharedObjectVersion, string)
str... | Search 'string' for a BoostVersion ver1. If
SharedObjectVersion or PackageVersion of ver1 is found, replace by
corresponding ver2 version string. Return the updated string. | Search 'string' for a BoostVersion ver1. If
SharedObjectVersion or PackageVersion of ver1 is found, replace by
corresponding ver2 version string. Return the updated string. | [
"Search",
"'",
"string",
"'",
"for",
"a",
"BoostVersion",
"ver1",
".",
"If",
"SharedObjectVersion",
"or",
"PackageVersion",
"of",
"ver1",
"is",
"found",
"replace",
"by",
"corresponding",
"ver2",
"version",
"string",
".",
"Return",
"the",
"updated",
"string",
"... | def replaceVersion(string, ver1, ver2):
string = re.sub(ver1.SharedObjectVersion, ver2.SharedObjectVersion, string)
string = re.sub(ver1.PackageVersion, ver2.PackageVersion, string)
return string | [
"def",
"replaceVersion",
"(",
"string",
",",
"ver1",
",",
"ver2",
")",
":",
"string",
"=",
"re",
".",
"sub",
"(",
"ver1",
".",
"SharedObjectVersion",
",",
"ver2",
".",
"SharedObjectVersion",
",",
"string",
")",
"string",
"=",
"re",
".",
"sub",
"(",
"ve... | Search 'string' for a BoostVersion ver1. | [
"Search",
"'",
"string",
"'",
"for",
"a",
"BoostVersion",
"ver1",
"."
] | [
"'''Search 'string' for a BoostVersion ver1. If\n SharedObjectVersion or PackageVersion of ver1 is found, replace by\n corresponding ver2 version string. Return the updated string.'''"
] | [
{
"param": "string",
"type": null
},
{
"param": "ver1",
"type": null
},
{
"param": "ver2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "string",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ver1",
"type": null,
"docstring": null,
"docstring_tokens":... |
e695fee2e4ae53dcf501ab98121c82ca89698e33 | muzudho/floodgate-server-dammy | server.py | [
"MIT"
] | Python | listen_for_client | null | def listen_for_client(client_sock):
"""
This function keep listening for a message from `client_sock` socket
Whenever a message is received, broadcast it to all other connected clients
"""
global client_sockets
while True:
try:
# keep listening for a message from `client_soc... |
This function keep listening for a message from `client_sock` socket
Whenever a message is received, broadcast it to all other connected clients
| This function keep listening for a message from `client_sock` socket
Whenever a message is received, broadcast it to all other connected clients | [
"This",
"function",
"keep",
"listening",
"for",
"a",
"message",
"from",
"`",
"client_sock",
"`",
"socket",
"Whenever",
"a",
"message",
"is",
"received",
"broadcast",
"it",
"to",
"all",
"other",
"connected",
"clients"
] | def listen_for_client(client_sock):
global client_sockets
while True:
try:
line = client_sock.recv(MESSAGE_SIZE).decode()
print(f"listen_for_client: line=[{line}]")
except Exception as e:
print(f"[!] Error: {e}")
print(f"Remove a socket")
... | [
"def",
"listen_for_client",
"(",
"client_sock",
")",
":",
"global",
"client_sockets",
"while",
"True",
":",
"try",
":",
"line",
"=",
"client_sock",
".",
"recv",
"(",
"MESSAGE_SIZE",
")",
".",
"decode",
"(",
")",
"print",
"(",
"f\"listen_for_client: line=[{line}]... | This function keep listening for a message from `client_sock` socket
Whenever a message is received, broadcast it to all other connected clients | [
"This",
"function",
"keep",
"listening",
"for",
"a",
"message",
"from",
"`",
"client_sock",
"`",
"socket",
"Whenever",
"a",
"message",
"is",
"received",
"broadcast",
"it",
"to",
"all",
"other",
"connected",
"clients"
] | [
"\"\"\"\n This function keep listening for a message from `client_sock` socket\n Whenever a message is received, broadcast it to all other connected clients\n \"\"\"",
"# keep listening for a message from `client_sock` socket",
"# client no longer connected",
"# remove it from the set",
"# 処理は serv... | [
{
"param": "client_sock",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "client_sock",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d344f9cc5a0bd1cceb721e0e85c5bc0535355c89 | rohe/pysfemma | tools/adfs2fed.py | [
"BSD-2-Clause"
] | Python | exportAdfs2Fed | <not_specific> | def exportAdfs2Fed(idpUrl, scope):
"""
Modifies ADFS metadata removing and inserting elements in order to avoid parsing problems on Shibboleth-side
"""
adfsEndpoint = "/FederationMetadata/2007-06/FederationMetadata.xml"
shibNameSpace = 'xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"'
extensions = '<Extensions>\n... |
Modifies ADFS metadata removing and inserting elements in order to avoid parsing problems on Shibboleth-side
| Modifies ADFS metadata removing and inserting elements in order to avoid parsing problems on Shibboleth-side | [
"Modifies",
"ADFS",
"metadata",
"removing",
"and",
"inserting",
"elements",
"in",
"order",
"to",
"avoid",
"parsing",
"problems",
"on",
"Shibboleth",
"-",
"side"
] | def exportAdfs2Fed(idpUrl, scope):
adfsEndpoint = "/FederationMetadata/2007-06/FederationMetadata.xml"
shibNameSpace = 'xmlns:shibmd="urn:mace:shibboleth:metadata:1.0"'
extensions = '<Extensions>\n <shibmd:Scope regexp="false">' + scope + '</shibmd:Scope>\n </Extensions>\n '
mdString = ""
try:
metadata = ur... | [
"def",
"exportAdfs2Fed",
"(",
"idpUrl",
",",
"scope",
")",
":",
"adfsEndpoint",
"=",
"\"/FederationMetadata/2007-06/FederationMetadata.xml\"",
"shibNameSpace",
"=",
"'xmlns:shibmd=\"urn:mace:shibboleth:metadata:1.0\"'",
"extensions",
"=",
"'<Extensions>\\n <shibmd:Scope regexp=\"f... | Modifies ADFS metadata removing and inserting elements in order to avoid parsing problems on Shibboleth-side | [
"Modifies",
"ADFS",
"metadata",
"removing",
"and",
"inserting",
"elements",
"in",
"order",
"to",
"avoid",
"parsing",
"problems",
"on",
"Shibboleth",
"-",
"side"
] | [
"\"\"\"\n\tModifies ADFS metadata removing and inserting elements in order to avoid parsing problems on Shibboleth-side\n\t\"\"\"",
"# get metadata",
"# remove signature, RoleDescriptor and SPSSODescriptor elements in order to avoid incompatibilities with",
"# the Switch WAYF shipped parser",
"# add SAML1 S... | [
{
"param": "idpUrl",
"type": null
},
{
"param": "scope",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "idpUrl",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "scope",
"type": null,
"docstring": null,
"docstring_tokens"... |
76c0e17677b80d7cc90afcc7ee7edf0d4c1ea9cc | rohe/pysfemma | pysfemma.py | [
"BSD-2-Clause"
] | Python | is_persistent | <not_specific> | def is_persistent(self, entityID):
"""
Checks if the provided entityID of the Service Provider has configured rules
that match a list of sensitive ones. If this is the case, it associates a
persistent-id.
Default is transient-id.
To customize this behavior, use the follow... |
Checks if the provided entityID of the Service Provider has configured rules
that match a list of sensitive ones. If this is the case, it associates a
persistent-id.
Default is transient-id.
To customize this behavior, use the following section and syntax in
settings.cfg... | Checks if the provided entityID of the Service Provider has configured rules
that match a list of sensitive ones. If this is the case, it associates a
persistent-id.
Default is transient-id.
To customize this behavior, use the following section and syntax in
settings.cfg:
[SensitiveAttributes]
rules = rule1,rule2
To f... | [
"Checks",
"if",
"the",
"provided",
"entityID",
"of",
"the",
"Service",
"Provider",
"has",
"configured",
"rules",
"that",
"match",
"a",
"list",
"of",
"sensitive",
"ones",
".",
"If",
"this",
"is",
"the",
"case",
"it",
"associates",
"a",
"persistent",
"-",
"i... | def is_persistent(self, entityID):
ret = False
entityName = self._strip_protocol_identifier(entityID)
try:
sensitiveRules = self.config.get('SensitiveAttributes', 'rules')
configuredRules = self.config.get('ServiceProviderAttributes',
... | [
"def",
"is_persistent",
"(",
"self",
",",
"entityID",
")",
":",
"ret",
"=",
"False",
"entityName",
"=",
"self",
".",
"_strip_protocol_identifier",
"(",
"entityID",
")",
"try",
":",
"sensitiveRules",
"=",
"self",
".",
"config",
".",
"get",
"(",
"'SensitiveAtt... | Checks if the provided entityID of the Service Provider has configured rules
that match a list of sensitive ones. | [
"Checks",
"if",
"the",
"provided",
"entityID",
"of",
"the",
"Service",
"Provider",
"has",
"configured",
"rules",
"that",
"match",
"a",
"list",
"of",
"sensitive",
"ones",
"."
] | [
"\"\"\"\n Checks if the provided entityID of the Service Provider has configured rules\n that match a list of sensitive ones. If this is the case, it associates a\n persistent-id.\n Default is transient-id.\n To customize this behavior, use the following section and syntax in\n ... | [
{
"param": "self",
"type": null
},
{
"param": "entityID",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "entityID",
"type": null,
"docstring": null,
"docstring_tokens... |
76c0e17677b80d7cc90afcc7ee7edf0d4c1ea9cc | rohe/pysfemma | pysfemma.py | [
"BSD-2-Clause"
] | Python | ruleset_creation | <not_specific> | def ruleset_creation(self, myClaimType, rulesetFileName, entity):
"""
Creates Service Provider ruleset file with NameID creation based on
persistent-id by default
"""
_eid = entity["entity_id"]
try:
# load template from configured file
if self.is_p... |
Creates Service Provider ruleset file with NameID creation based on
persistent-id by default
| Creates Service Provider ruleset file with NameID creation based on
persistent-id by default | [
"Creates",
"Service",
"Provider",
"ruleset",
"file",
"with",
"NameID",
"creation",
"based",
"on",
"persistent",
"-",
"id",
"by",
"default"
] | def ruleset_creation(self, myClaimType, rulesetFileName, entity):
_eid = entity["entity_id"]
try:
if self.is_persistent(_eid):
ruleID = Template(open(self.ruleset_persistent, "r").read())
else:
ruleID = Template(open(self.ruleset_transient, "r").re... | [
"def",
"ruleset_creation",
"(",
"self",
",",
"myClaimType",
",",
"rulesetFileName",
",",
"entity",
")",
":",
"_eid",
"=",
"entity",
"[",
"\"entity_id\"",
"]",
"try",
":",
"if",
"self",
".",
"is_persistent",
"(",
"_eid",
")",
":",
"ruleID",
"=",
"Template",... | Creates Service Provider ruleset file with NameID creation based on
persistent-id by default | [
"Creates",
"Service",
"Provider",
"ruleset",
"file",
"with",
"NameID",
"creation",
"based",
"on",
"persistent",
"-",
"id",
"by",
"default"
] | [
"\"\"\"\n Creates Service Provider ruleset file with NameID creation based on\n persistent-id by default\n \"\"\"",
"# load template from configured file",
"# susbstitutes rules and entityID",
"# create ruleset files"
] | [
{
"param": "self",
"type": null
},
{
"param": "myClaimType",
"type": null
},
{
"param": "rulesetFileName",
"type": null
},
{
"param": "entity",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "myClaimType",
"type": null,
"docstring": null,
"docstring_tok... |
76c0e17677b80d7cc90afcc7ee7edf0d4c1ea9cc | rohe/pysfemma | pysfemma.py | [
"BSD-2-Clause"
] | Python | stripBindingsNotSupported | <not_specific> | def stripBindingsNotSupported(self, entity):
"""
Removes AssertionConsumerServices and SingleLogoutServices that uses
bindings that ADFS does not support.
Also removes AssertionConsumerServices endpoint that doesn't use HTTPS.
Returns the modified entity or None if there are not ... |
Removes AssertionConsumerServices and SingleLogoutServices that uses
bindings that ADFS does not support.
Also removes AssertionConsumerServices endpoint that doesn't use HTTPS.
Returns the modified entity or None if there are not remaining endpoints
after filtering.
:p... | Removes AssertionConsumerServices and SingleLogoutServices that uses
bindings that ADFS does not support.
Also removes AssertionConsumerServices endpoint that doesn't use HTTPS.
Returns the modified entity or None if there are not remaining endpoints
after filtering. | [
"Removes",
"AssertionConsumerServices",
"and",
"SingleLogoutServices",
"that",
"uses",
"bindings",
"that",
"ADFS",
"does",
"not",
"support",
".",
"Also",
"removes",
"AssertionConsumerServices",
"endpoint",
"that",
"doesn",
"'",
"t",
"use",
"HTTPS",
".",
"Returns",
"... | def stripBindingsNotSupported(self, entity):
_sps = []
for sp in entity["spsso_descriptor"]:
_acs = []
for acs in sp["assertion_consumer_service"]:
if acs["binding"] not in BINDINGS_NOT_SUPPORTED:
if acs["location"].startswith("https:"):
... | [
"def",
"stripBindingsNotSupported",
"(",
"self",
",",
"entity",
")",
":",
"_sps",
"=",
"[",
"]",
"for",
"sp",
"in",
"entity",
"[",
"\"spsso_descriptor\"",
"]",
":",
"_acs",
"=",
"[",
"]",
"for",
"acs",
"in",
"sp",
"[",
"\"assertion_consumer_service\"",
"]"... | Removes AssertionConsumerServices and SingleLogoutServices that uses
bindings that ADFS does not support. | [
"Removes",
"AssertionConsumerServices",
"and",
"SingleLogoutServices",
"that",
"uses",
"bindings",
"that",
"ADFS",
"does",
"not",
"support",
"."
] | [
"\"\"\"\n Removes AssertionConsumerServices and SingleLogoutServices that uses\n bindings that ADFS does not support.\n Also removes AssertionConsumerServices endpoint that doesn't use HTTPS.\n Returns the modified entity or None if there are not remaining endpoints\n after filter... | [
{
"param": "self",
"type": null
},
{
"param": "entity",
"type": null
}
] | {
"returns": [
{
"docstring": "Entity descriptor or None of no usable endpoints remained",
"docstring_tokens": [
"Entity",
"descriptor",
"or",
"None",
"of",
"no",
"usable",
"endpoints",
"remained"
],
"type": null
}... |
76c0e17677b80d7cc90afcc7ee7edf0d4c1ea9cc | rohe/pysfemma | pysfemma.py | [
"BSD-2-Clause"
] | Python | stripRolloverKeys | <not_specific> | def stripRolloverKeys(self, entity):
"""
If the entity metadata contains keys for safe-rollover, strips the
Standby key because ADFS can't handle it
:param entity: Entity descriptor
:return: Entity descriptor or None of no working keys remain
"""
_sps = []
... |
If the entity metadata contains keys for safe-rollover, strips the
Standby key because ADFS can't handle it
:param entity: Entity descriptor
:return: Entity descriptor or None of no working keys remain
| If the entity metadata contains keys for safe-rollover, strips the
Standby key because ADFS can't handle it | [
"If",
"the",
"entity",
"metadata",
"contains",
"keys",
"for",
"safe",
"-",
"rollover",
"strips",
"the",
"Standby",
"key",
"because",
"ADFS",
"can",
"'",
"t",
"handle",
"it"
] | def stripRolloverKeys(self, entity):
_sps = []
for sp in entity["spsso_descriptor"]:
toRemove = []
try:
key_desc = sp["key_descriptor"]
except KeyError:
continue
else:
for kd in key_desc:
... | [
"def",
"stripRolloverKeys",
"(",
"self",
",",
"entity",
")",
":",
"_sps",
"=",
"[",
"]",
"for",
"sp",
"in",
"entity",
"[",
"\"spsso_descriptor\"",
"]",
":",
"toRemove",
"=",
"[",
"]",
"try",
":",
"key_desc",
"=",
"sp",
"[",
"\"key_descriptor\"",
"]",
"... | If the entity metadata contains keys for safe-rollover, strips the
Standby key because ADFS can't handle it | [
"If",
"the",
"entity",
"metadata",
"contains",
"keys",
"for",
"safe",
"-",
"rollover",
"strips",
"the",
"Standby",
"key",
"because",
"ADFS",
"can",
"'",
"t",
"handle",
"it"
] | [
"\"\"\"\n If the entity metadata contains keys for safe-rollover, strips the\n Standby key because ADFS can't handle it\n\n :param entity: Entity descriptor\n :return: Entity descriptor or None of no working keys remain\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "entity",
"type": null
}
] | {
"returns": [
{
"docstring": "Entity descriptor or None of no working keys remain",
"docstring_tokens": [
"Entity",
"descriptor",
"or",
"None",
"of",
"no",
"working",
"keys",
"remain"
],
"type": null
}
],
"rai... |
76c0e17677b80d7cc90afcc7ee7edf0d4c1ea9cc | rohe/pysfemma | pysfemma.py | [
"BSD-2-Clause"
] | Python | extract | null | def extract(self):
"""
Creates separate metadata file for each Service Provider entityID in
the original metadata files.
It will weed out SPs that fulfills any of these criteria:
1. no valid keys
2. no Assertion Consuming Services endpoints with bindings supported by
... |
Creates separate metadata file for each Service Provider entityID in
the original metadata files.
It will weed out SPs that fulfills any of these criteria:
1. no valid keys
2. no Assertion Consuming Services endpoints with bindings supported by
ADFS
3. no HT... | Creates separate metadata file for each Service Provider entityID in
the original metadata files.
It will weed out SPs that fulfills any of these criteria:
1. no valid keys
2. no Assertion Consuming Services endpoints with bindings supported by
ADFS
3. no HTTPS based Assertion Consuming Service endpoints | [
"Creates",
"separate",
"metadata",
"file",
"for",
"each",
"Service",
"Provider",
"entityID",
"in",
"the",
"original",
"metadata",
"files",
".",
"It",
"will",
"weed",
"out",
"SPs",
"that",
"fulfills",
"any",
"of",
"these",
"criteria",
":",
"1",
".",
"no",
"... | def extract(self):
pshScript = ""
pshScriptTemplate = Template(open(self.powershell_metadata_update,
'r').read())
for eid, entity in self.mds.items():
if "spsso_descriptor" in entity:
if not self.entity_to_ignore(eid):
... | [
"def",
"extract",
"(",
"self",
")",
":",
"pshScript",
"=",
"\"\"",
"pshScriptTemplate",
"=",
"Template",
"(",
"open",
"(",
"self",
".",
"powershell_metadata_update",
",",
"'r'",
")",
".",
"read",
"(",
")",
")",
"for",
"eid",
",",
"entity",
"in",
"self",
... | Creates separate metadata file for each Service Provider entityID in
the original metadata files. | [
"Creates",
"separate",
"metadata",
"file",
"for",
"each",
"Service",
"Provider",
"entityID",
"in",
"the",
"original",
"metadata",
"files",
"."
] | [
"\"\"\"\n Creates separate metadata file for each Service Provider entityID in\n the original metadata files.\n\n It will weed out SPs that fulfills any of these criteria:\n 1. no valid keys\n 2. no Assertion Consuming Services endpoints with bindings supported by\n ADF... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
aabda7de4a5f5afc03cfee4448a68792944b7be9 | szhao045/scMPRA_parsing | parsing_quads_v2.py | [
"BSD-3-Clause"
] | Python | check_bulk_plasmid_lib | <not_specific> | def check_bulk_plasmid_lib(read1):
'''
General information: spike-in library checks are done with 2by150 reads, so
Read1 Alone is enough for giving all the information.
Sample Read is stored at ./sample_read.dna in the same folder
Input: read-in line from read1.
Output: parsed promBC and rBC
... |
General information: spike-in library checks are done with 2by150 reads, so
Read1 Alone is enough for giving all the information.
Sample Read is stored at ./sample_read.dna in the same folder
Input: read-in line from read1.
Output: parsed promBC and rBC
| General information: spike-in library checks are done with 2by150 reads, so
Read1 Alone is enough for giving all the information.
Sample Read is stored at ./sample_read.dna in the same folder
Input: read-in line from read1.
Output: parsed promBC and rBC | [
"General",
"information",
":",
"spike",
"-",
"in",
"library",
"checks",
"are",
"done",
"with",
"2by150",
"reads",
"so",
"Read1",
"Alone",
"is",
"enough",
"for",
"giving",
"all",
"the",
"information",
".",
"Sample",
"Read",
"is",
"stored",
"at",
".",
"/",
... | def check_bulk_plasmid_lib(read1):
BEFORE_PBC = 'AATCTAGA'
AFTER_PBC = 'GTCGAGAT'
BEFORE_RBC = 'AAGTTATG'
AFTER_RBC = 'GCTTTAAG'
pop = {}
pop['wrong'] = 0
pBC_left_lim = find_near_matches(BEFORE_PBC, read1, max_l_dist = 1)
pBC_right_lim = find_near_matches(AFTER_PBC, read1, max_l_dist = ... | [
"def",
"check_bulk_plasmid_lib",
"(",
"read1",
")",
":",
"BEFORE_PBC",
"=",
"'AATCTAGA'",
"AFTER_PBC",
"=",
"'GTCGAGAT'",
"BEFORE_RBC",
"=",
"'AAGTTATG'",
"AFTER_RBC",
"=",
"'GCTTTAAG'",
"pop",
"=",
"{",
"}",
"pop",
"[",
"'wrong'",
"]",
"=",
"0",
"pBC_left_lim... | General information: spike-in library checks are done with 2by150 reads, so
Read1 Alone is enough for giving all the information. | [
"General",
"information",
":",
"spike",
"-",
"in",
"library",
"checks",
"are",
"done",
"with",
"2by150",
"reads",
"so",
"Read1",
"Alone",
"is",
"enough",
"for",
"giving",
"all",
"the",
"information",
"."
] | [
"'''\n General information: spike-in library checks are done with 2by150 reads, so\n Read1 Alone is enough for giving all the information.\n Sample Read is stored at ./sample_read.dna in the same folder \n Input: read-in line from read1. \n Output: parsed promBC and rBC\n '''",
"# Global Variabl... | [
{
"param": "read1",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "read1",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
aabda7de4a5f5afc03cfee4448a68792944b7be9 | szhao045/scMPRA_parsing | parsing_quads_v2.py | [
"BSD-3-Clause"
] | Python | parse_fastq | <not_specific> | def parse_fastq(r1_file, r2_file):
'''
Function to parse fastq file from bulk RNA-seq.
This code should be able to be expanded to run with the later parsing
So it's important to make it modular.
'''
# Initiate a dict for holding the parsed barcodes, key is promBC + rBC
# value is the numbe... |
Function to parse fastq file from bulk RNA-seq.
This code should be able to be expanded to run with the later parsing
So it's important to make it modular.
| Function to parse fastq file from bulk RNA-seq.
This code should be able to be expanded to run with the later parsing
So it's important to make it modular. | [
"Function",
"to",
"parse",
"fastq",
"file",
"from",
"bulk",
"RNA",
"-",
"seq",
".",
"This",
"code",
"should",
"be",
"able",
"to",
"be",
"expanded",
"to",
"run",
"with",
"the",
"later",
"parsing",
"So",
"it",
"'",
"s",
"important",
"to",
"make",
"it",
... | def parse_fastq(r1_file, r2_file):
total_reads = 0
wrong_reads = 0
line_num = 0
promBCrBC = {}
with gzip.open(r1_file, 'rt') as r1:
with gzip.open(r2_file, 'rt') as r2:
for line1,line2 in zip(r1,r2):
line1 = line1.rstrip("\n")
line2 = line2.rst... | [
"def",
"parse_fastq",
"(",
"r1_file",
",",
"r2_file",
")",
":",
"total_reads",
"=",
"0",
"wrong_reads",
"=",
"0",
"line_num",
"=",
"0",
"promBCrBC",
"=",
"{",
"}",
"with",
"gzip",
".",
"open",
"(",
"r1_file",
",",
"'rt'",
")",
"as",
"r1",
":",
"with"... | Function to parse fastq file from bulk RNA-seq. | [
"Function",
"to",
"parse",
"fastq",
"file",
"from",
"bulk",
"RNA",
"-",
"seq",
"."
] | [
"'''\n Function to parse fastq file from bulk RNA-seq. \n This code should be able to be expanded to run with the later parsing\n So it's important to make it modular. \n '''",
"# Initiate a dict for holding the parsed barcodes, key is promBC + rBC",
"# value is the number of reads",
"# Call bulk ... | [
{
"param": "r1_file",
"type": null
},
{
"param": "r2_file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "r1_file",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "r2_file",
"type": null,
"docstring": null,
"docstring_toke... |
72a116e239e178c0b7a4f15725fb78694cf70686 | sanders41/fire-data | fire_data/api_data.py | [
"MIT"
] | Python | download_data | httpx.Response | def download_data(api_url: str) -> httpx.Response:
"""Download the data from the API.
This data gets cached so subsequent calls will be faster.
Args:
api_url: The url to use for the download
Returns:
The httpx response
Raises:
HTTPStatusError
"""
data = httpx.get(... | Download the data from the API.
This data gets cached so subsequent calls will be faster.
Args:
api_url: The url to use for the download
Returns:
The httpx response
Raises:
HTTPStatusError
| Download the data from the API.
This data gets cached so subsequent calls will be faster.
The url to use for the download
The httpx response
| [
"Download",
"the",
"data",
"from",
"the",
"API",
".",
"This",
"data",
"gets",
"cached",
"so",
"subsequent",
"calls",
"will",
"be",
"faster",
".",
"The",
"url",
"to",
"use",
"for",
"the",
"download",
"The",
"httpx",
"response"
] | def download_data(api_url: str) -> httpx.Response:
data = httpx.get(api_url)
data.raise_for_status()
return data | [
"def",
"download_data",
"(",
"api_url",
":",
"str",
")",
"->",
"httpx",
".",
"Response",
":",
"data",
"=",
"httpx",
".",
"get",
"(",
"api_url",
")",
"data",
".",
"raise_for_status",
"(",
")",
"return",
"data"
] | Download the data from the API. | [
"Download",
"the",
"data",
"from",
"the",
"API",
"."
] | [
"\"\"\"Download the data from the API.\n\n This data gets cached so subsequent calls will be faster.\n\n Args:\n api_url: The url to use for the download\n\n Returns:\n The httpx response\n\n Raises:\n HTTPStatusError\n \"\"\""
] | [
{
"param": "api_url",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "api_url",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
72a116e239e178c0b7a4f15725fb78694cf70686 | sanders41/fire-data | fire_data/api_data.py | [
"MIT"
] | Python | load_data_to_dataframe | pd.DataFrame | def load_data_to_dataframe(
api_url: str = "https://opendata.arcgis.com/datasets/8b90b56df08a4bd5bc1b868396873b61_11.geojson",
) -> pd.DataFrame:
"""Converts the propertry data into a DataFrame.
Args:
api_url: The url to use for the download. Defaults to
"https://opendata.arcgis.com/dat... | Converts the propertry data into a DataFrame.
Args:
api_url: The url to use for the download. Defaults to
"https://opendata.arcgis.com/datasets/8b90b56df08a4bd5bc1b868396873b61_11.geojson".
Returns:
A DataFrame containing the property data
Raises:
HTTPStatusError
| Converts the propertry data into a DataFrame.
Args:
api_url: The url to use for the download.
A DataFrame containing the property data
| [
"Converts",
"the",
"propertry",
"data",
"into",
"a",
"DataFrame",
".",
"Args",
":",
"api_url",
":",
"The",
"url",
"to",
"use",
"for",
"the",
"download",
".",
"A",
"DataFrame",
"containing",
"the",
"property",
"data"
] | def load_data_to_dataframe(
api_url: str = "https://opendata.arcgis.com/datasets/8b90b56df08a4bd5bc1b868396873b61_11.geojson",
) -> pd.DataFrame:
data = download_data(api_url)
properties = [x["properties"] for x in data.json()["features"] if x.get("properties")]
return pd.DataFrame(properties) | [
"def",
"load_data_to_dataframe",
"(",
"api_url",
":",
"str",
"=",
"\"https://opendata.arcgis.com/datasets/8b90b56df08a4bd5bc1b868396873b61_11.geojson\"",
",",
")",
"->",
"pd",
".",
"DataFrame",
":",
"data",
"=",
"download_data",
"(",
"api_url",
")",
"properties",
"=",
"... | Converts the propertry data into a DataFrame. | [
"Converts",
"the",
"propertry",
"data",
"into",
"a",
"DataFrame",
"."
] | [
"\"\"\"Converts the propertry data into a DataFrame.\n\n Args:\n api_url: The url to use for the download. Defaults to\n \"https://opendata.arcgis.com/datasets/8b90b56df08a4bd5bc1b868396873b61_11.geojson\".\n\n Returns:\n A DataFrame containing the property data\n\n Raises:\n ... | [
{
"param": "api_url",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "api_url",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2943ff0974ba55fac97b4dec6c96146bb904951b | jeremiahwander/sample-metadata | db/python/connect.py | [
"MIT"
] | Python | assert_requires_project | null | def assert_requires_project(self):
"""Assert the project is set, or return an exception"""
if self.project is None:
raise Exception(
'An internal error has occurred when passing the project context, '
'please send this stacktrace to your system administrator'
... | Assert the project is set, or return an exception | Assert the project is set, or return an exception | [
"Assert",
"the",
"project",
"is",
"set",
"or",
"return",
"an",
"exception"
] | def assert_requires_project(self):
if self.project is None:
raise Exception(
'An internal error has occurred when passing the project context, '
'please send this stacktrace to your system administrator'
) | [
"def",
"assert_requires_project",
"(",
"self",
")",
":",
"if",
"self",
".",
"project",
"is",
"None",
":",
"raise",
"Exception",
"(",
"'An internal error has occurred when passing the project context, '",
"'please send this stacktrace to your system administrator'",
")"
] | Assert the project is set, or return an exception | [
"Assert",
"the",
"project",
"is",
"set",
"or",
"return",
"an",
"exception"
] | [
"\"\"\"Assert the project is set, or return an exception\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2943ff0974ba55fac97b4dec6c96146bb904951b | jeremiahwander/sample-metadata | db/python/connect.py | [
"MIT"
] | Python | dev_config | 'DatabaseConfiguration' | def dev_config() -> 'DatabaseConfiguration':
"""Dev config for local database with name 'sm_dev'"""
# consider pulling from env variables
return DatabaseConfiguration(
dbname=os.environ.get('SM_DEV_DB_NAME', 'sm_dev'),
username=os.environ.get('SM_DEV_DB_USER', 'root'),
... | Dev config for local database with name 'sm_dev | Dev config for local database with name 'sm_dev | [
"Dev",
"config",
"for",
"local",
"database",
"with",
"name",
"'",
"sm_dev"
] | def dev_config() -> 'DatabaseConfiguration':
return DatabaseConfiguration(
dbname=os.environ.get('SM_DEV_DB_NAME', 'sm_dev'),
username=os.environ.get('SM_DEV_DB_USER', 'root'),
password=os.environ.get('SM_DEV_DB_PASSWORD', ''),
host=os.environ.get('SM_DEV_DB_HOST'... | [
"def",
"dev_config",
"(",
")",
"->",
"'DatabaseConfiguration'",
":",
"return",
"DatabaseConfiguration",
"(",
"dbname",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'SM_DEV_DB_NAME'",
",",
"'sm_dev'",
")",
",",
"username",
"=",
"os",
".",
"environ",
".",
"get... | Dev config for local database with name 'sm_dev | [
"Dev",
"config",
"for",
"local",
"database",
"with",
"name",
"'",
"sm_dev"
] | [
"\"\"\"Dev config for local database with name 'sm_dev'\"\"\"",
"# consider pulling from env variables"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
2943ff0974ba55fac97b4dec6c96146bb904951b | jeremiahwander/sample-metadata | db/python/connect.py | [
"MIT"
] | Python | prepare_connection_string | <not_specific> | def prepare_connection_string(
host,
database,
username,
password=None,
port=None,
# min_pool_size=5,
# max_pool_size=20,
):
"""Prepares the connection string for mysql / mariadb"""
_host = host or 'localhost'
u_p = username
i... | Prepares the connection string for mysql / mariadb | Prepares the connection string for mysql / mariadb | [
"Prepares",
"the",
"connection",
"string",
"for",
"mysql",
"/",
"mariadb"
] | def prepare_connection_string(
host,
database,
username,
password=None,
port=None,
):
_host = host or 'localhost'
u_p = username
if password:
u_p += f':{password}'
if port:
_host += f':{port}'
options = {}
... | [
"def",
"prepare_connection_string",
"(",
"host",
",",
"database",
",",
"username",
",",
"password",
"=",
"None",
",",
"port",
"=",
"None",
",",
")",
":",
"_host",
"=",
"host",
"or",
"'localhost'",
"u_p",
"=",
"username",
"if",
"password",
":",
"u_p",
"+=... | Prepares the connection string for mysql / mariadb | [
"Prepares",
"the",
"connection",
"string",
"for",
"mysql",
"/",
"mariadb"
] | [
"# min_pool_size=5,",
"# max_pool_size=20,",
"\"\"\"Prepares the connection string for mysql / mariadb\"\"\"",
"# {'min_size': min_pool_size, 'max_size': max_pool_size}"
] | [
{
"param": "host",
"type": null
},
{
"param": "database",
"type": null
},
{
"param": "username",
"type": null
},
{
"param": "password",
"type": null
},
{
"param": "port",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "host",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "database",
"type": null,
"docstring": null,
"docstring_tokens... |
2943ff0974ba55fac97b4dec6c96146bb904951b | jeremiahwander/sample-metadata | db/python/connect.py | [
"MIT"
] | Python | from_project | <not_specific> | async def from_project(cls, project, author, readonly: bool):
"""Create the Db object from a project with user details"""
return cls(
connection=await SMConnections.get_connection(
project_name=project, author=author, readonly=readonly
),
) | Create the Db object from a project with user details | Create the Db object from a project with user details | [
"Create",
"the",
"Db",
"object",
"from",
"a",
"project",
"with",
"user",
"details"
] | async def from_project(cls, project, author, readonly: bool):
return cls(
connection=await SMConnections.get_connection(
project_name=project, author=author, readonly=readonly
),
) | [
"async",
"def",
"from_project",
"(",
"cls",
",",
"project",
",",
"author",
",",
"readonly",
":",
"bool",
")",
":",
"return",
"cls",
"(",
"connection",
"=",
"await",
"SMConnections",
".",
"get_connection",
"(",
"project_name",
"=",
"project",
",",
"author",
... | Create the Db object from a project with user details | [
"Create",
"the",
"Db",
"object",
"from",
"a",
"project",
"with",
"user",
"details"
] | [
"\"\"\"Create the Db object from a project with user details\"\"\""
] | [
{
"param": "cls",
"type": null
},
{
"param": "project",
"type": null
},
{
"param": "author",
"type": null
},
{
"param": "readonly",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cls",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "project",
"type": null,
"docstring": null,
"docstring_tokens":... |
7f7cc3635b58fb4b250e32a4d3157a6ef71f3f2b | jeremiahwander/sample-metadata | api/server.py | [
"MIT"
] | Python | add_process_time_header | <not_specific> | async def add_process_time_header(request: Request, call_next):
"""Add X-Process-Time to all requests for logging"""
start_time = time.time()
response = await call_next(request)
process_time = time.time() - start_time
response.headers['X-Process-Time'] = f'{round(process_time * 1000, 1)}ms'
retu... | Add X-Process-Time to all requests for logging | Add X-Process-Time to all requests for logging | [
"Add",
"X",
"-",
"Process",
"-",
"Time",
"to",
"all",
"requests",
"for",
"logging"
] | async def add_process_time_header(request: Request, call_next):
start_time = time.time()
response = await call_next(request)
process_time = time.time() - start_time
response.headers['X-Process-Time'] = f'{round(process_time * 1000, 1)}ms'
return response | [
"async",
"def",
"add_process_time_header",
"(",
"request",
":",
"Request",
",",
"call_next",
")",
":",
"start_time",
"=",
"time",
".",
"time",
"(",
")",
"response",
"=",
"await",
"call_next",
"(",
"request",
")",
"process_time",
"=",
"time",
".",
"time",
"... | Add X-Process-Time to all requests for logging | [
"Add",
"X",
"-",
"Process",
"-",
"Time",
"to",
"all",
"requests",
"for",
"logging"
] | [
"\"\"\"Add X-Process-Time to all requests for logging\"\"\""
] | [
{
"param": "request",
"type": "Request"
},
{
"param": "call_next",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "request",
"type": "Request",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "call_next",
"type": null,
"docstring": null,
"docstri... |
75104c722f26420218a8b25b9115c94744b49837 | jeremiahwander/sample-metadata | scripts/check_md5s.py | [
"MIT"
] | Python | validate_all_objects_in_directory | null | def validate_all_objects_in_directory(gs_dir):
"""Validate files with MD5s in the provided gs directory"""
backend = hb.ServiceBackend(
billing_project=os.getenv('HAIL_BILLING_PROJECT'),
bucket=os.getenv('HAIL_BUCKET'),
)
b = hb.Batch('validate_md5s', backend=backend)
client = storag... | Validate files with MD5s in the provided gs directory | Validate files with MD5s in the provided gs directory | [
"Validate",
"files",
"with",
"MD5s",
"in",
"the",
"provided",
"gs",
"directory"
] | def validate_all_objects_in_directory(gs_dir):
backend = hb.ServiceBackend(
billing_project=os.getenv('HAIL_BILLING_PROJECT'),
bucket=os.getenv('HAIL_BUCKET'),
)
b = hb.Batch('validate_md5s', backend=backend)
client = storage.Client()
if not gs_dir.startswith('gs://'):
raise ... | [
"def",
"validate_all_objects_in_directory",
"(",
"gs_dir",
")",
":",
"backend",
"=",
"hb",
".",
"ServiceBackend",
"(",
"billing_project",
"=",
"os",
".",
"getenv",
"(",
"'HAIL_BILLING_PROJECT'",
")",
",",
"bucket",
"=",
"os",
".",
"getenv",
"(",
"'HAIL_BUCKET'",... | Validate files with MD5s in the provided gs directory | [
"Validate",
"files",
"with",
"MD5s",
"in",
"the",
"provided",
"gs",
"directory"
] | [
"\"\"\"Validate files with MD5s in the provided gs directory\"\"\""
] | [
{
"param": "gs_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "gs_dir",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
75104c722f26420218a8b25b9115c94744b49837 | jeremiahwander/sample-metadata | scripts/check_md5s.py | [
"MIT"
] | Python | validate_md5 | hb.batch.job | def validate_md5(job: hb.batch.job, file, md5_path=None) -> hb.batch.job:
"""
This quickly validates a file and it's md5
"""
# Calculate md5 checksum.
md5 = md5_path or f'{file}.md5'
job.env('GOOGLE_APPLICATION_CREDENTIALS', '/gsa-key/key.json')
job.command(
f"""\
gcloud -q auth act... |
This quickly validates a file and it's md5
| This quickly validates a file and it's md5 | [
"This",
"quickly",
"validates",
"a",
"file",
"and",
"it",
"'",
"s",
"md5"
] | def validate_md5(job: hb.batch.job, file, md5_path=None) -> hb.batch.job:
md5 = md5_path or f'{file}.md5'
job.env('GOOGLE_APPLICATION_CREDENTIALS', '/gsa-key/key.json')
job.command(
f"""\
gcloud -q auth activate-service-account --key-file=$GOOGLE_APPLICATION_CREDENTIALS
gsutil cat {file} | md5sum | ... | [
"def",
"validate_md5",
"(",
"job",
":",
"hb",
".",
"batch",
".",
"job",
",",
"file",
",",
"md5_path",
"=",
"None",
")",
"->",
"hb",
".",
"batch",
".",
"job",
":",
"md5",
"=",
"md5_path",
"or",
"f'{file}.md5'",
"job",
".",
"env",
"(",
"'GOOGLE_APPLICA... | This quickly validates a file and it's md5 | [
"This",
"quickly",
"validates",
"a",
"file",
"and",
"it",
"'",
"s",
"md5"
] | [
"\"\"\"\n This quickly validates a file and it's md5\n \"\"\"",
"# Calculate md5 checksum."
] | [
{
"param": "job",
"type": "hb.batch.job"
},
{
"param": "file",
"type": null
},
{
"param": "md5_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "job",
"type": "hb.batch.job",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "file",
"type": null,
"docstring": null,
"docstring_t... |
0c2a4e1952c3f6aa1e7d9589f736a5057a308d62 | jeremiahwander/sample-metadata | db/python/tables/sample.py | [
"MIT"
] | Python | insert_sample | int | async def insert_sample(
self,
external_id,
sample_type: SampleType,
active,
meta=None,
participant_id=None,
author=None,
project=None,
) -> int:
"""
Create a new sample, and add it to database
"""
kv_pairs = [
... |
Create a new sample, and add it to database
| Create a new sample, and add it to database | [
"Create",
"a",
"new",
"sample",
"and",
"add",
"it",
"to",
"database"
] | async def insert_sample(
self,
external_id,
sample_type: SampleType,
active,
meta=None,
participant_id=None,
author=None,
project=None,
) -> int:
kv_pairs = [
('external_id', external_id),
('participant_id', participant_... | [
"async",
"def",
"insert_sample",
"(",
"self",
",",
"external_id",
",",
"sample_type",
":",
"SampleType",
",",
"active",
",",
"meta",
"=",
"None",
",",
"participant_id",
"=",
"None",
",",
"author",
"=",
"None",
",",
"project",
"=",
"None",
",",
")",
"->",... | Create a new sample, and add it to database | [
"Create",
"a",
"new",
"sample",
"and",
"add",
"it",
"to",
"database"
] | [
"\"\"\"\n Create a new sample, and add it to database\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "external_id",
"type": null
},
{
"param": "sample_type",
"type": "SampleType"
},
{
"param": "active",
"type": null
},
{
"param": "meta",
"type": null
},
{
"param": "participant_id",
"type": null
},
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "external_id",
"type": null,
"docstring": null,
"docstring_tok... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.