static gboolean on_key_release (ClutterActor *actor, ClutterEvent *event, gpointer data) { GFreenectDevice *kinect; gdouble angle; guint key; g_return_val_if_fail (event != NULL, FALSE); kinect = GFREENECT_DEVICE (data); key = clutter_event_get_key_symbol (event); switch (key) { case CLUTTER_KEY_space: SHOW_SKELETON = !SHOW_SKELETON; break; case CLUTTER_KEY_plus: set_threshold (100); break; case CLUTTER_KEY_minus: set_threshold (-100); break; case CLUTTER_KEY_Up: set_tilt_angle (kinect, 5); break; case CLUTTER_KEY_Down: set_tilt_angle (kinect, -5); break; } set_info_text (); return TRUE; }
static ssize_t store_volt_thres(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { unsigned long volt; int pos, ret; struct sensor_device_attribute_2 *s_attr = to_sensor_dev_attr_2(attr); if (kstrtoul(buf, 10, &volt)) return -EINVAL; pos = find_threshold(volt_thresholds, volt); if (pos < 0) return -EINVAL; /* * The voltage thresholds are in descending order in VWARN*_CFG * registers. So calculate 'pos' by substracting from NUM_THRESHOLDS. */ pos = NUM_THRESHOLDS - pos - 1; /* * Since VWARN*_CFG are consecutive registers, calculate the * required register address using s_attr->nr. */ ret = set_threshold(VWARN1_CFG + s_attr->nr, pos); return ret ? ret : count; }
void SerialMager::setThreshold(int threshold) { if (m_IsCom) { set_threshold(threshold); } }
static ssize_t proximity_adjustment_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { unsigned long val = simple_strtoul(buf, NULL, 10); int avel; avel =(int)val; set_threshold(avel); return size; }
static int sm_metadata_register_threshold_callback(struct dm_space_map *sm, dm_block_t threshold, dm_sm_threshold_fn fn, void *context) { struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm); set_threshold(&smm->threshold, threshold, fn, context); return 0; }
// //////////////////////////////////////////////////////////////////////////// // CamShiftTracker::CamShiftTracker() // // Constructor. // // //////////////////////////////////////////////////////////////////////////// CamShiftTracker::CamShiftTracker(IUnknown *outer, HRESULT *phr) : CUnknown(NAME("CamShift Tracker"), outer) { // set up default tracking params int dims[] = { 20 }; set_hist_dims( 1, dims ); set_hist_bin_range( 0, 1, 180 ); set_threshold( 0 ); set_min_ch_val( 1, 20 ); // S MIN set_max_ch_val( 1, 255 ); // S MAX set_min_ch_val( 2, 40 ); // V MIN set_max_ch_val( 2, 240 ); // V MAX Calibrate(); }
/* ARGSUSED */ gint ggv_histogram_motion_cb (GtkWidget *w, GdkEventMotion *xmotion, PluginInstance *inst) { ggobid *gg = inst->gg; ggvisd *ggv = ggvisFromInst (inst); dissimd *D = ggv->dissim; GtkWidget *da = D->da; gint xmin = HISTOGRAM_HMARGIN; gint xmax = da->allocation.width - HISTOGRAM_HMARGIN; gint min_grip_pos = xmin - HISTOGRAM_HMARGIN/2; gint max_grip_pos = xmax + HISTOGRAM_HMARGIN/2; gint x, y; GdkModifierType state; gboolean buttondown = false; gdk_window_get_pointer (w->window, &x, &y, &state); if ((state & GDK_BUTTON1_MASK) == GDK_BUTTON1_MASK) buttondown = true; else if ((state & GDK_BUTTON2_MASK) == GDK_BUTTON2_MASK) buttondown = true; else if ((state & GDK_BUTTON3_MASK) == GDK_BUTTON3_MASK) buttondown = true; if (!buttondown) return false; if (D->lgrip_down && x + HISTOGRAM_GRIP_WIDTH < D->rgrip_pos && x >= min_grip_pos) { D->lgrip_pos = x; } else if (D->rgrip_down && x > D->lgrip_pos + HISTOGRAM_GRIP_WIDTH && x <= max_grip_pos) { D->rgrip_pos = x; } set_threshold (ggv); histogram_draw (ggv, gg); return true; }
/** Constructor. * @param scanlines list of scanline models (Does only work with ScanlineGrid) * @param q Qualifier for a single pixel (The qualifier gets deleted by this class) * @param threshold minimum rise required for classification * @param max_size of an object to be detected (if 0 value will be ignored) * @param use_rising_flank * if true the classification can start on a rising flank * @param use_falling_flank * if true the classification can start on a falling flank */ GradientClassifier::GradientClassifier(std::list<ScanlineGrid *> *scanlines, Qualifier * q, unsigned int threshold, unsigned int max_size, bool use_rising_flank, bool use_falling_flank) : Classifier("GradientClassifier") { if (!scanlines) throw fawkes::NullPointerException("GradientClassifier: scanlines may not be null!"); if (!q) throw fawkes::NullPointerException("GradientClassifier: the Qualifier may not be null!"); _scanlines = scanlines; _q = q; _max_size = 999999; //Infinite... set_threshold(threshold, max_size); set_edges(use_rising_flank, use_falling_flank); }
static int set_screen_update_type(screen_update_t screen_update) { int val; switch(screen_update) { case SCREEN_UPDATE_FULL: val = 5; break; case SCREEN_UPDATE_ADAPTIVE: val = 90; break; case SCREEN_UPDATE_PARTIAL: val = 100; break; default: errno = EINVAL; return -1; } return set_threshold(SCREEN_UPDATE_CONTROL_FILE, val); }
static ssize_t store_curr_thres(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { unsigned long curnt; int pos, ret; struct sensor_device_attribute_2 *s_attr = to_sensor_dev_attr_2(attr); if (kstrtoul(buf, 10, &curnt)) return -EINVAL; pos = find_threshold(curr_thresholds, curnt); if (pos < 0) return -EINVAL; /* * Since VCC_CFG and VNN_CFG are consecutive registers, calculate the * required register address using s_attr->nr. */ ret = set_threshold(MAXVCC_CFG + s_attr->nr, pos); return ret ? ret : count; }
//input first the fasta file, then the sample_1000.out file run on the fasta, then options int main(int argc, char *argv[]) { int i, h, minh,p; HASHTBL *deleteHash; FILE *fp; Set *set; Options *opt; if (argc < 3) { fprintf(stderr,"Not enough arguments\n"); exit(EXIT_FAILURE); } set = make_Set(argv[2]); opt = set->opt; for (i = 3; i < argc; i++) { //printf("argv[%d] is %s\n",i,argv[i]); if (!strcmp(argv[i],"-h")) { if ((i + 1 <= argc - 1) && sscanf(argv[i+1],"%f",&(opt->HC_FREQ))) { opt->HC_FREQ = atof(argv[i+1]); if (opt->HC_FREQ < 0 || opt->HC_FREQ > 100) { fprintf(stderr,"Error: invalid input %f for frequency threshold\n",opt->HC_FREQ); opt->HC_FREQ = 0; } i++; } } else if (!strcmp(argv[i],"-p")) { if ((i + 1 <= argc - 1) && sscanf(argv[i+1],"%f",&(opt->PROF_FREQ))) { opt->PROF_FREQ = atof(argv[i+1]); if (opt->PROF_FREQ < 0 || opt->PROF_FREQ > 100) { fprintf(stderr,"Error: invalid input %f for frequency threshold\n",opt->PROF_FREQ); opt->PROF_FREQ = 0; } i++; } } else if (!strcmp(argv[i],"-c")) { if ((i + 1 <= argc - 1) && sscanf(argv[i+1],"%f",&(opt->COVERAGE))) { opt->COVERAGE = atof(argv[i+1]); i++; } } else if (!strcmp(argv[i],"-f")) { if ((i + 1 <= argc - 1) && sscanf(argv[i+1],"%d",&(opt->NUM_FHC))) { opt->NUM_FHC = atoi(argv[i+1]); i++; } } else if (!strcmp(argv[i],"-s")) { if ((i + 1 <= argc - 1) && sscanf(argv[i+1],"%d",&(opt->NUM_SPROF))) { opt->NUM_SPROF = atoi(argv[i+1]); i++; } } else if (!strcmp(argv[i],"-l")) { if ((i + 1 <= argc - 1) && sscanf(argv[i+1],"%d",&(opt->MIN_HEL_LEN))) { opt->MIN_HEL_LEN = atoi(argv[i+1]); i++; } } else if (!strcmp(argv[i],"-u")) { if ((i + 1 <= argc - 1) && sscanf(argv[i+1],"%d",&(opt->NUMSTRUCTS))) { opt->NUMSTRUCTS = atoi(argv[i+1]); i++; } } else if (!strcmp(argv[i],"-m")) { if (i + 1 <= argc - 1) { opt->PNOISE = atoi(argv[i+1]); i++; } } else if (!strcmp(argv[i],"-o")) { if (i + 1 <= argc - 1) { opt->OUTPUT = argv[i+1]; i++; } } else if (!strcmp(argv[i],"-i")) { if (i + 1 <= argc - 1) { opt->INPUT = argv[i+1]; i++; } } else if (!strcmp(argv[i],"-n")) { if (i + 1 <= argc - 1) { opt->NATIVE = argv[i+1]; i++; } } else if (!strcmp(argv[i],"-k")) { if (i + 1 <= argc - 1) { opt->CYCLES = argv[i+1]; i++; } } else if (!strcmp(argv[i],"-v")) opt->VERBOSE = 1; else if (!strcmp(argv[i],"-g")) opt->GRAPH = 0; else if (!strcmp(argv[i],"-r")) opt->REP_STRUCT = 1; else if (!strcmp(argv[i],"-t")) opt->TOPDOWN = 1; else if (!strcmp(argv[i],"-a")) opt->ALTTHRESH = 0; } input_seq(set,argv[1]); process_structs(set); reorder_helices(set); minh = print_all_helices(set); printf("Total number of helix classes: %d\n",set->hc_num); if (set->opt->TOPDOWN) { printf("Total number of extended profiles: %d\n",set->prof_num); h = top_down_h(set,minh); //if (set->opt->VERBOSE) printf("Number of featured helix classes: %d\n",h+1); find_freq(set); p = top_down_p(set,h); //if (set->opt->VERBOSE) printf("Number of selected profiles: %d\n",p+1); print_topdown_prof(set,h,p); } else { if (set->opt->NUM_FHC) set->opt->HC_FREQ = set_num_fhc(set); else if (set->opt->HC_FREQ==0) set->opt->HC_FREQ = set_threshold(set,H_START); if (set->opt->VERBOSE) { printf("Threshold to find frequent helices: %.1f\%\n",set->opt->HC_FREQ); printf("Number of structures processed: %d\n",set->opt->NUMSTRUCTS); } find_freq(set); printf("Total number of featured helix classes: %d\n",set->num_fhc); make_profiles(set); printf("Total number of profiles: %d\n",set->prof_num); print_profiles(set); if (set->opt->NUM_SPROF) set->opt->PROF_FREQ = set_num_sprof(set); else if (set->opt->PROF_FREQ == 0) { set->opt->PROF_FREQ = set_p_threshold(set,P_START); } if (set->opt->VERBOSE) printf("setting p to %.1f\n",set->opt->PROF_FREQ); select_profiles(set); printf("Total number of selected profiles: %d\n",set->num_sprof); }
static long isl29028_misc_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { void __user *argp = (void __user *)arg; struct isl29028_data *data = file->private_data; int i =0,avel = 0,ret = 0; u8 val = 0, adj_data[NUM]; int proximity_max = PROXIMITY_MAX; unsigned int current_proximity = 0; switch(cmd) { case IOCTL_GET_ADJUSEMENT: #ifdef ADJ_DBG printk("---------->wcx:IOCTL_GET_ADJUSEMENT\n"); #endif if(isl29028_prox_220ma(data->client)){ printk("---------->prox_220ma set failed!\n"); } msleep(1000); for(i = 0; i < NUM; i++){ if(isl29028_prox_read(data->client, &val)){ printk("---------->wcx Read p-sensor data failed!\n"); return -EFAULT; } adj_data[i] = val; msleep(100); } avel = get_avel(adj_data,NUM); if(avel>PROXIMITY_MAX){ if(isl29028_prox_110ma(data->client)){ printk("---------->prox_110ma set failed!\n"); } msleep(1000); for(i = 0; i < NUM; i++){ if(isl29028_prox_read(data->client, &val)){ printk("---------->wcx Read p-sensor data failed!\n"); return -EFAULT; } adj_data[i] = val; msleep(100); } avel = get_avel(adj_data,NUM); current_proximity |=CURRENT_100MA; }else{ current_proximity |=CURRENT_200MA; } current_proximity |=avel; if (copy_to_user(argp, ¤t_proximity, sizeof(current_proximity))){ printk("---------->wcx copy_to_user failed!"); return -EFAULT; } break; case IOCTL_SET_ADJUSEMENT: if (copy_from_user(¤t_proximity, argp, sizeof(current_proximity))) return -EFAULT; avel = (current_proximity&0xff); #ifdef ADJ_DBG printk("---------->wcx:IOCTL_SET_ADJUSEMENT: avel =%d current_proximity=%d \n",avel,current_proximity); #endif if((current_proximity&CURRENT_100MA)== CURRENT_100MA){ ret|= isl29028_prox_110ma(data->client); printk(KERN_ERR "----open mobil to set 100 ma\r\n"); }else if((current_proximity&CURRENT_200MA)==CURRENT_200MA){ ret|= isl29028_prox_220ma(data->client); printk(KERN_ERR "----open mobil to set 200 ma\r\n"); }else{ ret|= isl29028_prox_110ma(data->client); printk(KERN_ERR "----open mobil to set current is not be supported current_proximity \r\n"); return -EFAULT; } set_threshold(avel); break; case IOCTL_GET_PROXIMITY_MAX: #ifdef ADJ_DBG printk("ty_sensor: IOCTL_GET_PROXIMITY_MAX\n"); #endif if(copy_to_user(argp,&proximity_max,sizeof(proximity_max))){ printk("ty_sensor:proximity_max copy failed\n"); return -EFAULT; } break; default: PR_DEB("ioctl invalid argument!\n"); return -EINVAL; } return 0; }
//! set parameter void sci_bert::set(int param, var* p_v) { ivec iv; int i; var_vec *p_var_vec; var_ivec *p_var_ivec; p_var_vec = NULL; p_var_ivec = NULL; // p_v might be either var_vec, var_ivec or var_bvec p_var_vec = dynamic_cast<var_vec *> (p_v); if (p_var_vec == NULL) { p_var_ivec = dynamic_cast<var_ivec *> (p_v); if (p_var_ivec == NULL) { throw sci_exception ("sci_bert::set - p_v - bad cast"); } } switch (param) { case SCI_SIZE: // size or correlators lsrx,lsry case SCI_LENGTH: if (p_var_vec) { i = (int)(p_var_vec->v[0]); } else if (p_var_ivec) { i = p_var_ivec->v[0]; } else { throw sci_exception ("sci_bert::set - SCI_LENGTH - v - bad cast"); } set_length(i); break; case SCI_SYMBOL_SIZE: if (p_var_vec) { i = (int)(p_var_vec->v[0]); } else if (p_var_ivec) { i = p_var_ivec->v[0]; } else { throw sci_exception ("sci_bert::set - SCI_SYMBOL_SIZE - v - bad cast"); } set_symbol_size(i); break; case SCI_PRBS: if (p_var_vec) { i = (int)(p_var_vec->v[0]); } else if (p_var_ivec) { i = p_var_ivec->v[0]; } else { throw sci_exception ("sci_bert::set - SCI_PRBS - v - bad cast"); } set_prbs(i); break; case SCI_THRESHOLD: if (p_var_vec) { iv = to_ivec(p_var_vec->v); } else if (p_var_ivec) { iv = p_var_ivec->v; } else { throw sci_exception ("sci_bert::set - SCI_THRESHOLD - v - bad cast"); } set_threshold( iv ); break; case SCI_FSM: if (p_var_vec) { i = (int)p_var_vec->v[0]; } else if (p_var_ivec) { i = p_var_ivec->v[0]; } else { throw sci_exception ("sci_bert::set - SCI_FSM - v - bad cast"); } set_fsm((bert_state)i); break; case SCI_ADR: if (p_var_vec) { i = (int)p_var_vec->v[0]; } else if (p_var_ivec) { i = p_var_ivec->v[0]; } else { throw sci_exception ("sci_bert::set - SCI_ADR - v - bad cast"); } set_adr((bert_adr)i); break; case SCI_OUTPUT: if (p_var_vec) { i = (int)p_var_vec->v[0]; } else if (p_var_ivec) { i = p_var_ivec->v[0]; } else { throw sci_exception ("sci_bert::set - SCI_OUTPUT - v - bad cast"); } set_output((bert_state)i); break; default: throw sci_exception ("sci_bert::set - unknown param", param); } return; };
//input first the fasta file, then the sample_1000.out file run on the fasta, then options int main(int argc, char *argv[]) { int i,COVERAGE = 50; HASHTBL *deleteHash; FILE *fp; Set *set; Options *opt; if (argc < 3) { fprintf(stderr,"Not enough arguments\n"); exit(EXIT_FAILURE); } set = make_Set(argv[2]); opt = set->opt; for (i = 3; i < argc; i++) { //printf("argv[%d] is %s\n",i,argv[i]); if (!strcmp(argv[i],"-h")) { if ((i + 1 <= argc - 1) && sscanf(argv[i+1],"%f",&(opt->HC_FREQ))) { opt->HC_FREQ = atof(argv[i+1]); if (opt->HC_FREQ < 0 || opt->HC_FREQ > 100) { fprintf(stderr,"Error: invalid input %f for frequency threshold\n",opt->HC_FREQ); opt->HC_FREQ = 0; } i++; } } else if (!strcmp(argv[i],"-p")) { if ((i + 1 <= argc - 1) && sscanf(argv[i+1],"%f",&(opt->PROF_FREQ))) { opt->PROF_FREQ = atof(argv[i+1]); if (opt->PROF_FREQ < 0 || opt->PROF_FREQ > 100) { fprintf(stderr,"Error: invalid input %f for frequency threshold\n",opt->PROF_FREQ); opt->PROF_FREQ = 0; } i++; } } else if (!strcmp(argv[i],"-l")) { if ((i + 1 <= argc - 1) && sscanf(argv[i+1],"%d",&(opt->MIN_HEL_LEN))) { opt->MIN_HEL_LEN = atoi(argv[i+1]); i++; } } else if (!strcmp(argv[i],"-s")) { if ((i + 1 <= argc - 1) && sscanf(argv[i+1],"%d",&(opt->NUMSTRUCTS))) { opt->NUMSTRUCTS = atoi(argv[i+1]); i++; } } else if (!strcmp(argv[i],"-o")) { if (i + 1 <= argc - 1) { opt->OUTPUT = argv[i+1]; i++; } } else if (!strcmp(argv[i],"-i")) { if (i + 1 <= argc - 1) { opt->INPUT = argv[i+1]; i++; } } else if (!strcmp(argv[i],"-n")) { if (i + 1 <= argc - 1) { opt->NATIVE = argv[i+1]; i++; } } else if (!strcmp(argv[i],"-v")) opt->VERBOSE = 1; else if (!strcmp(argv[i],"-g")) opt->GRAPH = 0; else if (!strcmp(argv[i],"-r")) opt->REP_STRUCT = 1; } input_seq(set,argv[1]); process_structs(set); reorder_helices(set); if (set->opt->HC_FREQ==0) set->opt->HC_FREQ = set_threshold(set,H_START); if (set->opt->VERBOSE) { printf("Threshold to find frequent helices: %.1f\%\n",set->opt->HC_FREQ); printf("Number of structures processed: %d\n",set->opt->NUMSTRUCTS); }