Skip to content

Commit

Permalink
GUI images (#49)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
hrmyd authored May 26, 2017
1 parent f3a9fd3 commit edd9635
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 15 deletions.
Binary file modified docs/source/images/gui_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/images/gui_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion pytc/indiv_models/binding_polynomial.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ def dQ(self):
self._fit_beta_array, self._fit_dH_array, S_conc_corr, self._T_conc, self._T_conc_free,
final_array)

return final_array
return final_array
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@
install_requires=["matplotlib","scipy","numpy","emcee","corner"],
classifiers=['Programming Language :: Python'],
ext_modules=[ext],
include_dirs=numpy.distutils.misc_util.get_numpy_include_dirs())
include_dirs=numpy.distutils.misc_util.get_numpy_include_dirs())
34 changes: 21 additions & 13 deletions src/binding_polynomial.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,17 @@ void *dQ(double *fit_beta_obj, double *fit_dH_obj, double *S_conc_corr, double *

// num and denom arrays
numerator = (double *)malloc(num_shots*sizeof(double));
if (numerator== NULL){
return NULL;
}
for (i = 0; i < num_shots; i++){
numerator[i] = 0.0;
}
denominator = (double *)malloc(num_shots*sizeof(double));
if (denominator == NULL){
return NULL;
}

for (i = 0; i < num_shots; i++){
denominator[i] = 1.0;
}
Expand Down Expand Up @@ -211,47 +218,48 @@ void *dQ(double *fit_beta_obj, double *fit_dH_obj, double *S_conc_corr, double *
if (avg_dH == NULL){
return NULL;
}
for (j = 0; j < num_shots; j++){
avg_dH[j] = numerator[j]/denominator[j];

for (i = 0; i < num_shots; i++){
avg_dH[i] = numerator[i]/denominator[i];
}
// avg_dh[1:]
subset_first_dH = (double *)malloc(num_shots_reduced*sizeof(double));
if (subset_first_dH == NULL){
return NULL;
}
for(j = 0; j < num_shots_reduced; j++){
subset_first_dH[j] = avg_dH[j+1];
for(i = 0; i < num_shots_reduced; i++){
subset_first_dH[i] = avg_dH[i+1];
}

// avg_dh[:-1]
subset_last_dH = (double *)malloc(num_shots_reduced*sizeof(double));
if (subset_last_dH == NULL){
return NULL;
}
for(j = 0; j < num_shots_reduced; j++){
subset_last_dH[j] = avg_dH[j];
for(i = 0; i < num_shots_reduced; i++){
subset_last_dH[i] = avg_dH[i];
}

// avg_dh[1:]-avg_dh[:-1];
X = (double *)malloc(num_shots_reduced*sizeof(double));
if (X == NULL){
return NULL;
}
for (j = 0; j < num_shots_reduced; j++){
X[j] = subset_first_dH[j] - subset_last_dH[j];
for (i = 0; i < num_shots_reduced; i++){
X[i] = subset_first_dH[i] - subset_last_dH[i];
}

// S_conc_corr[1:]
subset_s_conc = (double *)malloc(num_shots_reduced*sizeof(double));
if (subset_s_conc == NULL){
return NULL;
}
for(j = 0; j < num_shots_reduced; j++){
subset_s_conc[j] = S_conc_corr[j+1];
for(i = 0; i < num_shots_reduced; i++){
subset_s_conc[i] = S_conc_corr[i+1];
}

for(j = 0; j < num_shots_reduced; j++){
final_array[j] = cell_volume*subset_s_conc[j]*X[j] + dilution_heats[j];
for(i = 0; i < num_shots_reduced; i++){
final_array[i] = cell_volume*subset_s_conc[i]*X[i] + dilution_heats[i];
}

// clean up
Expand All @@ -263,4 +271,4 @@ void *dQ(double *fit_beta_obj, double *fit_dH_obj, double *S_conc_corr, double *
free(subset_s_conc);
free(numerator);
free(denominator);
}
}

0 comments on commit edd9635

Please sign in to comment.