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

import numpy as np 

"""Some simple functions that are useful for astrometry calculations. """ 

 

__all__ = ['sigma_slope', 'm52snr', 'astrom_precision'] 

 

def sigma_slope(x, sigma_y): 

""" 

Calculate the uncertainty in fitting a line, as 

given by the spread in x values and the uncertainties 

in the y values. 

 

Parameters 

---------- 

x : numpy.ndarray 

The x values of the data 

sigma_y : numpy.ndarray 

The uncertainty in the y values 

 

Returns 

------- 

float 

The uncertainty in the line fit 

""" 

w = 1./sigma_y**2 

denom = np.sum(w)*np.sum(w*x**2)-np.sum(w*x)**2 

if denom <= 0: 

return np.nan 

else: 

result = np.sqrt(np.sum(w)/denom ) 

return result 

 

def m52snr(m, m5): 

""" 

Calculate the SNR for a star of magnitude m in an 

observation with 5-sigma limiting magnitude depth m5. 

Assumes gaussian distribution of photons and might not be 

strictly due in bluer filters. See table 2 and equation 5 

in astroph/0805.2366. 

 

Parameters 

---------- 

m : float or numpy.ndarray 

The magnitude of the star 

m5 : float or numpy.ndarray 

The m5 limiting magnitude of the observation 

 

Returns 

------- 

float or numpy.ndarray 

The SNR 

""" 

snr = 5.*10.**(-0.4*(m-m5)) 

return snr 

 

def astrom_precision(fwhm, snr): 

""" 

Calculate the approximate precision of astrometric measurements, 

given a particular seeing and SNR value. 

 

Parameters 

---------- 

fwhm : float or numpy.ndarray 

The seeing (FWHMgeom) of the observation. 

snr : float or numpy.ndarray 

The SNR of the object. 

 

Returns 

------- 

float or numpy.ndarray 

The astrometric precision. 

""" 

result = fwhm/(snr) 

return result