Example #1
0
 def points_table(self):
     table = MDTable()
     table.add_column('#', 'd')
     table.add_column('x', '.5f')
     table.add_column('y', '.5f')
     table.add_column('z', '.5f')
     for i in range(self.pnts.shape[0]):
         pnt = self.pnts[i, 0]
         table.add_row([i, pnt.x, pnt.y, pnt.z])
     return table
Example #2
0
 def __str__(self):
     from py2md.classes import MDTable
     table = MDTable()
     table.add_column('x', '', data=self.x)
     table.add_column('y', '', data=self.y)
     table.add_column('Gradient', '', data=self.grad)
     table.add_column('Curvature', '', data=self.curv)
     return table.__str__()
Example #3
0
 def print_gradient(self, frmstr='.6f'):
     u"""This function prints the gradient of the spline."""
     from math import cos, sin, atan2, pi
     table = MDTable()
     table.add_column('ID', 'd')
     table.add_column('dxds', frmstr)
     table.add_column('dyds', frmstr)
     table.add_column('Tangent X', frmstr)
     table.add_column('Tangent Y', frmstr)
     for i in range(self.npnts):
         dxds = self.dr[i].x
         dyds = self.dr[i].y
         tanx = cos(atan2(dyds, dxds))
         tany = sin(atan2(dyds, dxds))
         table.add_row([i, dxds, dyds, tanx, tany])
     print(table)
Example #4
0
 def point_loads_table(self, file=None):
     table = MDTable()
     table.add_column('#', 'd')
     table.add_column('x', '.3f')
     table.add_column('y', '.3f')
     table.add_column('z', '.3f')
     if self.strc.axis == 'y':
         table.add_column('Vx', '.1f')
         table.add_column('Fy', '.1f')
         table.add_column('Vz', '.1f')
         table.add_column('Mx', '.0f')
         table.add_column('Ty', '.0f')
         table.add_column('Mz', '.0f')
     elif self.strc.axis == 'z':
         table.add_column('Vx', '.1f')
         table.add_column('Vy', '.1f')
         table.add_column('Fz', '.1f')
         table.add_column('Mx', '.0f')
         table.add_column('My', '.0f')
         table.add_column('Tz', '.0f')
     for i in range(self.strc.pnts.shape[0]):
         frc = self.ptfrc[i, 0]
         mom = self.ptmom[i, 0]
         pnt = self.strc.pnts[i, 0]
         x, y, z = pnt.x, pnt.y, pnt.z
         Vx, Fy, Vz = frc.x, frc.y, frc.z
         Mx, Ty, Mz = mom.x, mom.y, mom.z
         table.add_row([i, x, y, z, Vx, Fy, Vz, Mx, Ty, Mz])
     return table
Example #5
0
 def __str__(self):
     from py2md.classes import MDTable
     outstr = '# Level Trim State ' + self.name + ' for ' + self.sys.name + '\n'
     table = MDTable()
     table.add_column('Speed', '.3f', data=[self.speed])
     table.add_column('Density', '.3f', data=[self.density])
     table.add_column('Dyn. Press.', '.3f', data=[self.dynpres])
     outstr += table._repr_markdown_()
     table = MDTable()
     table.add_column('Mass', '.3f', data=[self.mass.mass])
     table.add_column('Grav. Acc.', '.5f', data=[self.gravacc])
     table.add_column('Weight', '.3f', data=[self.weight])
     outstr += table._repr_markdown_()
     table = MDTable()
     table.add_column('Lift', '.3f', data=[self.lift])
     table.add_column('CL', '.5f', data=[self.CL])
     outstr += table._repr_markdown_()
     return outstr
Example #6
0
 def __str__(self):
     from py2md.classes import MDTable
     outstr = '# Turning Trim State ' + self.name + ' for ' + self.sys.name + '\n'
     table = MDTable()
     table.add_column('Speed', '.3f', data=[self.speed])
     table.add_column('Density', '.3f', data=[self.density])
     table.add_column('Dyn. Press.', '.3f', data=[self.dynpres])
     outstr += table._repr_markdown_()
     table = MDTable()
     table.add_column('Mass', '.3f', data=[self.mass.mass])
     table.add_column('Grav. Acc.', '.5f', data=[self.gravacc])
     table.add_column('Weight', '.3f', data=[self.weight])
     outstr += table._repr_markdown_()
     table = MDTable()
     table.add_column('Bank Angle (deg)', '.1f', data=[self.bankang])
     table.add_column('Load Factor', '.3f', data=[self.loadfac])
     table.add_column('Lift', '.3f', data=[self.lift])
     table.add_column('CL', '.5f', data=[self.CL])
     outstr += table._repr_markdown_()
     table = MDTable()
     table.add_column('Acceleration', '.3f', data=[self.acc])
     table.add_column('Turn Radius', '.3f', data=[self.rad])
     table.add_column('Pitch Rate', '.5f', data=[self.prate])
     table.add_column('Roll Rate', '.5f', data=[self.rrate])
     outstr += table._repr_markdown_()
     return outstr
Example #7
0
 def __str__(self):
     outstr = '# Lattice System ' + self.name + '\n'
     table = MDTable()
     table.add_column('Name', 's', data=[self.name])
     table.add_column('Sref', 'g', data=[self.sref])
     table.add_column('cref', 'g', data=[self.cref])
     table.add_column('bref', 'g', data=[self.bref])
     table.add_column('xref', '.3f', data=[self.rref.x])
     table.add_column('yref', '.3f', data=[self.rref.y])
     table.add_column('zref', '.3f', data=[self.rref.z])
     outstr += table._repr_markdown_()
     table = MDTable()
     if self.strps is not None:
         table.add_column('# Strips', 'd', data=[len(self.strps)])
     if self.pnls is not None:
         table.add_column('# Panels', 'd', data=[len(self.pnls)])
     if self.ctrls is not None:
         table.add_column('# Controls', 'd', data=[len(self.ctrls)])
     if len(table.columns) > 0:
         outstr += table._repr_markdown_()
     return outstr
Example #8
0
 def panel_geometry(self):
     table = MDTable()
     table.add_column('#', 'd')
     table.add_column('X', '.5f')
     table.add_column('Y', '.5f')
     table.add_column('Z', '.5f')
     table.add_column('DX', '.5f')
     table.add_column('nx', '.5f')
     table.add_column('ny', '.5f')
     table.add_column('nz', '.5f')
     for pnl in self.pnls:
         j = pnl.lpid
         x = pnl.pntg.x
         y = pnl.pntg.y
         z = pnl.pntg.z
         dx = pnl.crd
         nx = pnl.nrml.x
         ny = pnl.nrml.y
         nz = pnl.nrml.z
         table.add_row([j, x, y, z, dx, nx, ny, nz])
     return table
Example #9
0
 def strip_geometry(self):
     table = MDTable()
     table.add_column('#', 'd')
     table.add_column('xpos', '.5f')
     table.add_column('ypos', '.5f')
     table.add_column('Zle', '.5f')
     table.add_column('Chord', '.4f')
     table.add_column('Width', '.5f')
     table.add_column('Area', '.6f')
     table.add_column('Dihed', '.4f')
     table.add_column('Incid', '.4f')
     for strp in self.strps:
         j = strp.lsid
         xpos = strp.pnti.x
         ypos = strp.pnti.y
         zpos = strp.pnti.z
         chord = strp.chord
         width = strp.dst
         area = strp.area
         dihed = strp.dihedral
         twist = strp.twist
         table.add_row(
             [j, xpos, ypos, zpos, chord, width, area, dihed, twist])
     return table
Example #10
0
# # Some Markdown
# **Bold Text**
# ~~Strike-through~~
# | Column 1 | Column 2 | Column 3 |
# | -------- | -------- | -------- |
# | Value 1  | Value 2  | Value 3  |

#%%
# Import Dependencies
from IPython.display import display
from matplotlib.pyplot import figure
from py2md.classes import MDTable

#%%
# Create Table
table = MDTable()
table.add_column('y', '.2f')
table.add_column('z', '.2f')
print(table.columns[0].length)
print(table.columns[1].length)
table.add_row([15.0, 1000.0])
print(table.columns[0].length)
print(table.columns[1].length)

display(table)

#%%
# [markdown]
# # Latex Equations
# $$
# \begin{bmatrix}
Example #11
0
File: trim.py Project: Xero64/pyapm
 def __str__(self):
     from py2md.classes import MDTable
     outstr = '# Load Trim State ' + self.name + ' for ' + self.sys.name + '\n'
     table = MDTable()
     table.add_column('Speed', '.3f', data=[self.speed])
     table.add_column('Density', '.3f', data=[self.density])
     table.add_column('Dyn. Press.', '.3f', data=[self.dynpres])
     outstr += str(table)
     table = MDTable()
     table.add_column('L', '.3f', data=[self.L])
     table.add_column('Y', '.3f', data=[self.Y])
     table.add_column('l', '.3f', data=[self.l])
     table.add_column('m', '.3f', data=[self.m])
     table.add_column('n', '.3f', data=[self.n])
     outstr += str(table)
     table = MDTable()
     table.add_column('CL', '.5f', data=[self.CL])
     table.add_column('CY', '.5f', data=[self.CY])
     table.add_column('Cl', '.5f', data=[self.Cl])
     table.add_column('Cm', '.5f', data=[self.Cm])
     table.add_column('Cn', '.5f', data=[self.Cn])
     outstr += str(table)
     return outstr
Example #12
0
File: trim.py Project: Xero64/pyapm
 def __str__(self):
     from py2md.classes import MDTable
     outstr = '# Looping Trim State ' + self.name + ' for ' + self.sys.name + '\n'
     table = MDTable()
     table.add_column('Speed', '.3f', data=[self.speed])
     table.add_column('Density', '.3f', data=[self.density])
     table.add_column('Dyn. Press.', '.3f', data=[self.dynpres])
     outstr += str(table)
     table = MDTable()
     table.add_column('Mass', '.3f', data=[self.mass.mass])
     table.add_column('Grav. Acc.', '.5f', data=[self.gravacc])
     table.add_column('Weight', '.3f', data=[self.weight])
     outstr += str(table)
     table = MDTable()
     table.add_column('Load Factor', '.3f', data=[self.loadfac])
     table.add_column('Lift', '.3f', data=[self.lift])
     table.add_column('CL', '.5f', data=[self.CL])
     outstr += str(table)
     table = MDTable()
     table.add_column('Acceleration', '.3f', data=[self.acc])
     table.add_column('Radius', '.3f', data=[self.rad])
     table.add_column('Pitch Rate', '.5f', data=[self.prate])
     outstr += str(table)
     return outstr
Example #13
0
def mass_table(masses):
    from py2md.classes import MDTable
    masslst = []
    if isinstance(masses, dict):
        masslst = [masses[m] for m in masses]
    elif isinstance(masses, list):
        masslst = masses
    table = MDTable()
    table.add_column('Name', 's')
    table.add_column('Mass', '.3f')
    table.add_column('xcm', '.3f')
    table.add_column('ycm', '.3f')
    table.add_column('zcm', '.3f')
    table.add_column('Ixx', '.1f')
    table.add_column('Ixy', '.1f')
    table.add_column('Ixz', '.1f')
    table.add_column('Iyy', '.1f')
    table.add_column('Iyz', '.1f')
    table.add_column('Izz', '.1f')
    for mass in masslst:
        table.add_row([
            mass.name, mass.mass, mass.xcm, mass.ycm, mass.zcm, mass.Ixx,
            mass.Ixy, mass.Ixz, mass.Iyy, mass.Iyz, mass.Izz
        ])
    return table
Example #14
0
 def __str__(self):
     from py2md.classes import MDTable
     outstr = '# ' + self.name + '\n'
     table = MDTable()
     table.add_column('Speed', 'g', data=[self.speed])
     table.add_column('Density', 'g', data=[self.rho])
     outstr += table._repr_markdown_()
     if self._phi is not None:
         table = MDTable()
         table.add_column('Label', 's')
         table.add_column('Type', 's')
         table.add_column('Value', 'g')
         table.add_row(['Di', 'Objective', self.return_induced_drag()])
         if self.constr is not None:
             for constr in self.constr:
                 val = constr.evaluate()
                 table.add_row([constr.param, 'Constraint', val])
         if self.record is not None:
             for record in self.record:
                 val = record.evaluate()
                 table.add_row([record.param, 'Record', val])
         outstr += table._repr_markdown_()
     return outstr
Example #15
0
 def __str__(self):
     outstr = f'# {self.pres.name} Design Loads for ' + self.strc.srfc.name+'\n'
     table = MDTable()
     table.add_column('Reference', 's')
     table.add_column('x', '.3f')
     table.add_column('y', '.3f')
     table.add_column('z', '.3f')
     table.add_column('Fx', '.1f')
     table.add_column('Fy', '.1f')
     table.add_column('Fz', '.1f')
     table.add_column('Mx', '.1f')
     table.add_column('My', '.1f')
     table.add_column('Mz', '.1f')
     x = self.rref.x
     y = self.rref.y
     z = self.rref.z
     Fx = self.frctot.x
     Fy = self.frctot.y
     Fz = self.frctot.z
     Mx = self.momtot.x
     My = self.momtot.y
     Mz = self.momtot.z
     table.add_row(['Total', x, y, z, Fx, Fy, Fz, Mx, My, Mz])
     outstr += str(table)
     table = MDTable()
     table.add_column('Reaction', 'd')
     table.add_column('x', '.3f')
     table.add_column('y', '.3f')
     table.add_column('z', '.3f')
     table.add_column('Fx', '.1f')
     table.add_column('Fy', '.1f')
     table.add_column('Fz', '.1f')
     table.add_column('Mx', '.1f')
     table.add_column('My', '.1f')
     table.add_column('Mz', '.1f')
     for i, rpnt in enumerate(self.strc.rpnts):
         rfrc = self.rfrc[i]
         rmom = self.rmom[i]
         table.add_row([i+1, rpnt.x, rpnt.y, rpnt.z, rfrc.x, rfrc.y, rfrc.z, rmom.x, rmom.y, rmom.z])
     outstr += str(table)
     table = MDTable()
     table.add_column('Value', 's')
     if self.strc.axis == 'y':
         table.add_column('Vx', '.1f')
         table.add_column('Fy', '.1f')
         table.add_column('Vz', '.1f')
         table.add_column('Mx', '.1f')
         table.add_column('Ty', '.1f')
         table.add_column('Mz', '.1f')
     elif self.strc.axis == 'z':
         table.add_column('Vx', '.1f')
         table.add_column('Vy', '.1f')
         table.add_column('Fz', '.1f')
         table.add_column('Mx', '.1f')
         table.add_column('My', '.1f')
         table.add_column('Tz', '.1f')
     Vx = self.frcmin.x
     Fy = self.frcmin.y
     Vz = self.frcmin.z
     Mx = self.mommin.x
     Ty = self.mommin.y
     Mz = self.mommin.z
     table.add_row(['Min', Vx, Fy, Vz, Mx, Ty, Mz])
     Vx = self.frcmax.x
     Fy = self.frcmax.y
     Vz = self.frcmax.z
     Mx = self.mommax.x
     Ty = self.mommax.y
     Mz = self.mommax.z
     table.add_row(['Max', Vx, Fy, Vz, Mx, Ty, Mz])
     outstr += str(table)
     return outstr
Example #16
0
 def __str__(self):
     from py2md.classes import MDTable
     table = MDTable()
     table.add_column('x', ':', data=self.x)
     table.add_column('y', ':', data=self.y)
     return table.__str__()
Example #17
0
 def __str__(self):
     outstr = '# Panel System '+self.name+'\n'
     table = MDTable()
     table.add_column('Name', 's', data=[self.name])
     table.add_column('Sref', 'g', data=[self.sref])
     table.add_column('cref', 'g', data=[self.cref])
     table.add_column('bref', 'g', data=[self.bref])
     table.add_column('xref', '.3f', data=[self.rref.x])
     table.add_column('yref', '.3f', data=[self.rref.y])
     table.add_column('zref', '.3f', data=[self.rref.z])
     outstr += table._repr_markdown_()
     table = MDTable()
     if self.grds is not None:
         table.add_column('# Grids', 'd', data=[self.numgrd])
     else:
         table.add_column('# Grids', 'd', data=[0])
     if self.pnls is not None:
         table.add_column('# Panels', 'd', data=[self.numpnl])
     else:
         table.add_column('# Panels', 'd', data=[0])
     if self.hsvs is not None:
         table.add_column('# Horseshoe Vortices', 'd', data=[self.numhsv])
     else:
         table.add_column('# Horseshoe Vortices', 'd', data=[0])
     if self.ctrls is not None:
         table.add_column('# Controls', 'd', data=[self.numctrl])
     else:
         table.add_column('# Controls', 'd', data=[0])
     if len(table.columns) > 0:
         outstr += table._repr_markdown_()
     return outstr