text stringlengths 0 828 |
|---|
false_alarms[-1].append(numpy.count_nonzero(numpy.array(score[2]) >= threshold)) |
# to display 0 in a semilogx plot, we have to add a little |
# false_alarms[-1][-1] += 1e-8 |
# also read baselines |
if args.baselines is not None: |
for baseline in args.baselines: |
dr = [] |
fa = [] |
with open(os.path.join(args.baseline_directory, baseline)) as f: |
for line in f: |
splits = line.rstrip().split() |
dr.append(float(splits[0])) |
fa.append(int(splits[1])) |
false_alarms.append(fa) |
detection_rate.append(dr) |
logger.info(""Plotting FROC curves to file '%s'"", args.output) |
# create a multi-page PDF for the ROC curve |
pdf = PdfPages(args.output) |
figure = _plot_froc(false_alarms, detection_rate, colors, args.legends, args.title, args.max) |
mpl.xlabel('False Alarm (of %d pruned)' % len(scores[0][2])) |
mpl.ylabel('Detection Rate in \%% (total %d faces)' % scores[0][0]) |
pdf.savefig(figure) |
pdf.close() |
if args.count_detections: |
for i, f in enumerate(args.files): |
det, all = count_detections(f) |
print(""The number of detected faces for %s is %d out of %d"" % (args.legends[i], det, all))" |
554,"def priority(var): |
""""""Prioritizes resource position in the final HTML. To be fed into sorted(key=). |
Javascript consoles throw errors if Bootstrap's js file is mentioned before jQuery. Using this function such errors |
can be avoided. Used internally. |
Positional arguments: |
var -- value sent by list.sorted(), which is a value in Statics().all_variables. |
Returns: |
Either a number if sorting is enforced for the value in `var`, or returns `var` itself. |
"""""" |
order = dict(JQUERY='0', BOOTSTRAP='1') |
return order.get(var, var)" |
555,"def get_resources(minify=False): |
""""""Find all resources which subclass ResourceBase. |
Keyword arguments: |
minify -- select minified resources if available. |
Returns: |
Dictionary of available resources. Keys are resource names (part of the config variable names), values are dicts |
with css and js keys, and tuples of resources as values. |
"""""" |
all_resources = dict() |
subclasses = resource_base.ResourceBase.__subclasses__() + resource_definitions.ResourceAngular.__subclasses__() |
for resource in subclasses: |
obj = resource(minify) |
all_resources[resource.RESOURCE_NAME] = dict(css=tuple(obj.resources_css), js=tuple(obj.resources_js)) |
return all_resources" |
556,"def citedby_pid(self, pid, metaonly=False, from_heap=True): |
"""""" |
Retrieve citedby documents from a given PID number. |
pid: SciELO PID number |
metaonly: will retrieve only the metadata of the requested article citations including the number of citations it has received. |
from_heap: will retrieve the number of citations from a preproduced report, it will not fetch the api. Much faster results but not extremely updated. |
"""""" |
if from_heap is True: |
result = citations.raw_data(pid) |
if result and 'cited_by' in result and metaonly is True: |
del(result['cited_by']) |
return result |
if result: |
return result |
url = urljoin(self.CITEDBY_URL, self.PID_ENDPOINT) |
params = { |
""q"": pid, |
""metaonly"": ""true"" if metaonly is True else ""false"" |
} |
result = self._do_request(url, params=params) |
return result" |
557,"def citedby_pid(self, pid, metaonly=False, from_heap=True): |
"""""" |
Retrieve citedby documents from a given PID number. |
pid: SciELO PID number |
metaonly: will retrieve only the metadata of the requested article citations including the number of citations it has received. |
from_heap: will retrieve the number of citations from a preproduced report, it will not fetch the api. Much faster results but not extremelly updated. |
"""""" |
if from_heap is True: |
result = citations.raw_data(pid) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.