I have defined the following in an attempt to export HISTORY OUTPUT data at specified nodes from abaqus odb file. It is not clear to me how to resolve this error. Any suggestions?
from odbAccess import
def main():
odb=openOdb('name.odb')
['Spatial acceleration: A1 at Node 84735155 in NSET SENSOR1',
'Spatial acceleration: A2 at Node 84735155 in NSET SENSOR2']
results = []
for i in range(len(new_list)):
f=XYDataFromHistory(odb=odb,
outputVariableName=new_list[i],
steps=('Step-4', ), name='test{}'.format(i) )
results.append(f)
Error
Traceback (most recent call last):
File "odb_processing_SSD_acceleration_export_v4.py", line 66, in <module>
main()
File "odb_processing_SSD_acceleration_export_v4.py", line 32, in main
f=XYDataFromHistory(odb=odb,
NameError: global name 'XYDataFromHistory' is not defined
Related
I am trying to run a simple example using sbmltoodepy and I am receiving the following error.
Traceback (most recent call last):
File "C:\Users\AppData\Roaming\JetBrains\PyCharm2021.2\scratches\scratch_79.py", line 8, in
ParseAndCreateModel(inputFilePath)#, jsonFilePath=None, outputFilePath=None)#, className="SBMLmodel")
File "C:\Users\AppData\Roaming\Python\Python39\site-packages\sbmltoodepy\utilities.py", line 66, in ParseAndCreateModel
modelData = ParseSBMLFile(inputFilePath)
File "C:\Users\AppData\Roaming\Python\Python39\site-packages\sbmltoodepy\parse.py", line 284, in ParseSBMLFile
assert(doc.getNumErrors() == 0)
AssertionError
Here is the code that I used.
import sbmltoodepy
from sbmltoodepy import ParseAndCreateModel
inputFilePath = "E:/Borisov2009_insulin_EGF.xml"
ParseAndCreateModel(inputFilePath, jsonFilePath=None, outputFilePath=None, className="SBMLmodel")
model = sbmltoodepy.SBMLmodel()
model.RunSimulation(1, absoluteTolerance = 1e-12, relativeTolerance = 1e-6)
Thank you in advance for your time.
I'm getting this error while calling drop.duplicate function:
Traceback (most recent call last):
File "train.py", line 159, in <module>
orders_dfx = preprocess_orders(orders_df)
File "train.py", line 20, in preprocess_orders
ao = ao.drop_duplicates(subset=['order_id'], keep='last')
AttributeError: 'TabularDataset' object has no attribute 'drop_duplicates'
Here is a part of train.py code
def preprocess_orders(ao):
ao = ao.drop_duplicates(subset=['order_id'], keep='last')
ao['order_id'] = ao['order_id'].astype('str')
ao['class'] = ao['class'].astype('int')
ao['age'] = ao['age'].astype('float').fillna(ao['age'].mean()).round(2)
return ao
orders_df = Dataset.get_by_name(ws, name='class_cancelled_orders')
orders_df.to_pandas_dataframe()
# Doing processing
orders_dfx = preprocess_orders(orders_df)
I'm getting the data from the datasets in azureml studio. The job.py file is used for running experiment as:
# submit job
run = Experiment(ws, experiment_name).submit(src)
run.wait_for_completion(show_output=True)
The to_pandas_dataframe()method returns a pandas DataFrame, so you need to assign it back your variable:
orders_df = orders_df.to_pandas_dataframe()
from weka.clusterers import Clusterer
import weka.core.converters as converters
data = converters.load_any_file("/home/ubuntu/test.csv")
data.class_is_last()
clusterer = Clusterer(classname="weka.clusterers.SimpleKMeans", options=["-N", "3"])
clusterer.build_clusterer(data)
print(clusterer)
# cluster the data
for inst in data:
cl = clusterer.cluster_instance(inst) # 0-based cluster index
dist = clusterer.distribution_for_instance(inst) # cluster membership distribution
print("cluster=" + str(cl) + ", distribution=" + str(dist))
I used the above code for doing k means custering i am not able to execute the program
The following are the errors I get
Traceback (most recent call last):
File "clus.py", line 6, in <module>
data = converters.load_any_file("/home/ubuntu/hello.csv")
File "/usr/local/lib/python2.7/dist-packages/weka/core/converters.py", line 255, in load_any_file
loader = loader_for_file(filename)
File "/usr/local/lib/python2.7/dist-packages/weka/core/converters.py", line 239, in loader_for_file
"(Ljava/lang/String;)Lweka/core/converters/AbstractFileLoader;", filename)
File "/usr/local/lib/python2.7/dist-packages/javabridge/jutil.py", line 932, in static_call
fn = make_static_call(class_name, method_name, sig)
File "/usr/local/lib/python2.7/dist-packages/javabridge/jutil.py", line 903, in make_static_call
klass = env.find_class(class_name)
AttributeError: 'NoneType' object has no attribute 'find_class'
I don't know why I am getting these errors. Can someone help me with this?
As described in the python-weka-wrapper API you have to import and start the Java Virtual Machine:
import weka.core.jvm as jvm
jvm.start()
It should solve your problem.
arcpy.env.workspace("C:/Student/PythonGP10_0/Data/SanJuan.gdb")
arcpy.env.overwriteOutput = True
fcList = arcpy.ListFeatureClasses()
bufferList = []
for fc in fcList:
if fc == "Lakes" or fc == "Streams":
arcpy.Buffer_analysis(fc, fc + "Buffer", "1000 meters")
bufferList.append(fc + "Buffer")
arcpy.Union_analysis(bufferList, "WaterBuffers")
Followed by this error when I run the script:
Traceback (most recent call last):
File "C:\Python27\ArcGIS10.2\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript
exec codeObject in __main__.__dict__
File "C:\Student\PythonGP10_0\Scripts\BufferWater.py", line 3, in <module>
arcpy.env.workspace("C:/Student/PythonGP10_0/Data/SanJuan.gdb")
TypeError: 'unicode' object is not callable
According to the ArcGIS Help, arcpy.env.workspace should be set, not to be called:
arcpy.env.workspace = "C:/Student/PythonGP10_0/Data/SanJuan.gdb"
I am using three different ways to import Plot function. All fail.
1:
from sympy import *
if __name__ == '__main__':
pp1,pp2,el1,el2=insline(0,0,4,0,1.5,1,1.5,1)
print pp1.evalf(),pp2.evalf()
p=Plot()
p[0]=el1
p[1]=el2
p[2]=Segment(pp1,pp2)
p.show()
Shows:
Traceback (most recent call last):
File "C:\Users\Erdong\workspace\Gungeo\src\gungeo.py", line 39, in <module>
p=Plot()
NameError: name 'Plot' is not defined
2:
from sympy import Point, Ellipse, intersection, Segment,plot
import math
def
...
if __name__ == '__main__':
pp1,pp2,el1,el2=insline(0,0,4,0,1.5,1,1.5,1)
print pp1.evalf(),pp2.evalf()
p=plot.Plot()
p[0]=el1
p[1]=el2
p[2]=Segment(pp1,pp2)
p.show()
Shows:
Traceback (most recent call last):
File "C:\Users\Erdong\workspace\Gungeo\src\gungeo.py", line 39, in <module>
p=plot.Plot()
AttributeError: 'function' object has no attribute 'Plot'
3.
from sympy import Plot
Shows:
Traceback (most recent call last):
File "E:\Project\Build up\programming\learn\learn.py", line 7, in <module>
from sympy import Plot
ImportError: cannot import name Plot
Please help how to import Plot from sympy-0.7.6.
I also tried:
from sympy.plotting.pygletplot import PygletPlot as Plot
But got error also:
{
Traceback (most recent call last):
File "C:\Users\Erdong\workspace\Gungeo\src\gungeo.py", line 92, in
p=Plot(el1)
File "C:\Python27\lib\site-packages\sympy\plotting\pygletplot__init__.py", line 139, in PygletPlot
import plot
File "C:\Python27\lib\site-packages\sympy\plotting\pygletplot\plot.py", line 16, in
from plot_axes import PlotAxes
File "C:\Python27\lib\site-packages\sympy\plotting\pygletplot\plot_axes.py", line 7, in
from util import strided_range, billboard_matrix
File "C:\Python27\lib\site-packages\sympy\plotting\pygletplot\util.py", line 8, in
def get_model_matrix(array_type=c_float, glGetMethod=glGetFloatv):
NameError: name 'c_float' is not defined
}
Have a look at http://docs.sympy.org/latest/modules/plotting.html. It should be
from sympy import symbols
from sympy.plotting import plot
x = symbols('x')
p = plot(x)
Maybe you want the old Plot that uses pyglet:
from sympy.plotting.pygletplot import PygletPlot as Plot