Skip to content

Commit

Permalink
smurf: Removed unneccessary sort from fts2 init; added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Sherwood committed Jan 2, 2013
1 parent 5df5283 commit 8aaa7c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
4 changes: 4 additions & 0 deletions applications/smurf/libsc2fts/fts2_validatemirrorpositions.c
Expand Up @@ -32,6 +32,10 @@
* Original version.
* 2012-12-12 (MSHERWOOD):
* Removed temporary testing code.
* 2012-12-21 (MSHERWOOD)
* Changed validation logic to trim non-uniform data from ends
* while adapting to mirror speed.
* Also reverse mirror position array in case of opposite scan direction.
* Copyright:
* Copyright (C) 2010 Science and Technology Facilities Council.
Expand Down
15 changes: 2 additions & 13 deletions applications/smurf/libsmurf/smurf_fts2_init.c
Expand Up @@ -43,6 +43,8 @@
* - Removed redundancies
* 2012-12-12 (MSHERWOOD):
* Put back adjustment for non-centered mirror starting position.
* 2012-12-21 (MSHERWOOD)
* Removed unneccessary sort (fts2_validatemirrorpositions now reverses list when needed)
*
* Copyright:
* Copyright (C) 2008 Science and Technology Facilities Council.
Expand Down Expand Up @@ -211,19 +213,6 @@ void smurf_fts2_init(int* status)
Transform mirror positions from [0, 450] to [-225, 225] */
for(k = 0; k < nFrames; k++) { MIRPOS[k] -= STAGE_CENTER; }

/* Sort mirror positions if necessary */
if(MIRPOS[nStart] > MIRPOS[nStart + 1]) {
SORTINFO = NULL;
SORTINFO = astCalloc(nFrames, sizeof(*SORTINFO));
for(k = 0; k < nFrames; k++) {
SORTINFO[k].index = i;
SORTINFO[k].sortval = MIRPOS[k];
}
qsort(SORTINFO, nFrames, sizeof(*SORTINFO), smf_sort_bydouble);
for(k = 0; k < nFrames; k++) { MIRPOS[k] = SORTINFO[k].sortval; }
if(SORTINFO){ SORTINFO = astFree(SORTINFO); }
}

/* The number of mirror positions with unique values */
nMirPos = nStop - nStart + 1;

Expand Down

0 comments on commit 8aaa7c0

Please sign in to comment.