Skip to content

Commit edd9635

Browse files
authored
GUI images (#49)
* update * util changes for gui plot figs, starting binding_polynomial c extension * binding polynomial extension * organization * updates * more changes to binding polynomial * binding polynomial C extension * gui image update * bp.c clean up
1 parent f3a9fd3 commit edd9635

File tree

5 files changed

+23
-15
lines changed

5 files changed

+23
-15
lines changed

docs/source/images/gui_01.png

188 KB
Loading

docs/source/images/gui_02.png

30.7 KB
Loading

pytc/indiv_models/binding_polynomial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,4 @@ def dQ(self):
9393
self._fit_beta_array, self._fit_dH_array, S_conc_corr, self._T_conc, self._T_conc_free,
9494
final_array)
9595

96-
return final_array
96+
return final_array

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@
2929
install_requires=["matplotlib","scipy","numpy","emcee","corner"],
3030
classifiers=['Programming Language :: Python'],
3131
ext_modules=[ext],
32-
include_dirs=numpy.distutils.misc_util.get_numpy_include_dirs())
32+
include_dirs=numpy.distutils.misc_util.get_numpy_include_dirs())

src/binding_polynomial.c

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,17 @@ void *dQ(double *fit_beta_obj, double *fit_dH_obj, double *S_conc_corr, double *
144144

145145
// num and denom arrays
146146
numerator = (double *)malloc(num_shots*sizeof(double));
147+
if (numerator== NULL){
148+
return NULL;
149+
}
147150
for (i = 0; i < num_shots; i++){
148151
numerator[i] = 0.0;
149152
}
150153
denominator = (double *)malloc(num_shots*sizeof(double));
154+
if (denominator == NULL){
155+
return NULL;
156+
}
157+
151158
for (i = 0; i < num_shots; i++){
152159
denominator[i] = 1.0;
153160
}
@@ -211,47 +218,48 @@ void *dQ(double *fit_beta_obj, double *fit_dH_obj, double *S_conc_corr, double *
211218
if (avg_dH == NULL){
212219
return NULL;
213220
}
214-
for (j = 0; j < num_shots; j++){
215-
avg_dH[j] = numerator[j]/denominator[j];
221+
222+
for (i = 0; i < num_shots; i++){
223+
avg_dH[i] = numerator[i]/denominator[i];
216224
}
217225
// avg_dh[1:]
218226
subset_first_dH = (double *)malloc(num_shots_reduced*sizeof(double));
219227
if (subset_first_dH == NULL){
220228
return NULL;
221229
}
222-
for(j = 0; j < num_shots_reduced; j++){
223-
subset_first_dH[j] = avg_dH[j+1];
230+
for(i = 0; i < num_shots_reduced; i++){
231+
subset_first_dH[i] = avg_dH[i+1];
224232
}
225233

226234
// avg_dh[:-1]
227235
subset_last_dH = (double *)malloc(num_shots_reduced*sizeof(double));
228236
if (subset_last_dH == NULL){
229237
return NULL;
230238
}
231-
for(j = 0; j < num_shots_reduced; j++){
232-
subset_last_dH[j] = avg_dH[j];
239+
for(i = 0; i < num_shots_reduced; i++){
240+
subset_last_dH[i] = avg_dH[i];
233241
}
234242

235243
// avg_dh[1:]-avg_dh[:-1];
236244
X = (double *)malloc(num_shots_reduced*sizeof(double));
237245
if (X == NULL){
238246
return NULL;
239247
}
240-
for (j = 0; j < num_shots_reduced; j++){
241-
X[j] = subset_first_dH[j] - subset_last_dH[j];
248+
for (i = 0; i < num_shots_reduced; i++){
249+
X[i] = subset_first_dH[i] - subset_last_dH[i];
242250
}
243251

244252
// S_conc_corr[1:]
245253
subset_s_conc = (double *)malloc(num_shots_reduced*sizeof(double));
246254
if (subset_s_conc == NULL){
247255
return NULL;
248256
}
249-
for(j = 0; j < num_shots_reduced; j++){
250-
subset_s_conc[j] = S_conc_corr[j+1];
257+
for(i = 0; i < num_shots_reduced; i++){
258+
subset_s_conc[i] = S_conc_corr[i+1];
251259
}
252260

253-
for(j = 0; j < num_shots_reduced; j++){
254-
final_array[j] = cell_volume*subset_s_conc[j]*X[j] + dilution_heats[j];
261+
for(i = 0; i < num_shots_reduced; i++){
262+
final_array[i] = cell_volume*subset_s_conc[i]*X[i] + dilution_heats[i];
255263
}
256264

257265
// clean up
@@ -263,4 +271,4 @@ void *dQ(double *fit_beta_obj, double *fit_dH_obj, double *S_conc_corr, double *
263271
free(subset_s_conc);
264272
free(numerator);
265273
free(denominator);
266-
}
274+
}

0 commit comments

Comments
 (0)