IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 18, 2015, 6:33:51 AM (11 years ago)
Author:
eugene
Message:

merge changes from eam branch ipp-20150405: add R7 to lensing, fix R5,R6,R7 definitions and mean photometry; calculate E1,E2 in dvolens; fix precision for dvopsps FW objects; fix histograms at axis; new colormap options; require primary skycell in diff mean photometry

Location:
trunk
Files:
6 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/Ohana/src/kapa2/src/DrawObjects.c

    r38062 r38153  
    248248 
    249249  /* connect first point to second point */
    250   sxa = sx0 - 0.5*(sx1 - sx0);
     250  sxa = MIN (MAX (sx0 - 0.5*(sx1 - sx0), X0), X1);
    251251  sya = MAX (sy0, Y0);
    252252  DrawLine (sx0, sy0, sxa, sy0);
     
    254254 
    255255  /* draw segment equal distance behind first point and down to x-axis */
    256   sxa = 0.5*(sx0 + sx1);
     256  sxa = MIN (MAX (0.5*(sx0 + sx1), X0), X1);
    257257  DrawLine (sx0, sy0, sxa, sy0);
    258258  DrawLine (sxa, sy0, sxa, sy1);
     
    269269    sx1 = MIN (MAX (sx1, X0), X1);
    270270    sy1 = MAX (MIN (sy1, Y0), Y1);
    271     sxa = 0.5*(sx0 + sx1);
     271    sxa = MIN (MAX (0.5*(sx0 + sx1), X0), X1);
    272272    DrawLine (sx0, sy0, sxa, sy0);
    273273    DrawLine (sxa, sy0, sxa, sy1);
     
    278278 
    279279  /* draw segment equal distance after last point and down to x-axis */
    280   sxa = sx1 + 0.5*(sx1 - sxo);
     280  sxa = MIN (MAX (sx1 + 0.5*(sx1 - sxo), X0), X1);
    281281  sya = MAX (sy1, Y0);
    282282  DrawLine (sx1, sy1, sxa, sy1);
  • trunk/Ohana/src/kapa2/src/InterpretKeys.c

    r38062 r38153  
    11# include "Ximage.h"
     2# define FILTER_MODS 1
    23
    34int InterpretKeys (Graphic *graphic, XKeyEvent *event) {
     
    3233    // skip the following keys:
    3334    if (name == NULL) goto skip_cursor;
    34     if (!strcmp (name, "Shift_L")) goto skip_cursor;
    35     if (!strcmp (name, "Shift_R")) goto skip_cursor;
    36     if (!strcmp (name, "Control_L")) goto skip_cursor;
    37     if (!strcmp (name, "Control_R")) goto skip_cursor;
    38     if (!strcmp (name, "Alt_L")) goto skip_cursor;
    39     if (!strcmp (name, "Alt_R")) goto skip_cursor;
    40     if (!strcmp (name, "Super_L")) goto skip_cursor;
    41     if (!strcmp (name, "Super_R")) goto skip_cursor;
    42     if (!strcmp (name, "Caps_Lock")) goto skip_cursor;
    43     if (!strcmp (name, "Pause")) goto skip_cursor;
    44     if (!strcmp (name, "Continue")) goto skip_cursor;
    45     if (!strcmp (name, "Num_Lock")) goto skip_cursor;
    46     if (!strcmp (name, "Scroll_Lock")) goto skip_cursor;
    47     if (!strcmp (name, "Print")) goto skip_cursor;
    48     if (!strcmp (name, "(null)")) goto skip_cursor;
     35    if (FILTER_MODS) {
     36      if (!strcmp (name, "Shift_L")) goto skip_cursor;
     37      if (!strcmp (name, "Shift_R")) goto skip_cursor;
     38      if (!strcmp (name, "Control_L")) goto skip_cursor;
     39      if (!strcmp (name, "Control_R")) goto skip_cursor;
     40      if (!strcmp (name, "Alt_L")) goto skip_cursor;
     41      if (!strcmp (name, "Alt_R")) goto skip_cursor;
     42      if (!strcmp (name, "Super_L")) goto skip_cursor;
     43      if (!strcmp (name, "Super_R")) goto skip_cursor;
     44      if (!strcmp (name, "Caps_Lock")) goto skip_cursor;
     45      if (!strcmp (name, "Pause")) goto skip_cursor;
     46      if (!strcmp (name, "Continue")) goto skip_cursor;
     47      if (!strcmp (name, "Num_Lock")) goto skip_cursor;
     48      if (!strcmp (name, "Scroll_Lock")) goto skip_cursor;
     49      if (!strcmp (name, "Print")) goto skip_cursor;
     50      if (!strcmp (name, "(null)")) goto skip_cursor;
     51    }
    4952
    5053    Z = -1;
  • trunk/Ohana/src/kapa2/src/PSObjects.c

    r38062 r38153  
    211211 
    212212  /* connect first point to second point */
    213   sxa = sx0 - 0.5*(sx1 - sx0);
     213  sxa = MIN (MAX (sx0 - 0.5*(sx1 - sx0), X0), X1);
    214214  sya = MAX (sy0, Y0);
    215215  DrawLine (sx0, sy0, sxa, sy0);
     
    217217 
    218218  /* draw segment equal distance behind first point and down to x-axis */
    219   sxa = 0.5*(sx0 + sx1);
     219  sxa = MIN (MAX (0.5*(sx0 + sx1), X0), X1);
    220220  DrawLine (sx0, sy0, sxa, sy0);
    221221  DrawLine (sxa, sy0, sxa, sy1);
     
    232232    sx1 = MIN (MAX (sx1, X0), X1);
    233233    sy1 = MAX (MIN (sy1, Y0), Y1);
    234     sxa = 0.5*(sx0 + sx1);
     234    sxa = MIN (MAX (0.5*(sx0 + sx1), X0), X1);
    235235    DrawLine (sx0, sy0, sxa, sy0);
    236236    DrawLine (sxa, sy0, sxa, sy1);
     
    241241 
    242242  /* draw segment equal distance after last point and down to x-axis */
    243   sxa = sx1 + 0.5*(sx1 - sxo);
     243  sxa = MIN (MAX (sx1 + 0.5*(sx1 - sxo), X0), X1);
    244244  sya = MAX (sy1, Y0);
    245245  DrawLine (sx1, sy1, sxa, sy1);
  • trunk/Ohana/src/kapa2/src/SetColormap.c

    r35106 r38153  
    166166    goto store_colors;
    167167  }
     168  /* anuenue */
     169  if (!strcasecmp (name, "anuenue")) {
     170    redRef   = 0.25*MaxValue*scale*4.0; // value at 0.0
     171    greenRef = 0.50*MaxValue*scale*4.0;
     172    blueRef  = 1.33*MaxValue*scale;
     173    for (i = 0; i < (int)(0.50*MaxValue); i++) { 
     174      SETVALUE (graphic[0].cmap[i].green, 0.0, 0, 0xffff); // red is a ramp from 0 to 0xffff
     175      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
     176    }
     177    for (i = (int)(0.50*MaxValue); i < (int)(0.75*MaxValue); i++) { 
     178      SETVALUE (graphic[0].cmap[i].green, 4.0*i*scale - 0x20000, 0, 0xffff); // red is a ramp from 0 to 0xffff
     179      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
     180    }
     181    for (i = (int)(0.75*MaxValue); i < MaxValue; i++) { 
     182      SETVALUE (graphic[0].cmap[i].green, 0xffff, 0, 0xffff); // red is a ramp from 0 to 0xffff
     183      graphic[0].cmap[i].flags = DoRed | DoGreen | DoBlue;
     184    }
     185
     186    for (i = 0; i < (int)(0.25*MaxValue); i++) { 
     187      SETVALUE (graphic[0].cmap[i].red,  4*i*scale, 0, 0xffff);
     188    }
     189    for (i = (int)(0.25*MaxValue); i < (int)(0.50*MaxValue); i++) { 
     190      SETVALUE (graphic[0].cmap[i].red,  0x20000 - 4*i*scale, 0, 0xffff);
     191    }
     192    for (i = (int)(0.50*MaxValue); i < MaxValue; i++) { 
     193      SETVALUE (graphic[0].cmap[i].red,  2*i*scale - 0xffff, 0, 0xffff);
     194    }
     195
     196    for (i = 0; i < (int)(0.50*MaxValue); i++) { 
     197      SETVALUE (graphic[0].cmap[i].blue,  2*i*scale, 0, 0xffff);
     198    }
     199    for (i = (int)(0.50*MaxValue); i < (int)(0.75*MaxValue); i++) { 
     200      SETVALUE (graphic[0].cmap[i].blue,  0x30000 - 4*i*scale, 0, 0xffff);
     201    }
     202    for (i = (int)(0.75*MaxValue); i < MaxValue; i++) { 
     203      SETVALUE (graphic[0].cmap[i].blue,  4*i*scale - 0x30000, 0, 0xffff);
     204    }
     205    goto store_colors;
     206  }
     207
     208  /* anuenue */
     209  if (!strncmp (name, "file:", 5)) {
     210    FILE *f = fopen (&name[5], "r");
     211    if (!f) {
     212      fprintf (stderr, "failed to open colormap file %s\n", &name[5]);
     213      return FALSE;
     214    }
     215    char line[1024];
     216
     217    int lastIndex = 0;
     218    float lastRed = 0.0;
     219    float lastBlue = 0.0;
     220    float lastGreen = 0.0;
     221
     222    float fracIndex, fracRed, fracBlue, fracGreen;
     223
     224    while (scan_line_maxlen (f, line, 1024) != EOF) {
     225      // file contains f R G B : f = 0.0 - 1.0, R,G,B = 0.0 - 1.0
     226      int Nscan = sscanf (line, "%f %f %f %f", &fracIndex, &fracRed, &fracBlue, &fracGreen);
     227      if (Nscan != 4) continue;
     228
     229      int nextIndex = fracIndex * MaxValue;
     230      if (nextIndex <= lastIndex) {
     231        lastRed = fracRed;
     232        lastBlue = fracBlue;
     233        lastGreen = fracGreen;
     234        continue;
     235      }
     236      float dRdI = (fracRed   - lastRed)   / (float) (nextIndex - lastIndex);
     237      float dBdI = (fracBlue  - lastBlue)  / (float) (nextIndex - lastIndex);
     238      float dGdI = (fracGreen - lastGreen) / (float) (nextIndex - lastIndex);
     239      for (i = lastIndex; i < nextIndex; i++) {
     240        float redValue   = 0xffff * (dRdI * (i - lastIndex) + lastRed);
     241        float blueValue  = 0xffff * (dBdI * (i - lastIndex) + lastBlue);
     242        float greenValue = 0xffff * (dGdI * (i - lastIndex) + lastGreen);
     243        SETVALUE (graphic[0].cmap[i].red,   redValue,   0, 0xffff);
     244        SETVALUE (graphic[0].cmap[i].blue,  blueValue,  0, 0xffff);
     245        SETVALUE (graphic[0].cmap[i].green, greenValue, 0, 0xffff);
     246      }
     247      lastRed = fracRed;
     248      lastBlue = fracBlue;
     249      lastGreen = fracGreen;
     250      lastIndex = nextIndex;
     251    }
     252    fclose (f);
     253
     254    if ((int) (MaxValue*fracIndex) < MaxValue) {
     255      float dRdI = (1.0 - lastRed)   / (float) (MaxValue - lastIndex);
     256      float dBdI = (1.0 - lastBlue)  / (float) (MaxValue - lastIndex);
     257      float dGdI = (1.0 - lastGreen) / (float) (MaxValue - lastIndex);
     258      for (i = lastIndex; i < MaxValue; i++) {
     259        float redValue   = 0xffff * (dRdI * (i - lastIndex) + lastRed);
     260        float blueValue  = 0xffff * (dBdI * (i - lastIndex) + lastBlue);
     261        float greenValue = 0xffff * (dGdI * (i - lastIndex) + lastGreen);
     262        SETVALUE (graphic[0].cmap[i].red,   redValue,   0, 0xffff);
     263        SETVALUE (graphic[0].cmap[i].blue,  blueValue,  0, 0xffff);
     264        SETVALUE (graphic[0].cmap[i].green, greenValue, 0, 0xffff);
     265      }
     266    }
     267    goto store_colors;
     268  }
     269
    168270  return (FALSE);
    169271
  • trunk/Ohana/src/kapa2/src/bDrawObjects.c

    r38062 r38153  
    198198 
    199199  /* connect first point to second point */
    200   sxa = sx0 - 0.5*(sx1 - sx0);
     200  sxa = MIN (MAX (sx0 - 0.5*(sx1 - sx0), X0), X1);
    201201  sya = MAX (sy0, Y0);
    202202  DrawLine (buffer, sx0, sy0, sxa, sy0);
     
    204204 
    205205  /* draw segment equal distance behind first point and down to x-axis */
    206   sxa = 0.5*(sx0 + sx1);
     206  sxa = MIN (MAX (0.5*(sx0 + sx1), X0), X1);
    207207  DrawLine (buffer, sx0, sy0, sxa, sy0);
    208208  DrawLine (buffer, sxa, sy0, sxa, sy1);
     
    219219    sx1 = MIN (MAX (sx1, X0), X1);
    220220    sy1 = MAX (MIN (sy1, Y0), Y1);
    221     sxa = 0.5*(sx0 + sx1);
     221    sxa = MIN (MAX (0.5*(sx0 + sx1), X0), X1);
    222222    DrawLine (buffer, sx0, sy0, sxa, sy0);
    223223    DrawLine (buffer, sxa, sy0, sxa, sy1);
     
    228228 
    229229  /* draw segment equal distance after last point and down to x-axis */
    230   sxa = sx1 + 0.5*(sx1 - sxo);
     230  sxa = MIN (MAX (sx1 + 0.5*(sx1 - sxo), X0), X1);
    231231  sya = MAX (sy1, Y0);
    232232  DrawLine (buffer, sx1, sy1, sxa, sy1);
Note: See TracChangeset for help on using the changeset viewer.