-
Notifications
You must be signed in to change notification settings - Fork 2
/
example.py
executable file
·61 lines (47 loc) · 2.23 KB
/
example.py
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
#!/usr/bin/env python
from matplotlib import pyplot as plt
import previs
# Perform previs research on one object:
data = previs.search("CI Tau", verbose=True)
# data contains informations stored as dictionnary. You can
# read the api_reference.md to get all detailled informations
# or the docstring of previs.search. For instance:
magL = data["Mag"]["magL"] # If you want to get the L magnitudes.
# The Spectral Energy Distribution from Vizier (Flux [Jy] and wl [µm])
wl, Flux = data["SED"]["wl"], data["SED"]["Flux"]
distance = data["Gaia_dr2"]["Dkpc"] # The Gaia DR2 distance [kpc]
# You can save the data as json file (named mydata_Altair) with:
previs.save(data, "mydata_Altair", overwrite=True)
# And load it later with:
data_altair = previs.load("mydata_Altair")
# If you want to know if you can observe the star Altair with
# the different instrument of the VLTI, you can plot the synthetic
# result with:
fig = previs.plot_VLTI(data)
fig.show()
# Or with CHARA:
fig = previs.plot_CHARA(data)
fig.show()
# If you want to know indidually the observability or your target, for instance,
# MATISSE with the AT, without fringe tracking, in L-band and in
# low spectral resolution, you can type:
observability_mat = data["Ins"]["MATISSE"]["AT"]["noft"]["L"]["LR"]
# You can also perform previs.search on a list of stars using previs.survey
list_stars = ["Betelgeuse", "CI Tau", "WR112", "WR104", "HD100203"]
survey = previs.survey(list_stars)
# The previs.search on one star can take up to 30 sec, you may want to
# save the result of previs.survey to be used later. It can be saved
# and retrieved as before with:
previs.save(survey, "mysurvey", overwrite=True)
my_saved_survey = previs.load("mysurvey")
# Survey contains data for each stars, we want to know the exact number
# of stars observable with each instruments. So, use previs.count_survey
# to generate the list of observable stars by instruments, mode and telescope.
count_survey = previs.count_survey(my_saved_survey)
# Print the list of observable stars (resume):
count_survey.print_log()
# plot the histogram of the observable stars:
fig = previs.plot_histo_survey(count_survey, plot_HR=True)
# plot_HR is set as True to plot high spectral resolution informations (default=False)
fig.show()
plt.show()