Functions | Variables
moon_position_table_new3 Namespace Reference

Functions

def SetupAnalysisRegion (AnalysisRegions)
 
def AnalRegion (a, theta)
 
def FillAnal (a, region, time, resolution)
 
def tl (date)
 
def computeDayBoundaryMoon (AnalysisRegions, day, theta, resolution)
 

Variables

 f = TFile('semfe_tmp.root','RECREATE')
 
 ntp_tr = TTree('ntp','My test tree')
 
 s = MyStruct()
 
string version = "1.0"
 
string usage = "usage: %prog [options]"
 
 parser = OptionParser(usage=usage,version=version)
 
 dest
 
 default
 
 help
 
 options
 
 args
 
 resolution = float(options.res)
 
 utc = pytz.utc
 
 central = timezone('US/Central')
 
 moon = ephem.Moon()
 
 sun = ephem.Sun()
 
 nova = ephem.Observer()
 
 lat
 
 lon
 
int minute = 60
 
int second = 1
 
int hour = 60
 
float oneMinute = 1.0
 
float oneSecond = 1.0
 
 start_day = options.startdate
 
 numdays = int(options.numdays)
 
dictionary AnalysisRegionsSun = {}
 
dictionary AnalysisRegionsMoon = {}
 
int last_region = 999
 
int theta = 10
 
 day = ephem.Date(start_day)
 Loop over the days we care about. More...
 

Function Documentation

def moon_position_table_new3.AnalRegion (   a,
  theta 
)

Definition at line 104 of file moon_position_table_new3.py.

Referenced by computeDayBoundaryMoon().

104 def AnalRegion(a, theta) :
105  dayBoundary = theta* math.pi / 180.0
106  nightBoundary = -1 *theta * math.pi / 180.0
107  type = 0
108 
109 
110  if a < nightBoundary :
111  type=1
112  if a > dayBoundary :
113  type=2
114  if (a < dayBoundary) and (a > nightBoundary) :
115  type=3
116 
117 # print '%f %f, %f %d' %(dayBoundary, nightBoundary, a, type)
118 
119  return type
120 
def moon_position_table_new3.computeDayBoundaryMoon (   AnalysisRegions,
  day,
  theta,
  resolution 
)

Definition at line 149 of file moon_position_table_new3.py.

References AnalRegion(), FillAnal(), PandAna.Demos.demo1.range, and submit_syst.str.

149 def computeDayBoundaryMoon(AnalysisRegions, day, theta, resolution):
150  global oneMinute
151  AnalysisRegions['night_time']=0
152  AnalysisRegions['day_time']=0
153  AnalysisRegions['twilight_time']=0
154 # for i in xrange(1,int(86400/resolution)):
155 # nova.date = day + (oneSecond*resolution * i)
156  for i in xrange(1,1440):
157  nova.date = day + oneMinute * i
158  #moon.compute(nova)
159  #region = AnalRegion(moon.alt, theta)
160  sun.compute(nova)
161  region = AnalRegion(sun.alt, theta)
162  FillAnal(AnalysisRegions, region, nova.date, resolution)
163 
164  # Print the transition times in UTC
165  print '%20s, %20s, %20s, %20s' % ((AnalysisRegions['n2t_time_boundary']),(AnalysisRegions['t2d_time_boundary']),
166  (AnalysisRegions['d2t_time_boundary']),(AnalysisRegions['t2n_time_boundary']))
167 
168  tmp_1 = str(AnalysisRegions['n2t_time_boundary']) + "UTC"
169  proc_1 = subprocess.Popen(["/grid/fermiapp/products/nova/externals/novadaq/v04_05_00/slf6.x86_64.e9.debug/bin/NovaTimeConvert",
170  tmp_1], stdout=subprocess.PIPE)
171  semfe_1 = proc_1.stdout.read()
172  proc_1.wait()
173 
174  tmp_2 = str(AnalysisRegions['t2d_time_boundary']) + "UTC"
175  proc_2 = subprocess.Popen(["/grid/fermiapp/products/nova/externals/novadaq/v04_05_00/slf6.x86_64.e9.debug/bin/NovaTimeConvert",
176  tmp_2], stdout=subprocess.PIPE)
177  semfe_2 = proc_2.stdout.read()
178  proc_2.wait()
179 
180  tmp_3 = str(AnalysisRegions['d2t_time_boundary']) + "UTC"
181  proc_3 = subprocess.Popen(["/grid/fermiapp/products/nova/externals/novadaq/v04_05_00/slf6.x86_64.e9.debug/bin/NovaTimeConvert",
182  tmp_3], stdout=subprocess.PIPE)
183  semfe_3 = proc_3.stdout.read()
184  proc_3.wait()
185 
186  tmp_4 = str(AnalysisRegions['t2n_time_boundary']) + "UTC"
187  proc_4 = subprocess.Popen(["/grid/fermiapp/products/nova/externals/novadaq/v04_05_00/slf6.x86_64.e9.debug/bin/NovaTimeConvert",
188  tmp_4], stdout=subprocess.PIPE)
189  semfe_4 = proc_4.stdout.read()
190  proc_4.wait()
191 
192  print semfe_1.split()[13], semfe_2.split()[13], semfe_3.split()[13], semfe_4.split()[13]
193 
194  s.Night_Twilight = long(semfe_1.split()[13])
195  s.Twilight_Day = long(semfe_2.split()[13])
196  s.Day_Twilight = long(semfe_3.split()[13])
197  s.Twilight_Night = long(semfe_4.split()[13])
198  ntp_tr.Fill()
199 
200 # theTime = datetime.fromtimestamp(time.time())
201 
202  unixtimes = []
203  del unixtimes[:]
204  for key in ['n2t_time_boundary','t2d_time_boundary','d2t_time_boundary','t2n_time_boundary']:
205  t = ephem.Date(AnalysisRegions[key]).datetime()
206  # unixtime = time.mktime(theTime.timetuple())
207  unixtime = 0
208  try:
209  unixtime = time.mktime(t.timetuple())
210  except:
211  print 'Value out of range'
212  unixtimes.append(unixtime)
213  # print '%20s, %20s, %20s, %20s' % (unixtimes[0], unixtimes[1], unixtimes[2], unixtimes[3] )
214  sys.stdout.flush()
215 
def computeDayBoundaryMoon(AnalysisRegions, day, theta, resolution)
def FillAnal(a, region, time, resolution)
def moon_position_table_new3.FillAnal (   a,
  region,
  time,
  resolution 
)

Definition at line 121 of file moon_position_table_new3.py.

Referenced by computeDayBoundaryMoon().

121 def FillAnal(a, region, time, resolution) :
122  global last_region
123  #
124  # Added a resolution step to the counters
125  stepSize = oneSecond*resolution
126  if region == 1 :
127  a['night_time']+= stepSize
128  a['total_night_time']+= stepSize
129  if region == 2 :
130  a['day_time']+= stepSize
131  a['total_day_time']+= stepSize
132  if region == 3 :
133  a['twilight_time']+= stepSize
134  a['total_twilight_time']+= stepSize
135 
136  if (region == 1) and (last_region == 3) :
137  a['t2n_time_boundary'] = time
138  if (region == 3) and (last_region == 1) :
139  a['n2t_time_boundary'] = time
140  if region == 2 and last_region == 3 :
141  a['t2d_time_boundary'] = time
142  if region == 3 and last_region == 2 :
143  a['d2t_time_boundary'] = time
144  last_region = region
145 
def FillAnal(a, region, time, resolution)
def moon_position_table_new3.SetupAnalysisRegion (   AnalysisRegions)

Definition at line 80 of file moon_position_table_new3.py.

80 def SetupAnalysisRegion( AnalysisRegions ) :
81  AnalysisRegions['day_time'] = 0
82  AnalysisRegions['night_time'] = 0
83  AnalysisRegions['twilight_time'] = 0
84  AnalysisRegions['total_day_time'] = 0
85  AnalysisRegions['total_night_time'] = 0
86  AnalysisRegions['total_twilight_time'] = 0
87  AnalysisRegions['n2t_time_boundary'] = 0
88  AnalysisRegions['t2d_time_boundary'] = 0
89  AnalysisRegions['d2t_time_boundary'] = 0
90  AnalysisRegions['t2n_time_boundary'] = 0
91 
92 
def SetupAnalysisRegion(AnalysisRegions)
def moon_position_table_new3.tl (   date)

Variable Documentation

dictionary moon_position_table_new3.AnalysisRegionsMoon = {}

Definition at line 94 of file moon_position_table_new3.py.

dictionary moon_position_table_new3.AnalysisRegionsSun = {}

Definition at line 93 of file moon_position_table_new3.py.

moon_position_table_new3.args

Definition at line 46 of file moon_position_table_new3.py.

moon_position_table_new3.central = timezone('US/Central')

Definition at line 52 of file moon_position_table_new3.py.

moon_position_table_new3.day = ephem.Date(start_day)

Loop over the days we care about.

Compute the positions

Definition at line 233 of file moon_position_table_new3.py.

moon_position_table_new3.default

Definition at line 39 of file moon_position_table_new3.py.

moon_position_table_new3.dest

Definition at line 39 of file moon_position_table_new3.py.

moon_position_table_new3.f = TFile('semfe_tmp.root','RECREATE')

Definition at line 14 of file moon_position_table_new3.py.

moon_position_table_new3.help

Definition at line 40 of file moon_position_table_new3.py.

int moon_position_table_new3.hour = 60

Definition at line 71 of file moon_position_table_new3.py.

int moon_position_table_new3.last_region = 999

Definition at line 100 of file moon_position_table_new3.py.

moon_position_table_new3.lat

Definition at line 65 of file moon_position_table_new3.py.

moon_position_table_new3.lon

Definition at line 66 of file moon_position_table_new3.py.

int moon_position_table_new3.minute = 60

Definition at line 69 of file moon_position_table_new3.py.

moon_position_table_new3.moon = ephem.Moon()

Definition at line 56 of file moon_position_table_new3.py.

moon_position_table_new3.nova = ephem.Observer()

Definition at line 58 of file moon_position_table_new3.py.

moon_position_table_new3.ntp_tr = TTree('ntp','My test tree')

Definition at line 15 of file moon_position_table_new3.py.

moon_position_table_new3.numdays = int(options.numdays)

Definition at line 78 of file moon_position_table_new3.py.

float moon_position_table_new3.oneMinute = 1.0

Definition at line 72 of file moon_position_table_new3.py.

float moon_position_table_new3.oneSecond = 1.0

Definition at line 73 of file moon_position_table_new3.py.

moon_position_table_new3.options

Definition at line 46 of file moon_position_table_new3.py.

moon_position_table_new3.parser = OptionParser(usage=usage,version=version)

Definition at line 37 of file moon_position_table_new3.py.

moon_position_table_new3.resolution = float(options.res)

Definition at line 48 of file moon_position_table_new3.py.

moon_position_table_new3.s = MyStruct()

Definition at line 29 of file moon_position_table_new3.py.

int moon_position_table_new3.second = 1

Definition at line 70 of file moon_position_table_new3.py.

Referenced by NdmcClient._adoptMetric(), NdmcClient._getMetric(), NdmcClient._updateGroupName(), AddExptCorrNumu(), fuzz::FuzzyKVertex.AddProng(), novaddt::DAQHeaderAna.analyze(), air::CosmicTrackRate.analyze(), comi::Leana.analyze(), bpf::BPFCVNAna.analyze(), upmuana::UpMuRecoAna.analyze(), upmuana::UpMuAnalysis.analyze(), genie::Registry.Append(), mcchk::DetSimAna.beginJob(), runh::BadDataFilter.beginSubRun(), CAF_makeCAFSensitivities_for_FNEX(), fnex::EventListManipulator.CheckDataMCListConsistency(), caf::Proxy< caf::SRHeader >.CheckEquals(), checkSwap(), cheat::CheckBackTracking.CheckTrackIdToParticle(), fuzz::FuzzyKMeanAlg.CheckUnique(), genie::Registry.CloneRegistryItem(), demoFitContours(), demoFitSlices(), NdmcClient.destroyMetrics(), stan::json::json_data.dims_i(), stan::io::array_var_context.dims_i(), stan::io::dump.dims_i(), stan::json::json_data.dims_r(), stan::io::array_var_context.dims_r(), stan::io::dump.dims_r(), stan::lang::function_signatures.discrete_first_arg(), ana::NumuCCIncPionTemplateFitter.doFullFit(), ana::nueccinc::NueCCIncTemplateFitter.doFullFit(), draw_track_in_one_view(), ana::SystMaker.DrawBkg(), DrawSurfacePoint(), comi::NearlineAna.endJob(), gov::fnal::cd::rms::provider.equal(), expect_eq_traces(), flat::FlatHeader.Fill(), runh::BadDataFilter.filter(), util.find_median(), cmf::ContourFromLibrary.FindChiSqrForPoint(), genie::Algorithm.FindConfig(), fuzz::FuzzyKMeanAlg.FindUnclustered(), flat::FlatHeader.FlatHeader(), FourBinLabels(), stan::lang::function_signatures.get_result_type(), genie::Algorithm.GetConfig(), getEffDiffErrPc(), ana::NumuCCIncPionTemplateFitter.getFitNormalizationAndErrors(), ana::nueccinc::NueCCIncTemplateFitter.getFitNormalizationAndErrors(), getFlatWeightedFittingSpectra(), ndreco::NDRecoFxs.getProngProximity(), getResolutionSpectra(), ndreco::NDRecoFxs.getTrackProximity(), cheat::BackTracker.HitsToParticle(), joint_fit_2017_contours(), joint_fit_2017_make_fc_slice(), joint_fit_2017_make_fc_surf(), joint_fit_2017_slices(), joint_fit_2018_contours(), joint_fit_2018_slices(), jointsensitivity(), lastUpdated(), Legend(), make_fc_mass_and_oct_nersc_2018(), make_fc_mass_and_oct_nersc_2019(), make_fc_mh_nersc_2018(), make_fc_mh_nersc_2019(), make_fc_oct_nersc_2018(), make_fc_oct_nersc_2019(), make_fc_slices_nersc_2018(), make_fc_slices_nersc_2018_stats(), make_fc_slices_nersc_2019(), make_fc_surfaces_nersc_2018(), make_fc_surfaces_nersc_2018_stats(), make_fc_surfaces_nersc_2019(), make_mass_and_oct_fc_input_2019(), MakeCAFSensitivities_for_FNEX(), dt::View.MakeChunkCombos(), MakeFakeExperiment(), evtsum::EventSummary.MakeOutput(), trk::WindowTrackingAlg.MakeViewTrack(), genie::supernova::Limits< double >.Max(), genie::Registry.Merge(), comi::Leana.MuonCandidate(), myBarChart(), stan::lang::program_error.operator()(), caf::Proxy< caf::SRHeader >.operator=(), ana.PDG_cvnmax(), plot_ratios(), ana::PredictionScaleComp.PredictionScaleComp(), ana::SystMaker.ProcessSyst(), cvnprongtf::CVNProngTF.produce(), cvnneutronprongtf::CVNNeutronProngTF.produce(), comi::Cana.produce(), slid::LIDBuilder.produce(), cvntf::CVNProngEvaluatorTF.produce(), slid::SPIDBuilder.produce(), cheat::MCCheater.produce(), ana::BayesianMarginal.QuantileThreshold(), filter::Filter.reconfigure(), dbutils::daqconfig::GeneralDataReader.remapValues(), calib::DriftCorrection.respondToCloseOutputFiles(), stan::lang.rethrow_located(), ana::PredictionCombinePeriods.SaveTo(), fuzz::FuzzyKMeanAlg.SeedA(), sensitivity2018(), sensitivity2020(), genie::supernova::Limits< double >.Set(), specprod_numuccinc(), SumSysts(), syst_table_fit(), syst_table_fit_new(), systematics_extrap_comp_from_pred_interp(), systematics_summary_from_pred_interp(), evd::HeaderDrawer.Text(), util.TimeSlice(), timing_peak(), ana::TreeMaker.TreeMaker(), genie::supernova::Limits< double >.UpdateMax(), ana::Nus17SystFromHist.WeightFor(), ana::NusSystFromHist.WeightFor(), ana::Nus18SystFromHist.WeightFor(), xsec_tot_uncert_optimization(), xsec_uncertainty_per_bin(), and NdmcClient.~NdmcClient().

moon_position_table_new3.start_day = options.startdate

Definition at line 77 of file moon_position_table_new3.py.

moon_position_table_new3.sun = ephem.Sun()

Definition at line 57 of file moon_position_table_new3.py.

int moon_position_table_new3.theta = 10

Definition at line 102 of file moon_position_table_new3.py.

string moon_position_table_new3.usage = "usage: %prog [options]"

Definition at line 36 of file moon_position_table_new3.py.

moon_position_table_new3.utc = pytz.utc

Definition at line 51 of file moon_position_table_new3.py.

string moon_position_table_new3.version = "1.0"

Definition at line 35 of file moon_position_table_new3.py.