plt.xlim([minute_ini, minute_end+1])
ax.xaxis.set_major_locator(MultipleLocator((minute_end-minute_ini+1)/11))

# to human readable date
pre = map (time.gmtime, labels)
labels = map(figures.format_second, pre)

ax.set_xticklabels(labels)
fig.autofmt_xdate()

if save:
	threshold_obs_time -= t_acquisition
	if SAA: note = '_SAA'
	else: note = ''
	fname = '%svisibility_stars_obs_%d_o_%d_to_%d%s' % (folder_figures,threshold_obs_time,fo,lo, note)
	figures.savefig(fname,fig,fancy)


### A spatial plot of the targets
fig = plt.figure()
ax = plt.subplot(111, projection='mollweide')

plt.scatter((ra_cat-180)/const.RAD,dec_cat/const.RAD, c=mag_cat, marker='*', s=50, edgecolor='none', vmin=param.magnitude_min,vmax=param.magnitude_max+0.2)

v = np.linspace(param.magnitude_min,param.magnitude_max, (param.magnitude_max-param.magnitude_min+1), endpoint=True)
t = map(figures.format_mag, v)
cbar = plt.colorbar(ticks=v, orientation='horizontal',shrink=.8)
cbar.set_ticklabels(t)
l,b,w,h = plt.gca().get_position().bounds
ll,bb,ww,hh = cbar.ax.get_position().bounds
cbar.ax.set_position([ll, bb+0.1, ww, hh])
                  np.fliplr(delta),
                  200,
                  cmap=plt.cm.RdBu_r,
                  levels=v)

plt.yticks(np.arange(-80, 100, 20.))

#v = np.linspace(min_val,max_val, 9, endpoint=True)

cbar = plt.colorbar(CS, ticks=v)
cbar.set_ticklabels([r"%+1.1f" % l for l in v])
cbar.set_label(r'$\mathrm{Days}$')

plt.xlabel('RA [hours]')
plt.ylabel('Dec [deg]')

stepra = 3
xticks = np.arange(0, 24 + stepra, stepra)
print "min delta: %+02.1f" % np.amin(delta)
print "max delta: %+02.1f" % np.amax(delta)
plt.xticks(xticks)
ax.set_xticklabels(
    [r"$%d\mathrm{h}$" % h for h in [12, 9, 6, 3, 0, 21, 18, 15]])

if show: plt.show()

if save:
    fname = sky_coverage_map_fname_ref + '---' + sky_coverage_map_fname_other
    figures.savefig(folder_figures_ref + fname, fig, fancy)
    print 'saved as %s' % folder_figures_ref + fname
cbar.set_ticklabels(t)

# cbar = plt.colorbar(CS, orientation='horizontal',shrink=.8, ticks=t)
# cbar.ax.set_xticklabels(labels)
l, b, w, h = plt.gca().get_position().bounds
ll, bb, ww, hh = cbar.ax.get_position().bounds
cbar.ax.set_position([ll, bb + 0.1, ww, hh])
cbar.set_label(r"$\mathrm{faintest}\ V\ \mathrm{magnitude\ for\ %s\ (%d\%%\ detection)}$" % (typep, min_detection_rate))

if stars:
    x, y = m(ra_stars, dec_stars)
    m.plot(x, y, "w*", markersize=10)

    for label, xpt, ypt, y_offset in zip(labels, x, y, y_offset):
        plt.text(xpt, ypt + y_offset, label, color="white", size="x-small", ha="center", weight="black")  # #93a4ed

if targets_exo:
    x, y = m(ra_tar * 180.0 / np.pi, dec_tar * 180.0 / np.pi)
    x, y = m(ra_tar, dec_tar)
    m.scatter(x, y, c="white", edgecolor="k", marker="+", s=20, zorder=10, lw=0.5)


# Save plot
if save:
    fname = "%d-inter%d-mag-%s-%d%s" % (orbit_id, max_interruptions, typep, min_detection_rate, note)
    figures.savefig(folder_figures + fname, fig, fancy)
    print "saved as %s" % folder_figures + fname

if show:
    plt.show()
Example #4
0
ax.yaxis.grid(True, 'minor')
ax.xaxis.grid(True, 'major', linewidth=2)
ax.yaxis.grid(True, 'major', linewidth=2)

plt.plot(xx, corrected_620[:, 1], 'b', linewidth=2, label='620 km')
#pplt.plot(xx, corrected_620[:,1], 'Darkorange' , linewidth=2, label='Worst case')
#pplt.plot(xx, corrected_700[:,1], 'g', linewidth=3, label='Current INAF')
plt.plot(xx, corrected_700[:, 1], 'r', linewidth=2, label='700 km')

fig.autofmt_xdate()
plt.legend(loc=2)
#plt.ylim([0, 0.022])
plt.ylabel(r'$\mathrm{Relative\ maximum\ stray\ light\ flux\ to\ 800\ km}$')
# Saves the figure
fname = '%srelative_flux_%d' % (folder_figures, sl_angle)
figures.savefig(fname, fig, fancy)

fig = plt.figure()
ax = plt.subplot(111)
# zooms
ax.yaxis.set_major_locator(MultipleLocator(0.2))
ax.yaxis.set_minor_locator(MultipleLocator(0.1))

#pax.yaxis.set_major_locator(MultipleLocator(1.))
#pax.yaxis.set_minor_locator(MultipleLocator(0.5))

#ax.xaxis.set_major_locator(MultipleLocator(20.))

ax.xaxis.grid(True, 'minor')
ax.yaxis.grid(True, 'minor')
ax.xaxis.grid(True, 'major', linewidth=2)
Example #5
0
		label=None
	if 'color' in el:
		color=el['color']

		plt.plot(data[:,0],data[:,1],lw=lw,label=label,color=color)
	else:
		plt.plot(data[:,0],data[:,1],lw=lw,label=label)


if legend:
	plt.legend(loc='best')

if not requirement_days is None:
	plt.axvline(x=requirement_days, c="gray", lw=2)
if not requirement_obs is None:
	plt.axhline(y=requirement_obs, c="gray", lw=2)

plt.ylabel(r"$\mathrm{Fraction\ of\ full\ sky\ [\%]}$")
plt.xlabel(r"$\mathrm{Required\ observation\ time\ [days]}$")

if not xlim is None:
	plt.xlim(xlim)
if not ylim is None:
	plt.ylim(ylim)
plt.grid()

if not out_fname is None:
	figures.savefig(out_fname, f, fancy)
	print 'saved as %s' % out_fname
plt.show()
Example #6
0
import resources.figures as figures
import numpy as np
import pylab as plt
# WARNING: This is an obselete version of the code...

pst = np.loadtxt('straylight_orbitID_p/INPUT/pst.dat')
print pst
figures.set_fancy()
fig = plt.figure()
plt.xlabel(r'$\theta$')
plt.ylabel('PST')
plt.semilogy(pst[:, 0], pst[:, 1], lw=2)
plt.plot([35, 35], [np.amin(pst[:, 1]), np.amax(pst[:, 1])], lw=3, color='r')
plt.grid()

figures.savefig('orbitID_figures/pst', fig, fancy=True)
plt.show()
Example #7
0
    idr = np.where(np.abs(ra - 1.806) < 0.1)[0]
    idd = np.where(np.abs(dec + 0.55) < 0.1)[0]
    id_ = np.intersect1d(idr, idd)

    sl[minute - a_ini] = S_sl[id_]
    print S_sl[id_]

fig = plt.figure()
ax = plt.subplot(111)
fig.text(0.12, 0.91, r'$\times 10^{-2}$')
fig.text(0.2, 0.8, r'$\alpha=103^\circ,\ \delta=-31.5^\circ$')
plt.xlabel('Minutes in orbit %d [min]' % o)
plt.ylabel(
    r'$\mathrm{Mean\ stray\ light\ flux\ }\left[\frac{\mathrm{ph}}{\mathrm{px}\cdot\mathrm{s}}\right]$'
)
plt.grid()
plt.plot(sl * 100, lw=2)
from matplotlib.ticker import MaxNLocator, MultipleLocator, FormatStrFormatter
ax.yaxis.set_major_locator(MultipleLocator(0.5))
ax.yaxis.set_minor_locator(MultipleLocator(0.25))

ax.xaxis.set_major_locator(MultipleLocator(20.))
ax.xaxis.set_minor_locator(MultipleLocator(10.))

ax.xaxis.grid(True, 'minor')
ax.yaxis.grid(True, 'minor')
ax.xaxis.grid(True, 'major', linewidth=2)
ax.yaxis.grid(True, 'major', linewidth=2)
figures.savefig('all_figures/flux_fixed_direction', fig, True)
plt.show()
	idr = np.where(np.abs(ra-1.806) < 0.1)[0]
	idd = np.where(np.abs(dec+0.55) < 0.1)[0]
	id_ = np.intersect1d(idr, idd)

	sl[minute-a_ini] = S_sl[id_]
	print S_sl[id_]


fig=plt.figure()
ax = plt.subplot(111)
fig.text(0.12, 0.91,  r'$\times 10^{-2}$')
fig.text(0.2, 0.8,  r'$\alpha=103^\circ,\ \delta=-31.5^\circ$')
plt.xlabel('Minutes in orbit %d [min]' % o)
plt.ylabel(r'$\mathrm{Mean\ stray\ light\ flux\ }\left[\frac{\mathrm{ph}}{\mathrm{px}\cdot\mathrm{s}}\right]$')
plt.grid()
plt.plot(sl*100,lw=2)
from matplotlib.ticker import MaxNLocator, MultipleLocator, FormatStrFormatter
ax.yaxis.set_major_locator(MultipleLocator(0.5))
ax.yaxis.set_minor_locator(MultipleLocator(0.25))

ax.xaxis.set_major_locator(MultipleLocator(20.))
ax.xaxis.set_minor_locator(MultipleLocator(10.))

ax.xaxis.grid(True,'minor')
ax.yaxis.grid(True,'minor')
ax.xaxis.grid(True,'major',linewidth=2)
ax.yaxis.grid(True,'major',linewidth=2)
figures.savefig('all_figures/flux_fixed_direction',fig,True)
plt.show()