Skip to content

Commit e6d211c

Browse files
committed
C: Remove outdated comment and trailing whitespace
1 parent ad4bc35 commit e6d211c

File tree

1 file changed

+27
-39
lines changed

1 file changed

+27
-39
lines changed

src/stcal/ramp_fitting/src/slope_fitter.c

Lines changed: 27 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,11 @@
1414
#include <numpy/arrayobject.h>
1515
#include <numpy/npy_math.h>
1616

17-
18-
/*
19-
To build C code, make sure the setup.py file is correct and
20-
lists all extensions, then run:
21-
22-
python setup.py build_ext --inplace
23-
24-
or
25-
26-
pip install -e .
27-
*/
28-
2917
/* ========================================================================= */
3018
/* TYPEDEFs */
3119
/* ------------------------------------------------------------------------- */
3220

33-
/*
21+
/*
3422
* Toggle internal arrays from float to doubles. The REAL_IS_DOUBLE is used
3523
* for preprocessor switches in the code. If a developer prefers to use a
3624
* float for internal arrays, this macro can be set to zero to switch from
@@ -61,7 +49,7 @@ static pid_t g_pid;
6149
char g_log_name[PATH_MAX];
6250
FILE * g_log = NULL;
6351

64-
/*
52+
/*
6553
* Deals with invalid data. This is one of the ways the python code dealt with
6654
* the limitations of numpy that aren't necessary in this code. The LARGE_VARIANCE
6755
* variable has been removed from use in this code, but due to some strange,
@@ -91,7 +79,7 @@ const real_t LARGE_VARIANCE_THRESHOLD = 1.e6;
9179
#define SET_FREE(X) if (X) {free(X); (X) = NULL;}
9280
#define FCLOSE(FD) if (FD) {fclose(FD); (FD) = NULL;}
9381

94-
/*
82+
/*
9583
* Wraps the clean_ramp_data function. Ensure all allocated
9684
* memory gets deallocated properly for the ramp_data data
9785
* structure, as well as the allocation allocation for the
@@ -104,7 +92,7 @@ const real_t LARGE_VARIANCE_THRESHOLD = 1.e6;
10492
(RD) = NULL; \
10593
}
10694

107-
/*
95+
/*
10896
* Wraps the clean_pixel_ramp function. Ensure all allocated
10997
* memory gets deallocated properly for the pixel_ramp data
11098
* structure, as well as the allocation allocation for the
@@ -116,7 +104,7 @@ const real_t LARGE_VARIANCE_THRESHOLD = 1.e6;
116104
SET_FREE(PR); \
117105
}
118106

119-
/*
107+
/*
120108
* Wraps the clean_segment_list function. Ensure all allocated
121109
* memory gets deallocated properly for the segment_list data
122110
* structure, as well as the allocation allocation for the
@@ -209,13 +197,13 @@ struct ramp_data {
209197
int special2; /* Count of segments of length 2 */
210198

211199
/*
212-
* Group and Pixel flags:
200+
* Group and Pixel flags:
213201
* DO_NOT USE, JUMP_DET, SATURATED, NO_GAIN_VALUE, UNRELIABLE_SLOPE,
214202
* CHARGELOSS, and a user defined "invalid" flag.
215203
*/
216204
uint32_t dnu, jump, sat, ngval, uslope, chargeloss, invalid;
217205

218-
/*
206+
/*
219207
* This is used only if the save_opt is non-zero, i.e., the option to
220208
* save the optional results product must be turned on.
221209
*
@@ -752,7 +740,7 @@ print_segment_opt_res(
752740
npy_intp integ, int segnum, int line);
753741

754742
static void
755-
print_stats(struct pixel_ramp * pr, npy_intp integ, int line);
743+
print_stats(struct pixel_ramp * pr, npy_intp integ, int line);
756744

757745
static void
758746
print_uint8_array(uint8_t * arr, int len, int ret, int line);
@@ -798,7 +786,7 @@ print_delim_char(char c, int len) {
798786
printf("\n");
799787
}
800788

801-
/*
789+
/*
802790
* Used to determine if a pixel is in a list.
803791
* This is a debugging function.
804792
*/
@@ -861,13 +849,13 @@ print_pid_info(long long prev, int line, char * label) {
861849
* checkers in place such that the logger is simply ignored. Maybe a more intelligent
862850
* system should be put in place to create a logger directory, but for now this
863851
* suffices.
864-
*
852+
*
865853
* I created this to debug multirpocessing. The logger captures process information
866854
* into separate logs, so any failures can be determined on a per process bases.
867855
* Redirection from the command line behaves unexpectedly when multiple processes print
868856
* to the terminal and copy and pasting from the terminal is lacking due to the amount
869857
* of data that possibly needs to be copied.
870-
*
858+
*
871859
* Each process has its own log and each log has a timestamp, so if you have successive
872860
* runs, each can be separated by time, as well as process ID.
873861
*/
@@ -930,7 +918,7 @@ ols_slope_fitter(
930918

931919
/* Allocate, fill, and validate ramp data */
932920
rd = get_ramp_data(args);
933-
if (NULL == rd) {
921+
if (NULL == rd) {
934922
goto ERROR;
935923
}
936924

@@ -1092,7 +1080,7 @@ static void
10921080
clean_pixel_ramp(
10931081
struct pixel_ramp * pr) /* Ramp fitting data for a pixel. */
10941082
{
1095-
npy_intp integ;
1083+
npy_intp integ;
10961084

10971085
if (NULL == pr) {
10981086
return; /* Nothing to do */
@@ -1109,7 +1097,7 @@ clean_pixel_ramp(
11091097

11101098
/* Clean up the allocated memory for the linked lists. */
11111099
FREE_SEGS_LIST(pr->nints, pr->segs);
1112-
1100+
11131101
/* XXX Clean CR list */
11141102
for (integ=0; integ < pr->nints; ++integ) {
11151103
cr_list_clean(&(pr->crs[integ]));
@@ -1223,7 +1211,7 @@ clean_segment_list(
12231211
struct simple_ll_node * current = NULL;
12241212
struct simple_ll_node * next = NULL;
12251213

1226-
/*
1214+
/*
12271215
* Clean each list for each integration. Each integration for
12281216
* each pixel is segmented. For each integration, there is a
12291217
* linked list of segments, so walk the linked lists and free
@@ -2021,7 +2009,7 @@ get_ramp_data(
20212009
err_ols_print("%s\n", msg);
20222010
goto END;
20232011
}
2024-
2012+
20252013
if (get_ramp_data_parse(&Py_ramp_data, rd, args)) {
20262014
FREE_RAMP_DATA(rd);
20272015
goto END;
@@ -2361,7 +2349,7 @@ median_rate_default(
23612349
}
23622350
accum_mrate += mrate;
23632351
}
2364-
2352+
23652353
/* The pixel median rate is the average of the integration median rates. */
23662354
pr->median_rate = accum_mrate /= (float)pr->nints;
23672355

@@ -2447,7 +2435,7 @@ median_rate_integration(
24472435
/* Sort first differences with NaN's based on DQ flags */
24482436
median_rate_integration_sort(loc_integ, int_dq, rd, pr);
24492437

2450-
/*
2438+
/*
24512439
* Get the NaN median using the sorted first differences. Note that the
24522440
* first differences has a length ngroups-1.
24532441
*/
@@ -2610,13 +2598,13 @@ package_results(
26102598
PyObject * opt_res = Py_None;
26112599
PyObject * result = Py_None;
26122600

2613-
image_info = Py_BuildValue("(NNNNN)",
2601+
image_info = Py_BuildValue("(NNNNN)",
26142602
rate->slope, rate->dq, rate->var_poisson, rate->var_rnoise, rate->var_err);
26152603
if (!image_info) {
26162604
goto FAILED_ALLOC;
26172605
}
26182606

2619-
cube_info = Py_BuildValue("(NNNNN)",
2607+
cube_info = Py_BuildValue("(NNNNN)",
26202608
rateints->slope, rateints->dq, rateints->var_poisson, rateints->var_rnoise, rateints->var_err);
26212609
if (!cube_info) {
26222610
goto FAILED_ALLOC;
@@ -2799,7 +2787,7 @@ ramp_fit_pixel(
27992787
ret = 1;
28002788
goto END;
28012789
}
2802-
2790+
28032791
if (pr->rateints[integ].dq & rd->dnu) {
28042792
dnu_cnt++;
28052793
pr->rateints[integ].slope = NAN;
@@ -3005,7 +2993,7 @@ ramp_fit_pixel_integration(
30052993
pr->rateints[integ].dq |= rd->sat;
30062994
}
30072995
return 0;
3008-
}
2996+
}
30092997

30102998
ramp_fit_pixel_integration_fit_slope(rd, pr, integ);
30112999

@@ -3342,7 +3330,7 @@ ramp_fit_pixel_integration_fit_slope_seg_default_weighted(
33423330
real_t power) /* The power of the segment */
33433331
{
33443332
struct ols_calcs ols = {0};
3345-
3333+
33463334
/* Make sure the initial values are zero */
33473335
memset(&ols, 0, sizeof(ols));
33483336
ramp_fit_pixel_integration_fit_slope_seg_default_weighted_ols(
@@ -3369,7 +3357,7 @@ ramp_fit_pixel_integration_fit_slope_seg_default_weighted_ols(
33693357
{
33703358
npy_intp idx, group;
33713359
real_t mid, weight, invrn2, invmid, data, xval, xwt;
3372-
3360+
33733361
/* Find midpoint for weight computation */
33743362
mid = (real_t)(seg->length - 1) / 2.;
33753363
invmid = 1. / mid;
@@ -3878,15 +3866,15 @@ print_segment(
38783866
printf("[%d] - ", line);
38793867
}
38803868
printf("Integration %ld, segment %d, has length %ld.\n", integ, segnum, seg->length);
3881-
3869+
38823870
idx = get_ramp_index(rd, integ, seg->start);
38833871
printf("Science Data\n[%" DBL, pr->data[idx]);
38843872
for (group = seg->start + 1; group < seg->end; ++group) {
38853873
idx = get_ramp_index(rd, integ, group);
38863874
printf(", %" DBL, pr->data[idx]);
38873875
}
38883876
printf("]\n");
3889-
3877+
38903878
idx = get_ramp_index(rd, integ, seg->start);
38913879
printf("Group DQ\n[%02x", pr->groupdq[idx]);
38923880
for (group = seg->start + 1; group < seg->end; ++group) {
@@ -4174,7 +4162,7 @@ print_PyArrayObject_info(PyArrayObject * obj) {
41744162

41754163
printf("flags:\n");
41764164
if (NPY_ARRAY_C_CONTIGUOUS & flags ) {
4177-
printf(" NPY_ARRAY_C_CONTIGUOUS\n");
4165+
printf(" NPY_ARRAY_C_CONTIGUOUS\n");
41784166
}
41794167
if (NPY_ARRAY_F_CONTIGUOUS & flags ) {
41804168
printf(" NPY_ARRAY_F_CONTIGUOUS\n");

0 commit comments

Comments
 (0)