Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

""" Query catsim """ 

 

def catsim_query(stack_version, **kwargs): 

 

""" Pass arguments to a function which handles  

specifics of the stack version """ 

 

if stack_version < 10: 

return catsim_query_stack8(**kwargs) 

else: 

return catsim_query_stack10(**kwargs) 

 

 

def catsim_query_stack8(objid, constraint, obs_metadata, dia): 

 

""" Query catsim and make a catalog for stack 8 

 

@param [in] objid of the catsim table 

 

@param [in] constraint is sql constraint for the catsim table 

 

@param [in] obs_metadata is the metadata for the visit 

 

@param [in] dia is boolean which determines the catalog class  

i.e if full diasource will be emitted 

""" 

 

from lsst.sims.catalogs.generation.db import DBObject 

 

dbobj = DBObject.from_objid(objid) 

 

if dia: 

catalog = 'variable_stars_dia' 

else: catalog = 'variable_stars' 

 

obs_data = dbobj.getCatalog(catalog, 

obs_metadata=obs_metadata, 

constraint=constraint) 

 

# filename = 'test_reference.dat' 

# t.write_catalog(filename, chunk_size=10) 

return obs_data 

 

 

def catsim_query_stack10 (objid, constraint, obs_metadata, dia): 

 

""" Query catsim and make a catalog for stack 10+  

 

@param [in] objid of the catsim table 

 

@param [in] constraint is sql constraint for the catsim table 

 

@param [in] obs_metadata is the metadata for the visit 

 

@param [in] dia is boolean which determines the catalog class  

i.e if full diasource will be emitted 

 

""" 

 

from lsst.sims.catalogs.db import CatalogDBObject 

 

dbobj = CatalogDBObject.from_objid(objid) 

 

if dia: 

catalog = 'variable_stars_dia' 

else: catalog = 'variable_stars' 

 

obs_data = dbobj.getCatalog(catalog, 

obs_metadata=obs_metadata, constraint=constraint) 

#column_outputs=VariableStars.get_column_outputs(obs_metadata.bandpass))  

 

# dbobj.show_db_columns()  

# dbobj.show_mapped_columns() 

# filename = 'test_reference.dat' 

# t.write_catalog(filename, chunk_size=10) 

return obs_data