所以我试图通过做一点多处理来加快我的计算时间
我正在尝试使用池工人.
在我的代码的顶部,我有
import Singal as s
import multiprocessing as mp
def wrapper(Channel):
Noise_Frequincies = []
for i in range(1,125):
Noise_Frequincies.append(60.0*float(i))
Noise_Frequincies.append(180.0)
filter1 = s.Noise_Reduction(Sample_Rate,Noise_Frequincies,Channel)
return filter1
Run Code Online (Sandbox Code Playgroud)
然后到时候我用
Both_Channels = [Chan1, Chan2]
results = mp.Pool(2).map(wrapper,Both_Channels)
filter1 = results[0]
filter2 = results[1]
Run Code Online (Sandbox Code Playgroud)
我收到以下错误
Exception in thread Thread-2:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 808, in __bootstrap_inner
self.run()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 761, in run
self.__target(*self.__args, **self.__kwargs)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py", line 342, in _handle_tasks
put(task)
PicklingError: Can't pickle <type 'function'>: attribute lookup …
Run Code Online (Sandbox Code Playgroud) 所以我正在尝试对一个块进行单元测试
我的测试很简单
test("When loading patients, bloc should emmit [Loading], [OwnersLoaded]", (){
//arrange
var owners = [Owner(id: "TestId")];
when (mockPatientsRepository.getOwnersForCurrentPractice()).thenAnswer((_)=>Future.value(owners));
final List<PatientsState> expected = [patientsBloc.initialState, Loading(), OwnersLoaded(owners)];
//assert later
expectLater(patientsBloc, emitsInOrder(expected));
//act
useCase.getPatients();
});
Run Code Online (Sandbox Code Playgroud)
所有者确实覆盖了等于和哈希
我的错误信息
Expected: should do the following in order:
• emit an event that <Instance of 'InitialPatientsState'>
• emit an event that <Instance of 'Loading'>
• emit an event that <Instance of 'OwnersLoaded'>
Actual: <Instance of 'PatientsBloc'>
Which: emitted • Instance of 'InitialPatientsState'
• Instance of 'Loading' …
Run Code Online (Sandbox Code Playgroud) 我已经尝试添加以下 CSS,以及几乎所有的组合
html, body {
margin: 0;
height: 100%;
}
.fill-height {
min-height: 100%;
height:auto !important; /* cross-browser */
height: 100%; /* cross-browser */
}
#root > [data-reactroot] { height: 100vh }
Run Code Online (Sandbox Code Playgroud) 所以我正在为网络应用程序创建一个颤振。有点冒险,但我真的只想要一个初始原型,希望当我需要准备好生产时,它至少处于测试阶段。
无论如何,我正在尝试创建一个登录页面,但实际上无法在 TextFiled 中输入任何内容。
我尝试添加/删除 TextEditingController 和输入装饰。我也尝试过 TextField 和 TextFormField
Widget loginWidget() {
return Container(
width: 650,
child: Card(
margin: EdgeInsets.all(5.0),
color: UiColors.CardBlue,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
MaterialButton(
minWidth: 300,
color: UiColors.CardBlue,
child: Text("Login", style: TextStyle(color: Colors.white),),
onPressed: (){}, // do nothing, this is already the login
),
MaterialButton(
minWidth: 300,
elevation: 10,
color: UiColors.ButtonBlue,
child: Text("Register", style: TextStyle(color: Colors.white),),
onPressed: toggleLogin,
)
],
),
TextField(
controller: usernameController,
decoration: InputDecoration(
border: …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用多处理来处理我的内存问题,但是我无法获取要腌制的函数,而且我不知道为什么。我的主要代码开始于
def main():
print "starting main"
q = Queue()
p = Process(target=file_unpacking,args=("hellow world",q))
p.start()
p.join()
if p.is_alive():
p.terminate()
print "The results are in"
Chan1 = q.get()
Chan2 = q.get()
Start_Header = q.get()
Date = q.get()
Time = q.get()
return Chan1, Chan2, Start_Header, Date, Time
def file_unpacking(args, q):
print "starting unpacking"
fileName1 = "050913-00012"
unpacker = UnpackingClass()
for fileNumber in range(0,44):
fileName = fileName1 + str(fileNumber) + fileName3
header, data1, data2 = UnpackingClass.unpackFile(path,fileName)
if header == None:
logging.warning("curropted file found at …
Run Code Online (Sandbox Code Playgroud) flutter ×2
python ×2
css ×1
flutter-test ×1
flutter-web ×1
html ×1
pickle ×1
pool ×1
reactjs ×1