Beispiel #1
0
def LoadReferences(minute,
                   t_end,
                   ras,
                   decs,
                   n_alpha=None,
                   n_delta=None,
                   file_flux='flux_',
                   folder='flux'):
    ''' Prepares the reference orbit '''
    import numpy as np
    import resources.routines as rr

    import parameters as param

    # Prepare the grid just like for the observability maps.
    if n_alpha == None: n_alpha = param.resx
    if n_delta == None: n_delta = param.resy

    Period = t_end - minute + 1

    t_ini = minute
    references = np.zeros(n_alpha * n_delta * (Period)).reshape(
        Period, n_alpha, n_delta)
    while (minute <= t_end):
        try:
            ra, dec, S_sl = rr.load_flux_file(minute, file_flux, folder=folder)
            for i, target in enumerate(S_sl):
                id_ra = rr.find_nearest(ras, ra[i])
                id_dec = rr.find_nearest(decs, dec[i])
                references[minute - int(t_ini), id_ra, id_dec] = S_sl[i]

        except IOError:

            # In case of SAA in the file.
            #			print 'No file for this reference at minute '+str(minute)
            try:
                ra, dec, S_sl = rr.load_flux_file(minute - Period,
                                                  file_flux,
                                                  folder=folder)
                for i, target in enumerate(S_sl):
                    id_ra = rr.find_nearest(ras, ra[i])
                    id_dec = rr.find_nearest(decs, dec[i])
                    references[minute - int(t_ini), id_ra, id_dec] = S_sl[i]
            except:
                try:
                    ra, dec, S_sl = rr.load_flux_file(minute + Period,
                                                      file_flux,
                                                      folder=folder)
                    for i, target in enumerate(S_sl):
                        id_ra = rr.find_nearest(ras, ra[i])
                        id_dec = rr.find_nearest(decs, dec[i])
                        references[minute - int(t_ini), id_ra,
                                   id_dec] = S_sl[i]
                except:
                    #					print 'Assuming 0'
                    pass
        minute += 1
    return references
def LoadReferences(minute,t_end,ras,decs,n_alpha=None,n_delta=None,file_flux='flux_',folder='flux'):
	''' Prepares the reference orbit '''
	import numpy as np
	import resources.routines as rr

	import parameters as param

	# Prepare the grid just like for the observability maps.
	if n_alpha == None: n_alpha = param.resx
	if n_delta == None: n_delta = param.resy

	Period = t_end - minute+1

	t_ini=minute
	references = np.zeros(n_alpha*n_delta*(Period)).reshape(Period,n_alpha,n_delta)
	while (minute <= t_end):
		try:
			ra, dec, S_sl = rr.load_flux_file(minute, file_flux, folder=folder)
			for i, target in enumerate(S_sl):
				id_ra = rr.find_nearest(ras,ra[i])
				id_dec = rr.find_nearest(decs,dec[i])
				references[minute-int(t_ini), id_ra, id_dec] = S_sl[i]

		except IOError:
			
			# In case of SAA in the file.
#			print 'No file for this reference at minute '+str(minute)
			try:
				ra, dec, S_sl = rr.load_flux_file(minute-Period, file_flux, folder=folder)
				for i, target in enumerate(S_sl):
					id_ra = rr.find_nearest(ras,ra[i])
					id_dec = rr.find_nearest(decs,dec[i])
					references[minute-int(t_ini), id_ra, id_dec] = S_sl[i]
			except:
				try:
					ra, dec, S_sl = rr.load_flux_file(minute+Period, file_flux, folder=folder)
					for i, target in enumerate(S_sl):
						id_ra = rr.find_nearest(ras,ra[i])
						id_dec = rr.find_nearest(decs,dec[i])
						references[minute-int(t_ini), id_ra, id_dec] = S_sl[i]
				except:
#					print 'Assuming 0'
					pass
		minute += 1
	return references
def fast_minute2orbit(times, minute,orbit_id):
	from resources.routines import find_nearest
	id_orbit = find_nearest(times[:,2],minute)
	orbit = times[id_orbit,0]

	return orbit
Beispiel #4
0
def fast_minute2orbit(times, minute, orbit_id):
    from resources.routines import find_nearest
    id_orbit = find_nearest(times[:, 2], minute)
    orbit = times[id_orbit, 0]

    return orbit