<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Generate large frames for testing
Step1:  On Flex 5
Step2:  On Flex 5
<ASSISTANT_TASK:>
Python Code:
from Frame2D import Frame2D
from Tables import Table, DataSource
import numpy as np
import pandas as pd
## NOTE: all units are kN and m
FD = {'storey_heights': [6.5] + [5.5]*20 + [7.0],   # m
      'bay_widths': [10.5,10,10,10,10,10.5],        # m
      'frame_spacing':8,                            # m, used only for load calculation
      'specified_loads':{'live':2.4,'dead':4.0,'snow':2.5,'wind':2.5},  # kPa
      'load_combinations':{'Case-2a':{'dead':1.25,'live':1.5,'snow':0.5},
                           'Case-2b':{'dead':1.25,'live':1.5,'wind':0.4},
                           'Case-3a':{'dead':1.25,'snow':1.5,'live':0.5},
                           'Case-3b':{'dead':1.25,'snow':1.5,'wind':0.4},
                           'Case-4a':{'dead':1.25,'wind':1.4,'live':0.5},
                           'Case-4b':{'dead':1.25,'wind':1.4,'snow':0.5},
                          },
      'load_combo':'Case-2b',
      'braced_bays':[0,2,3,5],
      'support_fixity': ['fx,fy']*7,
      'beam_size': 'W1000x222',
      'column_size': 'W360x216',
      }
SaveData = True
ShowResults = True
FD
def genframe(fd):
    h = fd['storey_heights']
    w = fd['bay_widths']
    s = fd['frame_spacing']
    nnodes = (len(h)+1)*(len(w)+1)
    
    # names of column stacks and floor levels
    bayline = [chr(ord('A')+i) for i in range(len(w)+1)]
    floorlev = [str(i) for i in range(len(h)+1)]
    
    # generate the nodes
    nodelist = []
    nidgrid = np.ndarray((len(h)+1,len(w)+1),dtype=np.object)
    for i in range(len(h)+1):
        y = sum(h[:i])*1000.
        for j in range(len(w)+1):
            x = sum(w[:j])*1000.
            nid = bayline[j]+floorlev[i]
            nodelist.append((nid,x,y))
            nidgrid[i,j] = nid
    nodes = pd.DataFrame(nodelist,columns=['NODEID','X','Y'])
    
    # generate the supports
    assert len(fd['support_fixity'])==nidgrid.shape[1]
    supplist = []
    for j,s in enumerate(fd['support_fixity']):
        nid = nidgrid[0,j]
        fix = s.strip().upper().split(',')
        if len(fix) < 3:
            fix += [np.nan] * (3-len(fix))
        supplist.append([nid,]+fix)
    supports = pd.DataFrame(supplist,columns=['NODEID','C0','C1','C2'])
    
    # generate columns
    columns = []
    for i in range(nidgrid.shape[0]-1):
        for j in range(nidgrid.shape[1]):
            nidj = nidgrid[i,j]
            nidk = nidgrid[i+1,j]
            mid = 'C' + nidj + nidk
            columns.append((mid,nidj,nidk))
    
    # generate beams
    beams = []
    roofbeams = []
    pinnedbeams = []
    for i in range(1,nidgrid.shape[0]):
        beamlist = beams if i < nidgrid.shape[0]-1 else roofbeams
        for j in range(nidgrid.shape[1]-1):
            nidj = nidgrid[i,j]
            nidk = nidgrid[i,j+1]
            mid = 'B' + nidj + nidk
            beamlist.append((mid,nidj,nidk))
            if j not in fd['braced_bays']:
                pinnedbeams.append(mid)
    members = pd.DataFrame(columns+beams+roofbeams,columns=['MEMBERID','NODEJ','NODEK'])
    
    # generate releases
    rellist = []
    for mid in pinnedbeams:
        rellist.append((mid,'MZJ'))
        rellist.append((mid,'MZK'))
    releases = pd.DataFrame(rellist,columns=['MEMBERID','RELEASE'])
    
    # generate properties
    proplist = []
    size = fd['column_size']
    for mid,j,k in columns:
        proplist.append((mid,size,np.nan,np.nan))
        size = np.nan
    size = fd['beam_size']
    for mid,j,k in beams+roofbeams:
        proplist.append((mid,size,np.nan,np.nan))
        size = np.nan
    properties = pd.DataFrame(proplist,columns=['MEMBERID','SIZE','IX','A'])
    
    # generate node loads (wind from left)
    nloadlist = []
    L = fd['specified_loads']   # area loads
    for i in range(1,nidgrid.shape[0]+1):
        H = (sum(h[:i+1])-sum(h[:i-1]))/2.
        FL = H*fd['frame_spacing']*L['wind']
        if FL != 0.:
            nloadlist.append(('wind',nidgrid[i,0],'FX',FL*1000.))
    node_loads = pd.DataFrame(nloadlist,columns=['LOAD','NODEID','DIRN','F'])
    
    # generate member loads
    mloadlist = []
    UDL = -L['dead']*fd['frame_spacing']
    mloadlist += [('dead',mid,'UDL',UDL,np.nan,np.nan,np.nan,np.nan) for mid,nj,nk in beams]
    mloadlist += [('dead',mid,'UDL',UDL,np.nan,np.nan,np.nan,np.nan) for mid,nj,nk in roofbeams]
    UDL = -L['live']*fd['frame_spacing']
    mloadlist += [('live',mid,'UDL',UDL,np.nan,np.nan,np.nan,np.nan) for mid,nj,nk in beams]
    UDL = -L['snow']*fd['frame_spacing']
    mloadlist += [('snow',mid,'UDL',UDL,np.nan,np.nan,np.nan,np.nan) for mid,nj,nk in roofbeams]
    member_loads = pd.DataFrame(mloadlist,columns='LOAD,MEMBERID,TYPE,W1,W2,A,B,C'.split(','))
    
    # generate load combinations
    lclist = []
    for case,loads in fd['load_combinations'].items():
        for load,factor in loads.items():
            lclist.append((case,load,factor))
    load_combinations = pd.DataFrame(lclist,columns=['CASE','LOAD','FACTOR'])
    
    ds = DataSource
    ds.set_source(None)
    ds.set_table('nodes',nodes)
    ds.set_table('supports',supports)
    ds.set_table('members',members)
    ds.set_table('releases',releases)
    ds.set_table('properties',properties)
    ds.set_table('node_loads',node_loads)
    ds.set_table('member_loads',member_loads)
    ds.set_table('load_combinations',load_combinations)
    
    frame = Frame2D()
    frame.input_all()                          
    return frame
%time f = genframe(FD)
Explanation: Generate large frames for testing
End of explanation
if SaveData:
    NS = len(FD['storey_heights'])
    NB = len(FD['bay_widths'])
    name = 'l{}x{}'.format(NS,NB)
    f.write_all(name,makedir=True)
%time rs = f.solve(FD['load_combo'])
Explanation: On Flex 5:
CPU times: user 261 ms, sys: 7.8 ms, total: 269 ms
Wall time: 264 ms
On yoga260:
CPU times: user 289 ms, sys: 1.5 ms, total: 290 ms
   Wall time: 294 ms
On post:
CPU times: user 390 ms, sys: 23.9 ms, total: 414 ms
Wall time: 394 ms
End of explanation
if ShowResults:
    f.print_input()
if ShowResults:
    f.print_results(rs)
if SaveData:
    f.write_results(name,rs)
%matplotlib inline
f.show()
Explanation: On Flex 5:
```
CPU times: user 115 ms, sys: 35.8 ms, total: 151 ms
Wall time: 82.9 ms
CPU times: user 132 ms, sys: 36.7 ms, total: 168 ms
Wall time: 95.2 ms
```
On yoga260:
```
CPU times: user 73 ms, sys: 56 ms, total: 129 ms
Wall time: 85.4 ms
CPU times: user 263 ms, sys: 113 ms, total: 375 ms
Wall time: 163 ms
```
On post:
CPU times: user 127 ms, sys: 91 ms, total: 218 ms
Wall time: 109 ms
End of explanation
<END_TASK>