Changeset 17652 for trunk/Mars


Ignore:
Timestamp:
04/04/14 11:15:26 (11 years ago)
Author:
tbretz
Message:
Updated to the latest current prediction (from the calibration paper); some code improvements; store files now by default into a subdirectory and omit the '-quality' in the filename; added some more information on the currents in the camera
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/fact/plots/quality.C

    r17521 r17652  
     1#include <algorithm>
     2#include <functional>
     3
    14Bool_t Contains(TArrayD **vec, Double_t t0, Double_t range=0)
    25{
     
    8790    return vecp[vecp.size()-1].second;
    8891}
    89 /*
     92
    9093Float_t Prediction(Double_t time)
    9194{
    9295    Double_t jd = time + 40587 + 2400000.5;
    93 
    94     Nova::EquPosn moon = Nova::GetLunarEquCoords(jd, 0.01);
    95 
    96     // Nova::EquPosn pos = FindPointing(time);
    97 
    98     // get local position of moon
    99     Nova::HrzPosn hrzm = Nova::GetHrzFromEqu(moon, jd);
    100 
    101     // Distance between source and moon
    102     //const double angle = Nova::GetAngularSeparation(moon, hrzm)*TMath::DegToRad();
    103 
    104     // Current prediction
    105     //double cang = sin(angle);
    106     double calt = sin(hrzm.alt*TMath::DegToRad());
    107 
    108     double disk = Nova::GetLunarDisk(jd);
    109 
    110     //                                                                           semi-major axis
    111     double lc = calt*pow(disk, 2.2)*pow(Nova::GetLunarEarthDist(jd)/384400, -2);///sqrt(cang);
    112 
    113     return lc>0 ? 4+103*lc : 4;
    114 }*/
    115 
    116 Float_t Prediction(Double_t time)
    117 {
    118     Double_t jd = time + 40587 + 2400000.5;
    119     /*
    120     Nova::EquPosn moon = Nova::GetLunarEquCoords(jd, 0.01);
    121 
    122     Nova::EquPosn pos = FindPointing(time);
    123 
    124     // get local position of moon
    125     Nova::HrzPosn hrzm = Nova::GetHrzFromEqu(moon, jd);
    126 
    127     // Distance between source and moon
    128     const double angle = Nova::GetAngularSeparation(moon, pos);
    129 
    130     // Distance between earth and moon relative to major semi-axis
    131     const double dist  = Nova::GetLunarEarthDist(jd)/384400;
    132 
    133     // Current prediction
    134     double cang = 1-sin(angle*TMath::DegToRad());
    135     double calt = sin(hrzm.alt*TMath::DegToRad());
    136 
    137     double disk = Nova::GetLunarDisk(jd);
    138 
    139     // light condition
    140     double lc = sqrt(calt)*pow(disk, 2.3)*pow(cang+1, 1)*pow(dist, -2);
    141 
    142     return lc>0 ? 7.2 + 69*lc : 7.2;
    143     */
    14496
    14597    // Sun properties
     
    161113    // Current prediction
    162114    double sin_malt  = hrzm.alt<0 ? 0 : sin(hrzm.alt*TMath::DegToRad());
    163     double sin_mdist = sin(angle*TMath::DegToRad());
    164     double cos_salt  = cos(hrzs.zd*TMath::DegToRad());
    165 
    166     double c0 = pow(disk,     2.52);
    167     double c1 = pow(sin_malt, 0.72);
    168     double c2 = pow(edist,   -2.00);
    169     double c3 = exp(1.46*(1-sin_mdist)*(1-sin_mdist));
    170     double c4 = exp(33.0)*exp(-20.1*(1-cos_salt)*(1-cos_salt));
    171 
    172     double cur = 6.4 + 96.9*c0*c1*c2*c3 + c4;
    173 
    174    // cout << cur << " " << hrzm.alt << " " << c1 << endl;
     115    double cos_mdist = cos(angle*TMath::DegToRad());
     116    double sin_szd   = sin(hrzs.zd*TMath::DegToRad());
     117
     118    double c0 = pow(disk,      2.63);
     119    double c1 = pow(sin_malt,  0.60);
     120    double c2 = pow(edist,    -2.00);
     121    double c3 = exp(0.67*cos_mdist*cos_mdist*cos_mdist*cos_mdist);
     122    double c4 = exp(-97.8+105.8*sin_szd*sin_szd);
     123
     124    double cur = 6.2 + 95.7*c0*c1*c2*c3 + c4;
    175125
    176126    return cur;
    177 
    178127}
    179128
     
    228177    Double_t time;
    229178    Float_t  Imed;
     179    Float_t  Idev;
     180    Float_t  I[416];
    230181
    231182    if (!file.SetPtrAddress("Time",  &time))
     
    233184
    234185    if (!file.SetPtrAddress("I_med", &Imed))
     186        return -1;
     187
     188    if (!file.SetPtrAddress("I_dev", &Idev))
     189        return -1;
     190
     191    if (!file.SetPtrAddress("I", I))
    235192        return -1;
    236193
    237194    TGraph g1;
    238195    TGraph g2;
    239     g1.SetName("Currents");
     196    TGraph g3;
     197    TGraph g4;
     198    TGraph g5;
     199    g1.SetName("CurrentsMed");
    240200    g2.SetName("Prediction");
     201    g3.SetName("CurrentsDev");
     202    g4.SetName("CurrentsMax-4");
     203    g5.SetName("CurrentsMax");
    241204
    242205    while (file.GetNextRow())
    243206        if (Contains(vec, time))
    244207        {
     208            // crazy pixels
     209            I[66]  = 0;
     210            I[191] = 0;
     211            I[193] = 0;
     212
     213            sort(I, I+320);
     214
    245215            g1.SetPoint(g1.GetN(), time*24*3600, Imed);
    246216            g2.SetPoint(g2.GetN(), time*24*3600, Prediction(time));
     217            g3.SetPoint(g3.GetN(), time*24*3600, Imed+Idev);
     218            g4.SetPoint(g4.GetN(), time*24*3600, I[315]);
     219            g5.SetPoint(g5.GetN(), time*24*3600, I[319]);
    247220        }
    248221
    249222    g1.SetMinimum(0);
    250     g1.SetMaximum(99);
     223    g1.SetMaximum(149);
    251224
    252225    g1.SetMarkerStyle(kFullDotMedium);
     
    260233    g1.DrawClone("AP");
    261234
     235    g5.SetMarkerColor(kGray);
     236    g5.DrawClone("P");
     237
     238    g4.SetMarkerColor(kGray+1);
     239    g4.DrawClone("P");
     240
     241    g3.SetMarkerColor(kGray+2);
     242    g3.DrawClone("P");
     243
    262244    g2.SetMarkerColor(kBlue);
    263245    g2.SetMarkerStyle(kFullDotMedium);
    264     g2.GetXaxis()->SetTimeDisplay(true);
    265     g2.GetXaxis()->SetTimeFormat("%H:%M %F1995-01-01 00:00:00 GMT");
    266     g2.GetXaxis()->SetLabelSize(0.12);
    267     g2.GetYaxis()->SetLabelSize(0.1);
    268     g2.GetYaxis()->SetTitle("CURRENT");
    269     g2.GetYaxis()->SetTitleOffset(0.2);
    270     g2.GetYaxis()->SetTitleSize(0.1);
    271246    g2.DrawClone("P");
    272247
     
    647622}
    648623
    649 void quality(UInt_t y=0, UInt_t m=0, UInt_t d=0, TString outpath="./")
     624void quality(UInt_t y=0, UInt_t m=0, UInt_t d=0, const char *outpath="quality")
    650625{
    651626    // To get correct dates in the histogram you have to add
     
    772747    cout << PlotTemperature4(runs, fname) << endl;
    773748
    774     c->SaveAs(Form("%s/%04d%02d%02d-quality.png", outpath.Data(), y, m, d));
    775 }
    776 
    777 //20130314_141
     749    c->SaveAs(Form("%s/%04d%02d%02d.png", outpath, y, m, d));
     750}
Note: See TracChangeset for help on using the changeset viewer.