FieldSelection

class lsst.sims.survey.fields.FieldSelection[source]

Bases: object

Class for constructing SQL queries on the survey fields database.

This class is for creating SQL queries to perform on the survey fields database. It does not actually perform the queries.

Methods Summary

base_select() Return the base field query.
combine_queries(*queries, **kwargs) Combine a set of queries.
finish_query(query) Put a semicolon at the end of a query.
galactic_region(maxB, minB, endL[, exclusion]) Create a galactic region.
get_all_fields() Return query for all fields.
select_region(region_type, start_value, ...) Create a simple bounded region.
select_user_regions(id_list) Create a query for a list of fields.of

Methods Documentation

base_select()[source]

Return the base field query.

Returns:str
combine_queries(*queries, **kwargs)[source]

Combine a set of queries.

Parameters:

queries : str instances

A set of queries to join via the given operators.

combiners : tuple of str

A set of logical operations (and, or etc.) to join the queries with. Defaults is an empty tuple. NOTE: A tuple with one logical operator must look like (‘and’,).

order_by : str, optional

Set the order by clause. Default is fieldId.

Returns:

str:

The fully combined query.

finish_query(query)[source]

Put a semicolon at the end of a query.

Parameters:

query : str

The SQL query to finish.

Returns:

str

The finished SQl query.

galactic_region(maxB, minB, endL, exclusion=False)[source]

Create a galactic region.

This function creates a sloping region around the galactic plane to either include or exclude fields.

Parameters:

maxB : float

The maximum galactic latitude at the galactic longitude of zero.

minB : float

The minimum galactic latitude at the galactic longitude of endL.

endL : float

The galactic longitude for the end of the envelope region.

exclusion : bool, optional

Flag to construct the query as an exclusion. Default is False.

Returns:

str

The appropriate query.

get_all_fields()[source]

Return query for all fields.

Returns:

str

The query for all the fields.

select_region(region_type, start_value, end_value)[source]

Create a simple bounded region.

This function creates a bounded cut query based on the input values as bounds for a given region. If start_value < end_value, the cut looks like [start_value, end_value]. If start_value > end_value, the bounded cut is or’d between the following cuts: [start_value, 360] and [0, end_value].

Parameters:

region_type : str

The name of the region to cut on.

start_value : float

The starting value (degrees) of the cut region.

end_value : float

The ending value (degrees) of the cut region.

Returns:

str

The appropriate query.

select_user_regions(id_list)[source]

Create a query for a list of fields.of

This function creates a query focusing on field Ids. It is recommended not to use this with more than a dozen Ids.

Parameters:

id_list : list[int]

A set of field Ids to construct a query for.query

Returns:

str

The appropriate query.