Attachment 'NIKA2_Time_Estimator_2024.py'

Download

   1 #!/usr/bin/env python
   2 ##############################################################################################
   3 ### Created by: P. Garcia                                                                  ###
   4 ### Revised by: A. Ritacco                                                                 ###
   5 ### Revised by: B. Ladjelate                                                               ###
   6 ### Revised by: A. Bongiovanni                                                             ###
   7 ### Revised by: I. Myserlis                                                                ###
   8 ### Title: NIKA2_Time_Estimator.py                                                         ###
   9 ### Purpose: Calculation of the total integration time for observing proposals             ###
  10 ### Creation Date: 2016.JULY.28                                                            ###
  11 ### Date of last revision: 2024.FEB.26                                                     ###
  12 ### Revision history:                                                                      ###
  13 ###   - 2016.JULY.29: comments from C. Kramer & A. Sievers implemented                     ###
  14 ###   - 2016.AUG.03 : changed formula to N. Billot expression                              ###
  15 ###   - 2017.JAN.29 : - fpix set to 0.75 (commisi. results)                                ###
  16 ###                   - NEFD0 @ 2 mm set to 15 mJy/sqrt(hz) (commisi. results)             ###
  17 ###                   - overhead set as used defined parameter between 1.5 - 2.0           ###
  18 ###   - 2017.JULY.28: - According to the NIKA2 technical paper submitted on July, 3rd 2017 ###
  19 ###                   - fpix @1mm, 2mm set to 0.84 and 0.90, respectively                  ###
  20 ###                   - NEFD0 @1mm, 2mm set to 20 and 6 mJy/sqrt(hz), respectively         ###
  21 ###                   - FWHM set to 11.2 @1mm and 17.7 @2mm                                ###
  22 ###   - 2017.SEPT.28  - An error in the data software led sensitivities too optimistics    ###
  23 ###                   - NEFD0 @1mm, 2mm set to 40 and 10 mJy/sqrt(hz), respectively        ###
  24 ###   - 2018.JAN.20:  - NEFD0 @1mm, 2mm set to 33 and 8 mJy/sqrt(hz), respectively         ###
  25 ###   - 2019.FEB.18:  - Corrected a mistake in the calculation of the mapping speed        ###
  26 ###   - 2020.JUL.22:  - Implemented a warning regarding the scan size                      ###
  27 ###   - 2023.JUL.28:  - NEFDs and valid pixels updated; some warnings added                ###
  28 ###   - 2024.JAN.29:  - NEFDs  in pol-Q and U added; results table improved                ###
  29 ###   - 2024.FEB.26:  - Mapping speed in polarization mode and scanning speed limit        ###
  30 ##############################################################################################
  31 import numpy as np, sys
  32 import math
  33 import sys
  34 import os
  35 os.system("rm -f *.py~")
  36 
  37 #version = 'v 2017.JAN.29'
  38 #version = 'v 2017.JULY.28'
  39 #version = 'v 2017.SEPT.28'
  40 #version = 'v 2018.JAN.20'
  41 #version = 'v 2019.FEB.18'
  42 #version = 'v 2020.JUL.22'
  43 #version = 'v 2023.JUL.28'
  44 #version = 'v 2024.JAN.29'
  45 version = 'v 2024.FEB.26'
  46 
  47 
  48 class bcolors:
  49     HEADER = '\033[95m'
  50     OKBLUE = '\033[94m'
  51     OKGREEN = '\033[92m'
  52     WARNING = '\033[93m'
  53     FAIL = '\033[91m'
  54     ENDC = '\033[0m'
  55     BOLD = '\033[1m'
  56     UNDERLINE = '\033[4m'
  57 
  58 print ''
  59 print bcolors.UNDERLINE + bcolors.HEADER + bcolors.BOLD + 'NIKA2 time estimator '+version+' '+bcolors.ENDC
  60 print ''
  61 print bcolors.HEADER + bcolors.BOLD  + 'To optimize the correction of data instabilities, the size of scans along'
  62 print bcolors.HEADER + bcolors.BOLD  + 'the scan direction must be at least:'
  63 print bcolors.HEADER + bcolors.BOLD  + 'NIKA2 FOV (6.5 arcminutes) + 2 * NIKA2 beam width (12 arcseconds at 1mm,'
  64 print bcolors.HEADER + bcolors.BOLD  + '18 arcseconds at 2mm) + source size above the noise + 2s * scan speed'
  65 print ''
  66 print bcolors.HEADER + bcolors.BOLD  +  bcolors.UNDERLINE + 'Please check your source size and your scanning speed to evaluate the'
  67 print bcolors.HEADER + bcolors.BOLD  +  bcolors.UNDERLINE + 'correct map size fitting your needs, as well as the pwv [mm] adopted.'
  68 print bcolors.HEADER + bcolors.BOLD  +  bcolors.UNDERLINE + 'In the case of polarization observations note that the scanning speed.'
  69 print bcolors.HEADER + bcolors.BOLD  +  bcolors.UNDERLINE + 'should be constrained within ~ 35-40 arcsec/s.' + bcolors.ENDC
  70 print ''
  71 print bcolors.HEADER + bcolors.BOLD + 'See the "Guidelines for observing time estimates with the NIKA2 continuum camera' + bcolors.ENDC
  72 print bcolors.HEADER + bcolors.BOLD + 'at the IRAM-30m Telescope" for details on used parameters and calculations.\n' + bcolors.ENDC
  73 print ''
  74 
  75 raw_input('Press Enter to continue with the options given...')
  76 print ''
  77 
  78 #user_input = ''
  79 
  80 #while True:
  81 #    user_input = raw_input('It is assumed that the scan size along the scan direction and the pwv are rightly set. Do you want to continue? (yes/no): ')
  82 #
  83 #    if user_input.lower() == 'yes':
  84 #        break
  85 #    elif user_input.lower() == 'no':
  86 #        print bcolors.HEADER + bcolors.BOLD + 'See the "Guidelines for observing time estimates with the NIKA2 continuum camera' + bcolors.ENDC
  87 #        print bcolors.HEADER + bcolors.BOLD + 'at the IRAM-30m Telescope" for details on used parameters and calculations.\n' + bcolors.ENDC
  88 #        exit()
  89 #    else:
  90 #        print 'Type yes/no'
  91 
  92 ################################
  93 ##### CONVERSION FACTORS #######
  94 ################################
  95 
  96 ##########  K_cmb ############
  97 def b_v_cmb(freq,tcmb):
  98     h    = 6.626070040*10**(-34) # (J.s) Planck constant
  99     k    = 1.38064852*10**(-23)  # (J/K) Boltzmann constant
 100     c    = 299792458             # (m/s^2) light speed
 101     freq = freq*10**9            # Hz    
 102     bv = 1.0/(((2*h*freq**3)/((c**2)*(np.e**((h*freq)/(k*tcmb)) - 1)))*(np.e**((h*freq)/(k*tcmb))/(np.e**((h*freq)/(k*tcmb)) - 1))*(h*freq/(k*tcmb**2))) / 10**20
 103     return bv
 104 
 105 ##########  Ysz ##############
 106 def y_sz(freq,tcmb):
 107     h    = 6.626070040*10**(-34) # (J.s) Planck constant
 108     k    = 1.38064852*10**(-23)  # (J/K) Boltzmann constant
 109     c    = 299792458             # (m/s^2) light speed
 110     freq = freq*10**9            # Hz    
 111     Ysz  = 1.0
 112     bv   = 1.0/(((2*h*freq**3)/((c**2)*(np.e**((h*freq)/(k*tcmb)) - 1)))*(np.e**((h*freq)/(k*tcmb))/(np.e**((h*freq)/(k*tcmb)) - 1))*(h*freq/(k*tcmb**2)))
 113     bv   = 1.0/bv
 114     y_sz = (bv*tcmb)*(((h*freq/(k*tcmb))*((np.e**((h*freq)/(k*tcmb)) + 1)/(np.e**((h*freq)/(k*tcmb)) -1))) -4)*Ysz /10**(-20)
 115     y_sz = 1.0/y_sz
 116     return y_sz
 117 
 118 #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 119 #%%%%%%%%%%%%%%%%%%%%% FIXED GENERAL PARAMETERS %%%%%%%%%%%%%%%%%%%%%%  
 120 #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 121 
 122 ################################################
 123 ##### BEAM SIZES AND CONVERSION TO RADIANS #####
 124 ################################################
 125 res_band1_spec        = 11.1  # From NIKA2 reference paper: Perotto et al. A&A 637, A71 (2020) # [arcsec]
 126 res_band2_spec        = 17.6  # From NIKA2 reference paper: Perotto et al. A&A 637, A71 (2020) # [arcsec]
 127 teta_band1_spec       = res_band1_spec*math.pi/180.0/3600.0 # in sr units 
 128 teta_band2_spec       = res_band2_spec*math.pi/180.0/3600.0 # in sr units 
 129 area_teta_band1_spec  = ((teta_band1_spec/2.0)**2)*math.pi  # in sr units 
 130 area_teta_band2_spec  = ((teta_band2_spec/2.0)**2)*math.pi  # in sr units 
 131 ############################
 132 ##### OTHER PARAMETERS #####
 133 ############################
 134 fpix_spec_1mm         = 0.86    # Changed in 2023 Jul. 31; based on PIIC calibration data
 135 fpix_spec_2mm         = 0.83    # Changed in 2023 Jul. 31; id.
 136 #
 137 bv_1                  = 0.075   # band1, do not change
 138 cv_1                  = 0.001   # band1, do not change
 139 bv_2                  = 0.025   # band2, do not change
 140 cv_2                  = 0.001   # band2, do not change
 141 tiempo                = 1.0     # [hours]
 142 FoV                   = 6.5     # [arcmin] diameter
 143 FoVArea               = ((FoV/2.0)**2)*math.pi # [arcmin^2]
 144 narrays1              = 2
 145 narrays2              = 1
 146 verbose_flag          = 0
 147 #foverhead             = 2.0 # value fixed for all proposals in 2016
 148 ##########################################
 149 ##### NEFD_0 VALUES FROM OBSERVATIONS #####
 150 ##########################################
 151 NEFD_band1_spec       = 30. # Changed in 2023 Jul. 31; NIKA2 reference paper: Perotto et al. A&A 637, A71 (2020) # [mJy sqrt(s)]
 152 NEFD_band1_spec_pol   = 20. # Ajeddig et al. (2024) NIKA2-Pol: summary of polarization commissioning report (2024) # [mJy sqrt(s)]
 153 NEFD_band2_spec       = 9.  # Changed in 2023 Jul. 31; id.
 154 #######################################
 155 ##### SAMPLING ANGULAR VELOCITIES #####
 156 #######################################
 157 sampl_vel_fast = 48.0    # [arcsec/second] 
 158 sampl_vel_mid  = 24.0    # [arcsec/second] 
 159 sampl_vel_slow = 12.0    # [arcsec/second] 
 160 sampl_rate     = 23.84   # [hz]
 161 sampl_rate_pol = 2*23.84 # [hz]
 162 slewing_loss   = 1.0     # to account for slewing of single OTF line
 163 ##########################################
 164 ##########################################
 165 ##########################################
 166 
 167 rango = len(sys.argv)
 168 for i in range(rango):
 169 
 170     if sys.argv[i] == ("--help") or rango == 1:
 171         print ''
 172         print 'USAGE:\n'
 173         print '  python NIKA2_Time_Estimator_2024.py --help '
 174         print '  python NIKA2_Time_Estimator_2024.py --band 1 --rms 2.00 --pwv 2 --elevation 40 --Xsize 6.5 --Ysize 6.5 --filter 1.0 --overhead 1.5'
 175         print '  python NIKA2_Time_Estimator_2024.py --band 2 --rms 1.00 --pwv 4 --elevation 50 --Xsize 15  --Ysize 15  --filter 2.0 --overhead 2.0 --verbose '
 176         print '\n'
 177         print 'OPTIONS:\n'
 178         print '         help =>  This help.'
 179         print '         band =>  Set 1 or 2 for the 1 mm or the 2 mm bands, respectively.'
 180         print '          rms =>  Wanted flux density per beam. Any value above the confusion limit in [mJy/beam].'
 181         print '          pwv =>  Precipitable water vapor in [mm].'
 182         print '    elevation =>  Values from 15 to < 83 [deg].'
 183         print '  Xsize Ysize =>  Map lengths. Xsize and Ysize are in [arcmin]. Minimum map size is 6.5x6.5 [arcmin^2] for homogeneous RMS noise distribution.'
 184         print '       filter =>  Factor for post-processing noise filtering. Values from 1.0 (point-like source) to 2.0 (extended bright emission).'
 185         print '     overhead =>  Factor for telescope overheads between 1.5 and 2.0 (slewing, pointing, focusing, calibration), i.e. all telescope time which is not spend integrating on-source.'
 186         print '      verbose =>  Set to get list of parameters used in the calculations, RMS noise unit conversion, and allowed OTF scan speeds.\n'
 187         print ''
 188         sys.exit()
 189 
 190     if sys.argv[i] == ("--band"):
 191         band  = int(sys.argv[i+1]) 
 192         if band == 1:
 193             narrays = narrays1
 194             mili    = 1.2
 195         if band == 2:
 196             narrays = narrays2
 197             mili    = 2.0
 198         if band < 1 or band > 2:
 199             print '    %%%%%%%%%%%%%%%%%%%%%%%'
 200             print bcolors.BOLD +  bcolors.FAIL +'    Band %2i is not defined.' % (band) + bcolors.ENDC
 201             print '    %%%%%%%%%%%%%%%%%%%%%%%'
 202             print ''
 203             sys.exit()
 204 
 205     if sys.argv[i] == ("--rms"):
 206         rms = float(sys.argv[i+1])
 207 
 208     if sys.argv[i] == ("--pwv"):
 209         pwv = float(sys.argv[i+1])
 210 
 211     if sys.argv[i] == ("--elevation"):
 212         elevation = float(sys.argv[i+1])
 213         if elevation < 15 or elevation > 83:
 214             print '    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'
 215             print bcolors.BOLD +  bcolors.FAIL +'    Elevation %3i [degrees] is outside the telescope`s limits: 15 - 83 [degrees].' % (elevation) + bcolors.ENDC
 216             print '    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'
 217             print ''
 218             sys.exit()
 219 
 220     if sys.argv[i] == ("--Xsize"):
 221         dx = float(sys.argv[i+1])
 222 
 223     if sys.argv[i] == ("--Ysize"):
 224         dy = float(sys.argv[i+1])
 225 
 226     if sys.argv[i] == ("--filter"):
 227         filtering = float(sys.argv[i+1])
 228         if filtering < 1 or filtering > 2:
 229             print '    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'
 230             print bcolors.BOLD +  bcolors.FAIL +'    Filter value %2.1f is outside the standard limits: 1.0 - 2.0' % (filtering) + bcolors.ENDC
 231             print '    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'
 232             print ''
 233             sys.exit()
 234 
 235     if sys.argv[i] == ("--overhead"):
 236         foverhead = float(sys.argv[i+1])
 237         if foverhead < 1.5 or foverhead > 2:
 238             print '    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'
 239             print bcolors.BOLD +  bcolors.FAIL +'    Overhead value %2.1f is outside the standard limits: 1.5 - 2.0' % (foverhead) + bcolors.ENDC
 240             print '    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'
 241             print ''
 242             sys.exit()
 243 
 244     if sys.argv[i] == ("--verbose"):
 245         verbose_flag = 1
 246 
 247 area_obs        = dx*dy
 248 
 249 if area_obs < 4.0:
 250     print '    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'
 251     print bcolors.BOLD +  bcolors.FAIL +'    Introduced map size is %3.1f [arcmin^2]. Minimum value is 4.0 [arcmin^2]' % (area_obs) + bcolors.ENDC
 252     print '    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'
 253     print ''
 254     sys.exit()
 255 
 256 ###############################################################################################
 257 ### SIGMA ESTIMATION CALCULATION, EFFECTIVE NEFD FROM PWV GIVEN VALUES AND UNITS CONVERSION ###
 258 ###############################################################################################
 259         
 260 if band == 1: 
 261     tau = bv_1*pwv + cv_1
 262     NEFD_spec_eff      = NEFD_band1_spec*(np.e**(tau/np.sin(elevation*math.pi/180.)))
 263     NEFD_spec_eff_pol  = NEFD_band1_spec_pol*(np.e**(tau/np.sin(elevation*math.pi/180.)))
 264     rms_point_MJy_spec = rms/area_teta_band1_spec/10**9
 265     rms_point_cmb_spec = rms_point_MJy_spec*b_v_cmb(260,2.726)*10**6
 266     rms_point_ys_spec  = rms_point_MJy_spec*y_sz(260,2.726)*10**6
 267     rms_point_ys_spec  = np.abs(rms_point_ys_spec)
 268     #########################################
 269     ### ratio of areas with fraction of valid pixel in the 2mm band ###       
 270     #########################################
 271     factor_area_spec   = (1+(area_obs/(FoVArea*fpix_spec_1mm))) # from N. Billot Doc.
 272     ##########################################################
 273     ### Integration Time calculations for given conditions ###
 274     ##########################################################
 275     t_spec     = ((NEFD_spec_eff*filtering/rms)**2)*factor_area_spec*(foverhead)/3600.0 #hours
 276     t_spec_pol     = ((NEFD_spec_eff_pol*filtering/rms)**2)*factor_area_spec*(foverhead)/3600.0 #hours
 277     s_map_spec = ((FoVArea*fpix_spec_1mm)/(((NEFD_spec_eff*filtering)**2)*foverhead))*3600.0            # arcmin^2 / hour^-1/ mJy^-2 
 278     s_map_spec_pol = ((FoVArea*fpix_spec_1mm)/(((NEFD_spec_eff_pol*filtering)**2)*foverhead))*3600.0            # arcmin^2 / hour^-1/ mJy^-2 
 279 
 280 if band == 2:
 281     tau = bv_2*pwv + cv_2
 282     NEFD_spec_eff      = NEFD_band2_spec*(np.e**(tau/np.sin(elevation*math.pi/180.)))
 283     rms_point_MJy_spec = rms/area_teta_band2_spec/10**9
 284     rms_point_cmb_spec = rms_point_MJy_spec*b_v_cmb(150,2.726)*10**6   
 285     rms_point_ys_spec  = rms_point_MJy_spec*y_sz(150,2.726)*10**6     
 286     rms_point_ys_spec  = np.abs(rms_point_ys_spec)
 287     #########################################
 288     ### ratio of areas with fraction of valid pixel in the 2mm band ###       
 289     #########################################
 290     factor_area_spec   = (1+(area_obs/(FoVArea*fpix_spec_2mm))) # from N. Billot Doc.
 291     ##########################################################
 292     ### Integration Time calculations for given conditions ###
 293     ##########################################################
 294     t_spec     = ((NEFD_spec_eff*filtering/rms)**2)*factor_area_spec*(foverhead)/3600.0 #hours
 295     s_map_spec = ((FoVArea*fpix_spec_2mm)/(((NEFD_spec_eff*filtering)**2)*foverhead))*3600.0            # arcmin^2 / hour^-1/ mJy^-2 
 296 
 297 #########################################
 298 #### TIME PER OTF LINE TO REACH TOTAL ###
 299 #########################################
 300 
 301 T_SLOW = slewing_loss*((dx*60.0)/sampl_vel_slow)/60.0  # [minutes] 
 302 T_MID  = slewing_loss*((dx*60.0)/sampl_vel_mid)/60.0   # [minutes] 
 303 T_FAST = slewing_loss*((dx*60.0)/sampl_vel_fast)/60.0  # [minutes] 
 304 
 305 if verbose_flag == 1:
 306 
 307     print ''
 308     print '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'
 309     print '%%%%%%%%%% General Parameters Used for the Calculations %%%%%%%%%%%'
 310     print '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'
 311     print ''
 312     print '------------------------------------------------------------------------'
 313     print '|      Parameters      |    Band 1 (1.2 mm)    |    Band 2 (2.0 mm)    |'
 314     print '------------------------------------------------------------------------'
 315     print '|      opacity         |  %6.3f*pwv + %6.3f  |  %6.3f*pwv + %6.3f  |' % (bv_1,cv_1,bv_2,cv_2)
 316     print '------------------------------------------------------------------------'
 317     print '| HPBW [arcsec]        |       %6.1f          |       %6.1f          |' % (res_band1_spec,res_band2_spec)
 318     print '------------------------------------------------------------------------'
 319     print '| NEFDo [mJy.s^0.5]    | %4.1f (%4.1f, pol-Q&U)  |        %5.1f          |' % (NEFD_band1_spec,NEFD_band1_spec_pol,NEFD_band2_spec) 
 320     print '------------------------------------------------------------------------'
 321     print '| fpix                 |       %6.2f          |       %6.2f          |' % (fpix_spec_1mm, fpix_spec_2mm)
 322     print '------------------------------------------------------------------------'
 323     if band  == 1:
 324         print '| rms [mJy/beam]       |       %6.2f          |                       |' % (rms)
 325     if band  == 2:
 326         print '| rms [mJy/beam]       |                       |       %6.2f          |' % (rms)
 327     print '------------------------------------------------------------------------'
 328     print '| FoV [arcmin]         |                   %6.1f                      |' % (FoV) 
 329     print '------------------------------------------------------------------------'
 330     print '| h-filtering          |                   %6.2f                      |' % (filtering) 
 331     print '------------------------------------------------------------------------'
 332     print '| h-overhead           |                   %6.2f                      |' % (foverhead) 
 333     print '------------------------------------------------------------------------'
 334     print '| OTF slow [arcsec/s]  |                    %4i                       |' % (sampl_vel_slow)
 335     print '------------------------------------------------------------------------'
 336     print '| OTF mid  [arcsec/s]  |                    %4i                       |' % (sampl_vel_mid)
 337     print '------------------------------------------------------------------------'
 338     print '| OTF fast [arcsec/s]  |                    %4i                       |' % (sampl_vel_fast)
 339     print '------------------------------------------------------------------------'
 340     print '| Dump [hz]            |                   %6.2f                      |' % (sampl_rate)
 341     print '------------------------------------------------------------------------'
 342     print '| Dump POL [hz]        |                   %6.2f                      |' % (sampl_rate_pol)
 343     print '------------------------------------------------------------------------'
 344     print ''
 345 
 346     print '     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'
 347     print '     %%%%%%%%%%%%%%%%%   Units Conversion   %%%%%%%%%%%%%%%%%'
 348     print '     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'
 349     print ''    
 350     print '     --------------------------------------------------------'
 351     print '     |         (User Defined)             |    Band %1i       |' % (band)
 352     print '     --------------------------------------------------------'
 353     print '     |rms [mJy/beam]                      |  %8.2f       |' % (rms) 
 354     print '     --------------------------------------------------------'
 355     print '     |rms point-like source [MJy/sr]      |     %6.2f      |'  % (rms_point_MJy_spec) 
 356     print '     |rms point-like source [K_CMB]x10^-6 |     %5i       |'  % (rms_point_cmb_spec) 
 357     print '     |*rms point.like source [Ysz]x10^-6  |     %5i       |'  % (rms_point_ys_spec) 
 358     print '     --------------------------------------------------------'
 359     print '     |* for Ysz = 1.0                                       |'
 360     print '     --------------------------------------------------------'
 361     print ''
 362 
 363 
 364 #############################
 365 #### TABLE FINAL RESULTS ####
 366 #############################
 367         
 368 print '     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'    
 369 print '     %%%%%%%%%%%%%%%%%%%%%%   Results  %%%%%%%%%%%%%%%%%%%%%%'    
 370 print '     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'    
 371 print ''    
 372 print '     for: El = %2i (deg), PWV = %1i (mm), tau = %4.2f, rms = %6.2f'  %  (elevation,pwv,tau,rms) 
 373 print '     Area = %4.1f (arcmin^2), Filter = %4.1f, Overhead = %4.1f'  %  (area_obs,filtering,foverhead) 
 374 print '  ==============================================================='
 375 print '  |    (User Defined)      |                          |         |'
 376 print '  ---------------------------------------------------------------'
 377 print '  | Band                   |                          |    %1i    |'  % (band) 
 378 print '  ==============================================================='
 379 if band  == 1:
 380     print '  | In case of total intensity :                                |'
 381     print '  ---------------------------------------------------------------'
 382     print '  | Total Integration Time at 1mm |      [hours]      | %6.1f  |'  % (t_spec)
 383     print '  ---------------------------------------------------------------'
 384     print '  | Mapping speed          | [arcmin^-2/hour/mJy^-2 ] | %6.1f  |'  % (s_map_spec) 
 385     print '  ==============================================================='
 386     print '  | In case of polarimetry :                                    |'
 387     print '  ---------------------------------------------------------------'
 388     print '  | Total Integration Time at 1mm |      [hours]      | %6.1f  |'  % (t_spec_pol)
 389     print '  ---------------------------------------------------------------'
 390     print '  | Mapping speed          | [arcmin^-2/hour/mJy^-2 ] | %6.1f  |'  % (s_map_spec_pol) 
 391 if band  == 2:
 392     print '  | Total Integration Time at 2mm |      [hours]      | %6.1f  |'  % (t_spec)
 393     print '  ---------------------------------------------------------------'
 394     print '  | Mapping speed          | [arcmin^-2/hour/mJy^-2 ] | %6.1f  |'  % (s_map_spec) 
 395 print '  ---------------------------------------------------------------'
 396 print ' '
 397 
 398 if verbose_flag == 1:
 399 
 400     print bcolors.WARNING + '  WARNING 1: For proposed maps taking longer than 40 minutes, the total' 
 401     print bcolors.WARNING + '  integration time should be split into several maps.\n' + bcolors.ENDC
 402     print ' '
 403     print bcolors.WARNING + '  WARNING 2: Note that the confusion noise is not included in this Time' 
 404     print bcolors.WARNING + '  Estimator and it should be discussed in the proposal whether appro-'
 405     print bcolors.WARNING + '  priate. The RMS noise does not decrease indefinitely with integra- '
 406     print bcolors.WARNING + '  tion time but stops at the confusion limit caused by unresolved sour-'
 407     print bcolors.WARNING + '  ces within the beam. The exact threshold at which the RMS noise    '
 408     print bcolors.WARNING + '  reaches the confusion limit will vary with wavelength, beam size,  '
 409     print bcolors.WARNING + '  and the type of astronomical source (Galactic or Extra-Galactic). For' 
 410     print bcolors.WARNING + '  instance, for the GOODS-N field (part of the N2CLS GT Proposal), a' 
 411     print bcolors.WARNING + '  1 sigma confusion limit around ~ 0.136 mJy and ~ 0.046 mJy at 1.2 mm' 
 412     print bcolors.WARNING + '  and 2.0 mm, respectively, has been estimated (from Bing, L., A&A,'
 413     print bcolors.WARNING + '  677, A66, 2023).\n' + bcolors.ENDC
 414 
 415     print ' '
 416     print '             Time per OTF line for allowed scanning speeds   '
 417     print '        -----------------------------------------------------'
 418     print '        |          | OTF Scan Velocity  | TIME PER OTF LINE |'
 419     print '        -----------------------------------------------------'
 420     print '        |          |     [arcsec/s]     |    [minutes]      |'
 421     print '        -----------------------------------------------------'
 422     print '        | OTF-SLOW |       %6.1f       |     %6.2f        |' % (sampl_vel_slow,T_SLOW)
 423     print '        | OTF-MID  |       %6.1f       |     %6.2f        |' % (sampl_vel_mid,T_MID)
 424     print '        | OTF-FAST |       %6.1f       |     %6.2f        |' % (sampl_vel_fast,T_FAST)
 425     print '        -----------------------------------------------------'
 426     print ' '
 427 
 428 ###############################
 429 #### CONVERSION TO MINUTES ####
 430 ###############################
 431 
 432 if t_spec >= 1.:
 433    time_str_spec=str(round(t_spec,1))+' hours'
 434 
 435 if t_spec < 1. and t_spec >= 1./60.:
 436    time_str_spec=str(round(t_spec*60,1))+' minutes'
 437 
 438 if t_spec < 1./60. and t_spec >= 0.1/3600.:
 439    time_str_spec=str(int(t_spec*3600))+' seconds'
 440 
 441 if t_spec < 0.1/3600.:
 442    time_str_spec='0.1 (seconds)'
 443 
 444 if band == 1:
 445    if t_spec_pol >= 1.:
 446       time_str_spec_pol=str(round(t_spec_pol,1))+' hours'
 447 
 448    if t_spec_pol < 1. and t_spec >= 1./60.:
 449       time_str_spec_pol=str(round(t_spec_pol*60,1))+' minutes'
 450 
 451    if t_spec_pol < 1./60. and t_spec >= 0.1/3600.:
 452       time_str_spec_pol=str(int(t_spec_pol*3600))+' seconds'
 453 
 454    if t_spec_pol < 0.1/3600.:
 455       time_str_spec_pol='0.1 (seconds)'
 456 
 457 
 458 slew_overhe = str(int((slewing_loss-1.0)*100.0))
 459 
 460 ##############################
 461 #### OUTPUT FINAL RESULTS ####
 462 ##############################
 463     
 464 print ''
 465 print bcolors.HEADER  
 466 print '***  Total Integration Time (total intensity) => ' + time_str_spec + '   ***'
 467 print ''
 468 print ''
 469 
 470 print bcolors.HEADER +  bcolors.UNDERLINE + 'Please include the following text into your proposal:\n' + bcolors.ENDC
 471 
 472 if band == 1:
 473     print 'According to the NIKA2 time estimator (2024), the total observing time on total intensity using the NIKA2 '+str(band)+' mm band to map a region of '+str(round(area_obs,1))+' [arcmin^2] to reach an rms of '+str(rms)+' [mJy/beam], assuming '+str(pwv)+' [mm] pwv, '+str(elevation)+' [deg] elevation, Filter = '+str(filtering)+', Overhead = '+str(foverhead)+', was estimated to be *'+time_str_spec+'*, using the time estimator '+version+'.\n'
 474     print ''
 475     print bcolors.HEADER +  bcolors.UNDERLINE + 'In case of polarimetry observations, add the following sentence:\n' + bcolors.ENDC
 476     print 'To reach such rms in Stokes Q and U (polarimetry mode), the total observing time under the assumptions above was estimated to be *'+time_str_spec_pol+'*. The corresponding mapping speed in polarimetry mode is'+' %.1f ' %(s_map_spec_pol)+'[arcmin^-2/hour/mJy^-2 ].\n'
 477     
 478 if band == 2:
 479     print 'According to the NIKA2 time estimator (2024), the total observing time on total intensity using the NIKA2 '+str(band)+' mm band to map a region of '+str(round(area_obs,1))+' [arcmin^2] to reach an rms of '+str(rms)+' [mJy/beam], assuming '+str(pwv)+' [mm] pwv, '+str(elevation)+' [deg] elevation, Filter = '+str(filtering)+', Overhead = '+str(foverhead)+', was estimated to be *'+time_str_spec+'*, using the time estimator '+version+'.\n'

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2023-07-31 15:30:32, 24.3 KB) [[attachment:NIKA2_Time_Estimator_2023.py]]
  • [get | view] (2024-03-02 11:27:59, 27.2 KB) [[attachment:NIKA2_Time_Estimator_2024.py]]
  • [get | view] (2024-03-08 11:28:04, 27.3 KB) [[attachment:NIKA2_Time_Estimator_2024.py3]]
  • [get | view] (2023-07-31 15:30:14, 268.4 KB) [[attachment:NIKA2_Time_Estimator_Guideline_2023.pdf]]
  • [get | view] (2024-03-02 11:28:10, 253.9 KB) [[attachment:NIKA2_Time_Estimator_Guideline_2024.pdf]]
  • [get | view] (2024-03-08 11:37:22, 256.8 KB) [[attachment:NIKA2_Time_Estimator_Guideline_2024_v2.pdf]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.