Corot » History » Version 8
Anonymous, 26/04/2012 17:41
1 | 1 | Anonymous | h1. Corot |
---|---|---|---|
2 | 1 | Anonymous | |
3 | 1 | Anonymous | |
4 | 8 | Anonymous | h2. Scripts de création des imagettes |
5 | 8 | Anonymous | |
6 | 8 | Anonymous | Premièrement, récupérer la liste des corotid à traiter. On peut séparer par run_code pour faire tourner le script moins longtemps et faire moins chauffer le corot-lightcurve et son repertoire 'temp'. |
7 | 8 | Anonymous | |
8 | 8 | Anonymous | On récupère donc les corotid depuis pgadmin3 (exemple pour SRa05 et EN2_STAR_CHR : select distinct corotid from exo_n2_view where run_code like 'SRa05%' and en2_star_mon; ) |
9 | 8 | Anonymous | |
10 | 8 | Anonymous | Puis avec emacs on rajoute le début de l'url : http://idoc-corot-lightcurve.ias.u-psud.fr/rest/tempo/basic/N2/SRa05/ (dans un fichier, par exemple "links.txt") |
11 | 8 | Anonymous | |
12 | 8 | Anonymous | On utilise tempo qui pointe vers les data privés mais sans authentification (ligne à décommenter dans spring-config.xml sur idc-appli2 : /usr/local/tomcat_corot/webapps/corot-lightcurve/WEB-INF/conf) |
13 | 8 | Anonymous | |
14 | 8 | Anonymous | Puis on exécute le script perl qui va générer les *.png dans /usr/local/tomcat_corot/webapps/corot-lightcurve/temp/ : |
15 | 8 | Anonymous | |
16 | 8 | Anonymous | <pre><code class="java"> |
17 | 8 | Anonymous | |
18 | 8 | Anonymous | #!/usr/bin/perl |
19 | 8 | Anonymous | open READ, "< links.txt"; |
20 | 8 | Anonymous | while (<READ>) |
21 | 8 | Anonymous | { |
22 | 8 | Anonymous | chomp; |
23 | 8 | Anonymous | system("curl $_ | grep \"alt=\\\"Light curve for corot id\" >> adr_img.txt"); |
24 | 8 | Anonymous | } |
25 | 8 | Anonymous | |
26 | 8 | Anonymous | </code></pre> |
27 | 8 | Anonymous | |
28 | 8 | Anonymous | |
29 | 8 | Anonymous | On obtient une ligne par imagette générée. |
30 | 8 | Anonymous | |
31 | 8 | Anonymous | <img src="http://idoc-corot-lightcurve.ias.u-psud.fr/temp/lightcurve_8653845841090318133.png" alt="Light curve for corot id : 223925326 (run SRa05)" /> |
32 | 8 | Anonymous | |
33 | 8 | Anonymous | Il faut ensuite copier les imagettes en local et les renommer : D'abord éditer avec Emacs (avec des replace string) pour obtenir : |
34 | 8 | Anonymous | |
35 | 8 | Anonymous | http://idoc-corot-lightcurve.ias.u-psud.fr/temp/lightcurve_8653845841090318133.png > img_exo_223925326_SRa05.png |
36 | 8 | Anonymous | |
37 | 8 | Anonymous | Puis lancer le 2eme script perl : |
38 | 8 | Anonymous | |
39 | 8 | Anonymous | <pre><code class="java"> |
40 | 8 | Anonymous | |
41 | 8 | Anonymous | #!/usr/bin/perl |
42 | 8 | Anonymous | open READ, "< adr_img.txt"; |
43 | 8 | Anonymous | while (<READ>) |
44 | 8 | Anonymous | { |
45 | 8 | Anonymous | chomp; |
46 | 8 | Anonymous | system("curl $_"); |
47 | 8 | Anonymous | } |
48 | 8 | Anonymous | |
49 | 8 | Anonymous | </code></pre> |
50 | 8 | Anonymous | |
51 | 8 | Anonymous | |
52 | 1 | Anonymous | h2. Gestion des imagettes dans le Detail |
53 | 1 | Anonymous | |
54 | 1 | Anonymous | Dans le fichier : /usr/local/Sitools2_Corot/workspace/client-user/js/components/viewDataDetail/viewDataDetail.js |
55 | 1 | Anonymous | Ligne 102 : collapsed : false |
56 | 2 | Anonymous | |
57 | 2 | Anonymous | |
58 | 2 | Anonymous | h2. Export VOTABLE |
59 | 3 | Anonymous | |
60 | 3 | Anonymous | Dans contextMenu.js (client) : |
61 | 3 | Anonymous | |
62 | 3 | Anonymous | <pre><code class="javascript"> |
63 | 4 | Anonymous | // ligne 864 fichier version 0.9.1 |
64 | 3 | Anonymous | // on test que l'utilisateur ne selectionne pas CHR et MON en meme temps + qu'il n'a pas pris de WINDESC et d'IMAG |
65 | 3 | Anonymous | if((request.search("EN2_STAR_CHR")!=-1 && request.search("EN2_STAR_MON")!=-1) || request.search("EN2_WIN")!=-1 || request.search("EN2_STAR_IMAG")!=-1){ |
66 | 3 | Anonymous | // si oui on l'averti que ce n'est pas possible et on ne lance pas le VOTable |
67 | 3 | Anonymous | Ext.Msg.alert("WARNING !", "DONT SELECT WINDESCRIPTOR OR IMAG" + "<br/>" + " ALSO DONT PICK EN2_STAR_MON AND EN2_STAR_CHR AT THE SAME TIME PLEASE !!!"); |
68 | 3 | Anonymous | |
69 | 3 | Anonymous | }else{ |
70 | 3 | Anonymous | // sinon on lance exportVOTable |
71 | 3 | Anonymous | |
72 | 3 | Anonymous | |
73 | 3 | Anonymous | url += "?1=1" + request; |
74 | 3 | Anonymous | if (!Ext.isEmpty(limit)) { |
75 | 3 | Anonymous | url += "&limit=" + limit; |
76 | 3 | Anonymous | } |
77 | 3 | Anonymous | if (! Ext.isEmpty(userParameters)) { |
78 | 3 | Anonymous | Ext.iterate(userParameters, function (key, value) { |
79 | 3 | Anonymous | url += "&" + key + "=" + value; |
80 | 3 | Anonymous | }); |
81 | 3 | Anonymous | } |
82 | 3 | Anonymous | |
83 | 3 | Anonymous | // If Get => the Resource MUST be synchrone and then send a representation |
84 | 3 | Anonymous | if (method == "GET") { |
85 | 3 | Anonymous | window.open(url); |
86 | 3 | Anonymous | Ext.getBody().unmask(); |
87 | 3 | Anonymous | return; |
88 | 3 | Anonymous | } else { |
89 | 3 | Anonymous | this._executeRequestForResource(url, method); |
90 | 3 | Anonymous | } |
91 | 3 | Anonymous | } |
92 | 3 | Anonymous | |
93 | 6 | Anonymous | </code></pre> |
94 | 5 | Anonymous | |
95 | 5 | Anonymous | |
96 | 5 | Anonymous | Puis dans ExportVORessource.java : |
97 | 5 | Anonymous | |
98 | 5 | Anonymous | <pre><code class="java"> |
99 | 5 | Anonymous | // ligne 192 |
100 | 5 | Anonymous | // Execute request to know which value are selected |
101 | 5 | Anonymous | String primkey=""; |
102 | 5 | Anonymous | Integer type=0; |
103 | 5 | Anonymous | try { |
104 | 5 | Anonymous | primkey = databaseRequest.getRequestAsString(); //.getSelectedPrimaryKey(); |
105 | 5 | Anonymous | boolean found = primkey.contains("AN2"); |
106 | 5 | Anonymous | if(found){ |
107 | 5 | Anonymous | System.out.println("J'ai trouvé AN2 !!!\n"); |
108 | 5 | Anonymous | type=1; |
109 | 5 | Anonymous | }else{ |
110 | 5 | Anonymous | //System.out.println("AN2 non trouvé !!!\n"); |
111 | 5 | Anonymous | if((primkey.contains("EN2_STAR_CHR") && primkey.contains("EN2_STAR_MON")) || primkey.contains("EN2_WIN") || primkey.contains("EN2_STAR_IMAG")){ |
112 | 5 | Anonymous | System.out.println("Error j'ai trouvé CHR et MON !!!\n"); |
113 | 5 | Anonymous | }else{ |
114 | 5 | Anonymous | if(primkey.contains("EN2_STAR_CHR")){ |
115 | 5 | Anonymous | System.out.println("J'ai trouvé CHR !!!\n"); |
116 | 5 | Anonymous | type = 2; |
117 | 5 | Anonymous | } else{ |
118 | 5 | Anonymous | if(primkey.contains("EN2_STAR_MON")){ |
119 | 5 | Anonymous | System.out.println("J'ai trouvé MON !!!\n"); |
120 | 5 | Anonymous | type = 3; |
121 | 5 | Anonymous | } |
122 | 5 | Anonymous | } |
123 | 5 | Anonymous | } |
124 | 5 | Anonymous | } |
125 | 5 | Anonymous | System.out.println("Type vaux : " + type); |
126 | 5 | Anonymous | } catch (SitoolsException ex) { |
127 | 5 | Anonymous | Logger.getLogger(ExportVOResource.class.getName()).log(Level.SEVERE, null, ex); |
128 | 5 | Anonymous | } |
129 | 5 | Anonymous | System.out.println("primkey : " + primkey); // astero et AN2_STAR dans la requete !!! |
130 | 5 | Anonymous | |
131 | 5 | Anonymous | [ ........ ] |
132 | 5 | Anonymous | |
133 | 5 | Anonymous | // ligne 246 |
134 | 5 | Anonymous | String template_name = ""; |
135 | 5 | Anonymous | if (type==1) |
136 | 5 | Anonymous | template_name = "template_astero.ftl"; |
137 | 5 | Anonymous | else if (type==2) |
138 | 5 | Anonymous | template_name = "template_exo_chr.ftl"; |
139 | 5 | Anonymous | else if (type==3) |
140 | 5 | Anonymous | template_name = "template_exo_mon.ftl"; |
141 | 5 | Anonymous | |
142 | 5 | Anonymous | |
143 | 5 | Anonymous | System.out.println("j'envoie le template : " + template_name); |
144 | 5 | Anonymous | |
145 | 5 | Anonymous | //Return the response |
146 | 7 | Anonymous | if (type!=0) |
147 | 7 | Anonymous | return new VOTableRepresentation(dataModel, template_name); |
148 | 7 | Anonymous | else |
149 | 7 | Anonymous | return null; |
150 | 6 | Anonymous | </code></pre> |
151 | 6 | Anonymous | |
152 | 6 | Anonymous | |
153 | 6 | Anonymous | |
154 | 6 | Anonymous | Les templates.ftl doivent être dans le folder de VOTableRepresentation.java et doivent être bien définis. |
155 | 6 | Anonymous | |
156 | 6 | Anonymous | Exemple : Pour EN2_STAR_MON, template_exo_mon.ftl |
157 | 6 | Anonymous | |
158 | 6 | Anonymous | <pre><code class="XML"> |
159 | 6 | Anonymous | |
160 | 6 | Anonymous | <?xml version="1.0" encoding="UTF-8"?> |
161 | 6 | Anonymous | <VOTABLE version="1.2" |
162 | 6 | Anonymous | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
163 | 6 | Anonymous | xsi:schemaLocation="http://www.ivoa.net/xml/VOTable/v1.2" |
164 | 6 | Anonymous | xmlns="http://www.ivoa.net/xml/VOTable/v1.2"> |
165 | 6 | Anonymous | <!-- |
166 | 6 | Anonymous | ! VOTable written by MHUSSON@IAS version 0.1 (mhusson@ias.u-psud.fr) |
167 | 6 | Anonymous | ! at 2012-03-30 |
168 | 6 | Anonymous | ! Best use with TOPCAT 3.9 or higher version |
169 | 6 | Anonymous | !--> |
170 | 6 | Anonymous | <RESOURCE name="COROT N2 EN2MON"> |
171 | 6 | Anonymous | <DESCRIPTION>COROT N2 PUBLIC DATA VOTABLE STREAM FORMAT</DESCRIPTION> |
172 | 6 | Anonymous | <PARAM name="COROT VERSION" datatype="char" arraysize="*" value="N2"> |
173 | 6 | Anonymous | <DESCRIPTION>COROT N2 FITS STREAM</DESCRIPTION> |
174 | 6 | Anonymous | </PARAM> |
175 | 6 | Anonymous | <INFO name="SITOOLS2 COROT PROJECT" value="http://idoc-corotn2-public-v2.ias.u-psud.fr"> |
176 | 6 | Anonymous | VOTABLE generated with SItools2 COROT and exportVO Ressource (J-C.Malapert@CNES, M.Husson@IAS) |
177 | 6 | Anonymous | </INFO> |
178 | 6 | Anonymous | <TABLE ID="reference"> |
179 | 6 | Anonymous | <FIELD ID="date" arraysize="23" datatype="char" name="DATE" unit="yyyy-mm-jjThh:mi:ss"/> |
180 | 6 | Anonymous | <FIELD ID="datejd" datatype="double" name="DATEJD" unit="COROT JULIAN DAY"/> |
181 | 6 | Anonymous | <FIELD ID="datehel" datatype="double" name="DATEHEL" unit="COROT JULIAN DAY"/> |
182 | 6 | Anonymous | <FIELD ID="status" datatype="int" name="STATUS"/> |
183 | 6 | Anonymous | <FIELD ID="whiteflux" datatype="float" name="WHITEFLUX" unit="ELECTRONS"/> |
184 | 6 | Anonymous | <FIELD ID="whitefluxdev" datatype="float" name="WHITEFLUXDEV" unit="ELECTRONS"/> |
185 | 6 | Anonymous | <FIELD ID="bg" datatype="float" name="BG" unit="ELECTRONS PER PIXEL"/> |
186 | 6 | Anonymous | <FIELD ID="correc" datatype="float" name="CORREC" unit="ELECTRONS"/> |
187 | 6 | Anonymous | </TABLE> |
188 | 6 | Anonymous | <#list rows as row> |
189 | 6 | Anonymous | <TABLE ref="reference" name="${row["file"]}"> |
190 | 6 | Anonymous | <PARAM name="COROT ID" value="${row["corotid"]}"/> |
191 | 6 | Anonymous | <PARAM name="COROT RUN" value="${row["run_code"]}"/> |
192 | 6 | Anonymous | <DATA> |
193 | 6 | Anonymous | <FITS extnum="1"> |
194 | 6 | Anonymous | <STREAM actuate="onRequest" href="${row["download"]}"/> |
195 | 6 | Anonymous | </FITS> |
196 | 6 | Anonymous | </DATA> |
197 | 6 | Anonymous | </TABLE> |
198 | 6 | Anonymous | </#list> |
199 | 6 | Anonymous | </RESOURCE> |
200 | 6 | Anonymous | </VOTABLE> |
201 | 6 | Anonymous | |
202 | 6 | Anonymous | </code></pre> |