MATH70094: Programming for Data Science

光模块封装工艺简介 光模块按照部件可以分为芯片、光器件、光模块三个层级;按照应用领域大概可分为电信应用、数通应用两个领域;按照内部器件的封装工艺可分为TO、Box、COB三大类。 但是,无论是哪种类型的光模块,其生产工艺基本上可以分为封装、测试两大块。   那什么叫做器件封装呢?我的理解器件封装就是利用胶水、焊料、机械、热量等手段把器件按照一定的先后次序结合形成一个整体的过程,就好像早上吃的煎饼,把面粉、鸡蛋、脆饼、烤肠、葱花等这些“器件”,按照一定的顺序,通过食用油、甜面酱、加热、卷起来等手段结合到一起,形成了美味的 阅读详情

Assessment 4 MATH70094: Programming for Data Science Autumn 2024

Assessment 4

This assessment contains two questions that will test your ability to work with files and data in

R and Python, as well as how to create and package your code in these two languages. Question

1 is on R, while Question 2 is on Python. The available marks are indicated in brackets for each

question. Note that this assessment will count 50% towards the final grade for this module. This

assessment will be marked, and feedback will be provided.

Make sure that you carefully read the following sections on Background and Submission Instruc tions.

Background

In this assessment, we want to build a spam classifier to decide for a given message string if it is a

genuine message (ham) that we want to keep, or if it is not a genuine message (spam) that should be

filtered out. A message can be thought of as a random sequence of words, but since we hardly ever

see the same message twice it is common to ignore the word order, and to simply record how many

times each word appears. We therefore represent a message by a random vector X ∈ {0, 1, 2, . . . , }

p

with counts for a vocabulary of p words. The vocabulary stays fixed for all the messages.

Denote by P r(X) the probability of a specific message, let S be the event that X corresponds to

spam and let H be the complementary event that X is ham. From Bayes’ theorem the probability of

X being spam is

P r(S|X) = P r(X|S)P r(S)

P r(X)

.

Here, P r(S) is the prior probability of an arbitrary message being spam, and P r(X|S) is the

probability to see message X given that we know it is spam. Similarly, the probability of X being

ham is

P r(H|X) = P r(X|H)P r(H)

P r(X)

.

If P r(S|X) > P r(H|X), we classify the message X as spam, otherwise as ham.

To simplify the estimation of the probabilities P r(X|S) and P r(X|H) from training data we make

a second simplifying assumption, namely we assume that the probability of any word appearing in a

message is independent of any other word appearing or not. This means

P r(X|S) =

p

Y

j=1

P r(Xj |S), P r(X|H) =

p

Y

j=1

P r(Xj |H),

where Xj is the count of the jth word in the vocabulary. With these assumptions, the classifier is

called Naive Bayes classifier. Despite its simplicity, it works surprisingly well in practice.

Suppose now we have training data represented by a matrix M ∈ {0, 1, 2, . . . }

n×p

containing words

counts for n messages and a vector spam_type ∈ {ham, spam}

n assigning each message to a label

ham or spam. For example, Mij is the number of times word j appears in message i and spam_typei

is its label. By combining the information in M and spam_type we can compute nS and nH, the

1

Assessment 4 MATH70094: Programming for Data Science Autumn 2024

total number of spam and ham messages, nS,j and nH,j the number of times the jth word appears in

spam and ham messages, as well as NS and NH the total number of words in spam and ham messages.

With this we form the estimates

P r(S) ≈

nS

nS + nH

,

P r(H) ≈

nH

nS + nH

,

P r(Xj |S) ≈

nS,j + α

NS + α × (NS + NH)

,

P r(Xj |H) ≈

nH,j + α

NH + α × (NS + NH)

.

The scalar α ∈ (0, 1] helps preventing zero estimates. Note that by applying the logarithm,

P r(S|X) > P r(H|X) is equivalent to

p

X

j=1

log P r(Xj |S) + log P r(S) >

p

X

j=1

log P r(Xj |H) + log P r(H).

To avoid numerical errors when multiplying many near zero numbers in the approximation of the

products Q p

j=1 P r(Xj |S) and Q p

j=1 P r(Xj |H) from the estimates above, it is therefore better to

base the classification on the logarithms of the estimates.

Submission Instructions

Along with this PDF, you are provided with two folders files_train and files_test which

contain within subfolders messages (formed of strings), and two files train.csv and test.csv.

Create files according to the two questions below, and then create one zip file (https://docs.filefor

mat.com/compression/zip/) named CID_PDS_Assessment4.zip with:

• the files train.csv and test.csv,

• a folder corpus, containing your R package files,

• a folder spamfilter, containing your Python package files,

• the corpus_0.0.1.tar.gz file created in Question 1,

• the file process_corpus.R created in Question 1,

• the file filter.py created in Question 2.

This can be visualised as follows:

CID_PDS_Assessment4.zip

|-- train.csv

|-- test.csv

|-- corpus folder

|-- spamfilter folder

|-- corpus_0.0.1.tar.gz

|-- process_corpus.R

|-- filter.py

2

Assessment 4 MATH70094: Programming for Data Science Autumn 2024

Note the following before submitting:

• Do not add the folders files_train and files_test to your zip file.

• Replace CID in CID_PDS_Assessment4.zip by your own college ID number. For

example, if your college ID number is 12345678, then the zip file should be named

12345678_PDS_Assessment4.zip.

• The only external Python and R libraries allowed in this assessment are:

– Python: NumPy, Pandas, unittest,

– R: testthat, R6, stringr, stopwords

You should not load additional (non-base) libraries.

• For Python, provide doc string comments, and for R roxygen2 style comments (as described

in the Blackboard videos of week 9) for every attribute and method you define. You also

should add code comments as usual.

• Please answer in each cell/code block only the corresponding subpart (e.g., only answer Part

D(i) in the cell below the heading Part D(i)). The markers will try, where possible, not to

penalize answers to parts for errors in previous parts. For example, if you cannot do Part D(i),

leave the corresponding cell blank and do Part D(ii) assuming Part D(i) is working.

• You may use code and variables from previous subparts in your answers of a particular part.

• Marks may be deducted if these layout and format instructions are not followed.

Submit the zip file on Blackboard in the Assessment 4 submission tab in the module page. The

deadline is Monday 06 January 2025 at 09:00am, UK time.

Please note Imperial College’s policy on the late submission of assessments. This assessment must

be attempted individually. Your submission must be your own, unaided work. Candidates are

prohibited from discussing assessed coursework, and must abide by Imperial College’s rules. Enabling

other candidates to plagiarise your work constitutes an examination offence. To ensure quality

assurance is maintained, departments may choose to invite a random selection of students to an

‘authenticity interview’ on their submitted assessments.

Question 1 - R (60 marks)

The aim of this question is to build a package for loading and cleaning messages from data.

Some functions that may be useful in this question are:

• gsub, sapply, readLines, Filter,

• str_split from the stringr package,

• stopwords("en") from the stopwords package.

3

Assessment 4 MATH70094: Programming for Data Science Autumn 2024

Code clarity (5 marks)

There is a famous saying among software developers that code is read more often than it is written.

Five marks will be awarded (or not awarded) based on the clarity of the code and appropriate use

of comments.

Part A (25 marks)

Create a script file corpus.R with a R6 class CorpusR6 containing

• private attributes: ham_strings (vector of strings), spam_strings (vector of strings),

• public methods:

– initialize: a function that takes the string name of a source folder as input, reads for

each message file in this folder (and also within subfolders) the contents of the file line

by line, and adds the message text (without the message head) either to spam_strings

or ham_strings depending on if the file name contains the substring "spam" or not.

– clean_messages: a function that modifies all the messages stored in the two private

variables; it proceeds for each message string as follows:

∗ transforms the message string to lower case,

∗ splits the string into words (tokens) separated by arbitrary long whitespace and

creates with these words a vector of strings,

∗ removes from the end of each token any arbitrary sequence of punctuations,

∗ removes any token that belongs to the list of English stopwords obtained from calling

stopwords("en"),

∗ removes from each token any remaning punctuations,

∗ remove all tokens of length less than three,

∗ collapses the vector of tokens into one string, with tokens separated by whitespace.

(We will not make more modifications to the tokens, even though we could.)

– print: a function that prints the CorpusR6 object. For example, when corpus is a

CorpusR6 object formed of 4345 ham messages and 673 spam messages, then we have as

output

> corpus

CorpusR6 object

Number of Ham files: 4345

Number of Spam files: 673

– save_to_csv: a function that takes the name of a target csv file as input and saves to

it a csv file that contains in each line either ham or spam and separated from this by a

comma a message string, either from ham_string or message_string corresponding to

the first column (the format should be as in the provided files train.csv and test.csv).

4

Assessment 4 MATH70094: Programming for Data Science Autumn 2024

In addition to providing these attributes and functions, include appropriate documentation, input

checks (for every argument!) and unit tests, which test all specifications listed above.

Part B (15 marks)

Create a package called corpus which contains the code from Part A and exposes the func tions in Part A to the user. Make sure that devtools::document(), devtools::test() and

devtools::check() do not produce any errors or warnings (notes are OK) when called from within

the folder corpus. The result should be the file corpus_0.0.1.tar.gz, if you have chosen version

number 0.0.1.

Part C (15 marks)

Make sure that the class from Part A is available. Create a script file process_corpus.R which cre ates two CorpusR6 objects corpus_train and corpus_test from the provided folders files_train

and files_test (you should set a path that works for you, the markers will set another one, make

sure these folders are not part of the final zip file!). For the two objects, clean all messages that

were contained in the folders using clean_messages and print the R6 objects to the screen. Finally,

use save_to_csv to save corpus_train to the file train.csv and corpus_test to test.csv.

The two csv files should contain the same entries as the provided files.

Question 2 - Python (90 marks)

The aim of this question is to build a package for spam classification with Naive Bayes using Test

driven development and Defensive Programming, along with an application to a real data set.

Code clarity (5 marks)

There is a famous saying among software developers that code is read more often than it is written.

Five marks will be awarded (or not awarded) based on the clarity of the code and appropriate use

of comments.

Part A (20 marks)

Create a script file utils.py with three functions:

• tokenize: A function that takes a message string as input, splits it into words (tokens) along

whitespace and returns a list with the token strings. There should be no whitespace left

anywhere within the token strings.

5

Assessment 4 MATH70094: Programming for Data Science Autumn 2024

• document_terms: A function that takes a list of word lists each created with tokenize as

input and returns a Document Term Dataframe. This Dataframe has as many rows as there

are word lists in the list, and has as many columns as there are unique words in the word lists.

Each column corresponds to one word, and each entry of the Dataframe counts how many

times a word appears in a document/message (the Dataframe is basically the matrix M from

the Background section).

• compute_word_counts: A function that takes a Document Term Dataframe (created with

document_terms) and a list spam_types of strings (with entries either ham or spam) as inputs,

and returns a 2 × p matrix with counts, where p is the length of the vocabulary, and where

the first row contains the overall counts for words in ham messages and the second row for

spam messages.

In addition to providing these functions, include appropriate documentation, input checks (for every

argument!) and unit tests, which test all specifications listed above.

For example, for the first function we expect the following output:

>>> tokenize(" properly separated text")

['properly', 'separated', 'text']

As an example for the latter two functions, suppose we have the following:

>>> doc1 = ["call", "here", "win", "prize", "money"]

>>> doc2 = ["call", "money", "call", "money", "bargain"]

>>> doc3 = ["call", "here", "information"]

>>> word_lists = [doc1, doc2, doc3]

>>> dtm = document_terms(word_lists)

>>> spam_types = ["spam", "spam", "ham"]

>>> word_counts = compute_word_counts(dtm,spam_types)

In this case, dtm should be

call here win prize money bargain information

1 1 1 1 1 1 0 0

2 2 0 0 0 2 1 0

3 1 1 0 0 0 0 1

while word_counts should be

call here win prize money bargain information

n_ham 1 1 0 0 0 0 1

n_spam 3 1 1 1 3 1 0

6

Assessment 4 MATH70094: Programming for Data Science Autumn 2024

Part B (25 marks)

Create a script file classifier.py with a class NaiveBayes containing

• private attributes: __word_counts (a matrix), __spam_types (a list),

• public attributes: log_probs_ham (a list containing the logs of the approximated P r(Xj |H)

from the Background section), log_probs_spam (a list containing the logs of the approximated

P r(Xj |S)), log_prior_ham (the log of the approximated P r(H)), log_prior_spam (the log

of the approximated P r(S)),

• public methods:

– __init__: a function that takes word_counts and spam_types as arguments, and sets

the two corresponding private attributes;

– get_spam_types: a function that returns the private attribute spam_types;

– get_word_counts: a function that returns the private attribute word_counts;

– fit: a function that takes as argument an α value (with default α = 0.5), and sets the

values of the public attributes as described in the Background section;

– classify: a function that takes a message string, tokenizes it using the method tokenize

from Part A and returns a classification ham or spam, as explained in the Background

section; words in the message that were not seen in the training data are ignored;

– print: a print method that prints the object as specified in the example below.

In addition to providing this class, include appropriate documentation and unit tests, which test all

specifications listed above.

Continuing the example from Part A we should obtain

>>> nb <- NaiveBayes(word_counts,spam_types)

>>> nb.fit(1)

>>> nb

NaiveBayes object

vocabulary size: 7

top 5 ham words: call,here,information,win,prize

top 5 spam words: call,money,here,win,prize

(prior_ham,prior_spam): (0.3333333,0.6666667)

Here, top 5 ham words corresponds to the five largest values in log_probs_ham, and top 5 spam

words corresponds to the five largest values in log_probs_spam.

7

Assessment 4 MATH70094: Programming for Data Science Autumn 2024

Part C (15 marks)

Create a folder containing the data for a Python package called spamfilter with the code from

Parts A and B, and exposes the functions in Part A and the class in Part B to the user. Make sure

that running python -m pytest and python -m build from within the folder spamfilter in the

command line does not produce any errors or failures. The result of python -m build should be the

file spamfilter-0.0.1.tar.gz and/or spamfilter-0.0.1*******.whl in the folder spamfilter/dist,

if you have chosen version number 0.0.1 (and ******* are optional other characters).

Part D (25 marks)

Make sure that the functions and class from Parts A and B are available. Create a script file

filter.py with code as described below.

D(i)

Load the file train.csv and create with this an object from the NaiveBayes class. Fit the object

with α = 1 and print it to the console.

D(ii)

Load also the file test.csv and classify the messages in both train.csv and test.csv using the

classifier from Part D(i). Print the confusion tables (comparing true classifications to actual ones)

for both cases, and print the accuracy (diagonal of confusion matrix divided by total number of

messages in the respective set of messages) to the console. Comment briefly on the difference

between the accuracies for both cases.

D(iii)

Continuing on from D(ii) consider α now a tuning parameter. Fit NaiveBayes messages in train.csv

for 10 evenly spaced values of α in the interval [0,1]. Determine the best such α in terms of achieving

the highest accuracy when testing on the messages in test.csv.

Discuss briefly if choosing the tuning parameter α in this way is reasonable.

RH850从0搭建Autosar开发环境【3X】- Davinci Configurator之Port模块配置详解(MCAL配置) 阅读详情

相关推荐

DW1000芯片实战:如何用UWB技术打造10厘米精度的室内定位系统(附Arduino代码)

本文是一份基于DW1000芯片和UWB技术的实战指南,详细介绍了如何从零构建一个精度可达10厘米的室内定位系统。内容涵盖硬件选型与连接、软件环境配置、核心的双向测距算法实现,并深入探讨了信号干扰抑制、功耗优化等实战挑战,为物联网开发者提供了完整的Arduino代码和部署思路。

root9的博客 499

学习C#开源报表组件Seal Report(45:报表服务安全配置)

学习Seal Server Manager软件内与报表服务安全配置相关的各类属性的用途

gc_2299的博客 155

别再死磕RD算法了!用MATLAB手把手复现SAR后向投影(BP)成像(附完整代码与避坑点)

本文详细介绍了如何使用MATLAB实现合成孔径雷达(SAR)后向投影(BP)成像算法,突破传统RD算法在大斜视和复杂轨迹场景中的局限。通过完整的代码示例和避坑指南,帮助读者掌握BP算法的核心原理、内存优化策略和并行计算技巧,提升SAR成像精度与效率。

weixin_30908103的博客 300

Advance Steel工具栏菜单的创建

创建jigdesignpalettedata.xml文件并放置于...\INT\Steel\Support\Toolbars\目录下,随后修改C:\ProgramData\Autodesk\Advance Steel 2025\INT\ASSettings_User.xml,添加对应键值对以加载该配置。示例中设置面板位置、大小及可见性,通过ParentId指定父窗口,确保自定义工具栏正确显示。

Advance Steel二次开发 38

CATIA CAA 二次开发去除面内开孔

测试模型: 代码说明:以下代码在拓扑级去除Face的内部loop,更改后的Body通过oispBody参数输出。主要使用CATSmartBodyDuplicator拓扑操作实现 HRESULT CAAStarterCmd::RemoveHoleOnFace(CATBody_var &ispBody,CATBody_var &oispBody){ CATLISTP(CATCell)olistFace; ispBody->GetAllCells(olistFace,2); CATF

weixin_45445751的博客 2267

Streamlit(九) widgets-input

st.text_input / st.number_input / st.date_input / st.time_input 源码路径:${python}\Lib\site-packages\streamlit\elements\text_widgets.py(number_input.py, time_widgets.py) st.text_input st.text_input(label, value="", max_chars=None, key=None,\

heianduck的博客 3354

Swift 字符详解:从 Character 到字符串遍历

Swift中Character代表扩展字形簇,符合人类对“一个字符”的直观理解。它与String为集合关系,可通过for-in遍历或数组拼接。Character基于Unicode,组合字符(如带重音字母、表情符号)视为整体,count统计字形簇数而非码点或字节。访问需用String.Index,不可直接整数下标。字符支持比较、大小写转换及ASCII互转,但必须用双引号声明,且与String类型区分。理解其设计可避免常见错误,提升字符串处理可靠性。

2402_85743155的博客 302

AD56XXR系列DAC驱动设计:SPI接口、寄存器配置与嵌入式工程实践

数模转换器(DAC)是嵌入式系统实现高精度模拟控制的核心器件,其性能取决于通信协议可靠性、寄存器配置准确性及硬件协同设计能力。基于SPI总线的电压输出型DAC广泛应用于工业控制、光模块偏置、传感器校准等场景,需兼顾静态精度、动态响应与低功耗特性。AD56XXR系列作为典型集成内部基准与多通道同步更新能力的12/14/16位DAC,支持轨到轨输出与灵活掉电模式,为资源受限MCU提供可移植固件范式。本文围绕SPI时序约束、16位指令字解析、LDAC同步机制及精度补偿策略展开,覆盖从硬件连接、初始化流程到量产级可

weixin_33481022的博客 612

C# 系列教程_12 字符串 string 保姆级系统教程(面向新手,大量示例 + 原理讲解)

C#中string与String为同一类型,均为不可变引用类型,任何“修改”操作均返回新字符串。常用创建方式包括字面量、逐字字符串@""、插值$""及new String()。字符串本质是字符数组,支持索引访问但不可修改。所有方法如IndexOf、Substring、Replace等均不改变原字符串,返回新实例。

zhanghaha1314的博客 281

用 Custom Entity 打造 RAP Value Help:从能跑到好用的深度踩坑笔记

本文介绍了在RAP项目中实现Value Help(Fiori输入帮助)的完整流程。通过Custom Entity方式,开发者可以灵活构建不依赖数据库实体的值帮助功能,但需手动实现CDS原本提供的过滤、排序、分页等能力。文章以一个典型场景为例,详细说明了如何为Partner维护界面的City字段创建可搜索的值帮助,包括创建查询实现类、绑定CDS Custom Entity、服务发布等关键步骤,并特别指出了处理排序分页请求等常见问题。最后强调在ABAP Cloud环境下需要自行实现查询能力,而非依赖传统工具类。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 142

极智AI | 算能SC5+智算卡驱动安装与升级

大家好,我是极智视界,本文介绍一下 算能SC5+智算卡驱动安装与升级

极智视界 1278

C#转Python第5.3篇:类型提示与静态分析:Python 的“伪静态类型“

Python的类型提示是“伪静态类型”——注解由IDE和工具(如mypy)使用,解释器运行时忽略。与C#强制编译时类型检查不同,Python类型注解仅作开发辅助,提升代码可读性、智能提示与静态分析能力。通过List[int]、Optional[str]、Protocol等特性,实现类型安全与泛型支持。Python 3.14起引入延迟求值与annotationlib,优化性能并支持前向引用。核心理念:类型注解是“给开发者看的文档”,而非运行时保障。

hanzhixintianxia的博客 266

深入浅出:使用Python爬取链家二手房数据

在数据驱动的时代,房地产数据作为社会经济的重要指标,一直是数据分析师、投资者和研究人员关注的焦点。链家作为国内领先的房产中介平台,其二手房数据具有较高的真实性和时效性。然而,官方API的访问限制和数据获取的门槛,让很多初学者望而却步。本文将带你从零开始,使用Python编写一个符合robots.txt规范的链家二手房爬虫,获取标题、户型、价格等信息。文章不仅会提供完整代码,还会深入讲解反爬策略、请求头伪装、数据解析、异常处理等实战技术。目录前言:为什么要写这篇博客?一、爬虫前的准备:法律与道德。

2201_76125261的博客 93

第6章第4节:自定义分词器

本节详解Elasticsearch自定义分词器,解析analyzer三段式结构(char_filter→tokenizer→filter),掌握常用组件如ik_max_word、synonym_graph、ngram等。通过_analyze API调试分词效果,实现“索引时扩展同义词、搜索时不带”的生产级方案,提升中文搜索与智能提示体验。

啊渊的专栏 798

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

SQL 基础查询与模糊查询全解 + C# WinForm 数据库连接实战:ADO.NET、参数化查询与 where 1=1 动态条件

上篇把表建好、关系连好。,再。从select *到,从到,从拼字符串到参数化,最后讲清楚where 1=1到底解决什么问题——顺便把课上那道选择题的答案讲透。

2501_94699871的博客 172

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

C# 数据结构和特殊类型

.NET Core(现称.NET)提供丰富数据结构,优化性能与开发效率。日常开发首选List<T>和Dictionary<TKey,TValue>;高性能场景推荐Span<T>与Memory<T>减少内存分配;并发环境使用ConcurrentDictionary等线程安全集合;避免非泛型集合如ArrayList。

cccloveforever的博客 764

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

C# NModbus4 实战:ModbusTCP 读取以太网温湿度传感器

本文基于C#与NModbus4库,实战演示如何通过ModbusTCP协议读取以太网温湿度传感器(如H-THRJ45)数据。涵盖设备配置、寄存器地址解析、缩放换算及常见调试坑点,提供可运行的控制台Demo,适用于机房动环、GSP库房等物联网场景。代码支持异步扩展、数据持久化与告警逻辑,助力快速搭建自研采集系统。

weixin_41865733的博客 284

C# 系列教程_10 方法(Methods)保姆级精讲

本文系统讲解C#方法的定义与使用,涵盖语法结构、参数传递、返回值、作用域及重载机制。通过无参无返回值、有参、有返回值等示例,阐明方法如何减少冗余、提升代码可读性与维护性。重点强调方法重载(同名异参)、返回值类型不可单独决定重载、局部变量作用域限制等核心概念,并提醒新手常见误区,如缺少return、误判重载条件等。最后介绍可选参数与传值机制,帮助初学者掌握方法调用的规范与技巧。

zhanghaha1314的博客 340

BPE分词器的完整实现:字节对合并与词表构建

本文深入解析了大语言模型分词器的核心机制,以字节级BPE为例,揭示其如何将文本转化为token。通过字节编码实现无外生词(OOV)问题,但带来跨语言价差与计数故障等挑战。文章完整实现BPE训练与编码逻辑,强调预切分正则与语料配比的关键作用,并指出分词器不仅是技术组件,更是决定模型感知粒度与成本结构的底层决策——它塑造了模型对文字的理解方式,也影响着每一次推理的效率与费用。

2601_96733043的博客 269

C# ScottPlot 曲线控件

本文介绍使用ScottPlot.WinForms在WinForms中绘制高性能图表的实践。通过NuGet安装后,实现多种图形绘制:添加水平/垂直参考线、信号图与散点图(支持百万级数据)、自定义线段及多曲线叠加,并通过异步任务实现实时动态曲线更新,结合Refresh()与AutoScale优化渲染性能,有效解决大数据量下的显示问题。

m0_47020592的博客 43

C# SerpBase 谷歌搜索API:请求、建模与核账实战

上周二晚上 9 点 40 分,我还在改一个 .NET 看板:运营要监控 300 个品牌词在谷歌美国区的排名,第二天早上 10 点演示。原来基于 HtmlAgilityPack 硬解析页面的服务连续三天被拦截,返回忽长忽短。我决定连夜换成结构化搜索 API,用 C# 接,最后选了 SerpBase——它是纯 HTTP 的 POST JSON 接口,Base URL 固定为,.NET 这边不用任何第三方 SDK,一个HttpClient就能打通,而且同一个 Key 可以覆盖文档里列出的 43 个端点。

Y381532662的博客 194

用Python删除PPTX中的牛皮癣广告

本文介绍了一款免费的PPTX广告清理工具,利用Python与python-pptx库实现批量删除模板中的广告元素。该工具可自动清除幻灯片备注、母版名称、文档属性、最后两页广告页,并支持关键词搜索替换隐藏广告。通过GUI界面实现文件导入与一键清理,大幅提升效率,避免手动操作耗时出错。代码开源免费,适合需要快速处理大量带广告PPT模板的用户。

henanlion的博客 233

如何使用C#代码清理 Excel 表格中的空白行与空白列

通过 C# 代码,可以自动检查并删除 Excel 工作表中的空白行和空白列。利用IsBlank属性判断行或列是否为空,再分别调用和方法,即可完成清理操作。与手动逐行、逐列检查相比,这种方式更适合处理包含大量数据的 Excel 文件,能够减少重复操作,提高数据整理效率,使工作表保持整洁、清晰。在实际使用中,建议从工作表的末尾向前遍历并删除空白行和空白列,避免删除操作改变索引位置,影响后续检查。

2501_93070778的博客 239

使用C#代码在 Word 中设置行距和段落间距

通过 C# 代码,可以灵活调整 Word 文档中的行间距和段落间距,从而改善文档的整体排版效果。设置段前间距: 使用属性调整段落前方的空白距离。设置段后间距: 使用属性调整段落后方的空白距离。设置行间距: 使用属性控制同一段落中各行文本之间的距离。合理设置这些间距,不仅可以提高 Word 文档的可读性,还能优化页面空间利用率。这种方式适用于批量格式调整、自动化文档生成以及统一文档排版等场景。

2501_93070778的博客 201

QML学习日记 Day2:布局控件+登录界面

Column是纵向布局,里面的子控件,不要写 top、bottom、verticalCenter;Row是横向布局,里面的子控件,不要写 left、right、horizontalCenter;定位器规则:自动排布子控件,布局方向上,子控件不要写同方向锚点,会冲突;锚点原理:把控件边缘绑定到父控件、或者别的控件的边缘,窗口缩放时自动适配位置。作用:基础可视容器,用来做背景、色块、边框、圆角面板,包裹其他子控件。控件放满一行,自动换行。1. QtQuick:底层图形、基础容器、基础文字、基础输入、定位器;

2201_75293893的博客 425

Avalonia 设备监测实战设计|高频采样怎么接到实时曲线、热力图和 3D 视图?

设备每秒推来的采样批次和页面刷新的节奏通常不同。把每条采样直接推给 UI,会让绘制次数跟着输入速率增长。用做 Avalonia 监测页面时,可以把采集、显示窗口和视图更新拆开,再用测点 ID 把三个视图串起来。

2501_91602431的博客 70
上一篇: MECH201 Engineering Analysis
下一篇: The MLEnd Deception Dataset
wx____codehelp
博客等级 码龄2年 538粉丝 99原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值