for ihrd in xrange(nfs): ## type of hardening function if not (ivpsc_hard): hfnDill = gen_tempfile(prefix='hfs', ext='dll') with open(hfnDill, 'wb') as fo: dill.dump(hfs_labels[ihrd], fo) dill.dump(hfs_params[ihrd], fo) ## dump hardening parameters. for ieps in xrange(neps_eq): for iyld in xrange(nyfs): ## type of yield function ## Save using dill yfnDill = gen_tempfile(prefix='yfs-%s' % yfs_labels[iyld], ext='pck') hashcode = etc.gen_hash_code2(nchar=6) with open(yfnDill, 'wb') as fo_: if fo_.closed: raise IOError, 'File was closed %s' % yfnDill try: print 'yfs[ieps][iyld]:', yfs[ieps][iyld] except: print len(yfs) raise IOError, 'Error!!!' # dill.dump(yfs[ieps][iyld],fo_) # dill.dump(yfs_labels[iyld],fo_) # dill.dump(yfs_params[ieps][iyld],fo_) # pickle.dump(yfs[ieps][iyld],fo_) pickle.dump(yfs_labels[iyld], fo_)
nyfs = len(yfs[0]) for ihrd in xrange(nfs): ## type of hardening function if not(ivpsc_hard): hfnDill = gen_tempfile(prefix='hfs',ext='dll') with open(hfnDill, 'wb') as fo: dill.dump(hfs_labels[ihrd],fo) dill.dump(hfs_params[ihrd],fo) ## dump hardening parameters. for ieps in xrange(neps_eq): for iyld in xrange(nyfs): ## type of yield function ## Save using dill yfnDill = gen_tempfile(prefix='yfs-%s'%yfs_labels[iyld],ext='pck') hashcode = etc.gen_hash_code2(nchar=6) with open(yfnDill,'wb') as fo_: if fo_.closed: raise IOError, 'File was closed %s'%yfnDill try: print 'yfs[ieps][iyld]:',yfs[ieps][iyld] except: print len(yfs) raise IOError,'Error!!!' # dill.dump(yfs[ieps][iyld],fo_) # dill.dump(yfs_labels[iyld],fo_) # dill.dump(yfs_params[ieps][iyld],fo_) # pickle.dump(yfs[ieps][iyld],fo_) pickle.dump(yfs_labels[iyld],fo_)
parser.add_argument( '--nr',type=int,help='number of rhos') parser.add_argument( '--mat', type=int, default=-1, help='Material card in materials.py - see <def library> in materials.py\n(0: IsoMat, 1:)') parser.add_argument( '--fnyld', type=str,default=None, help='yield function pickled file name') parser.add_argument( '--fnhrd', type=str,default=None, help='strain hardening function pickled file name') parser.add_argument( '--fnhrd_vpsc', type=str,default=None, help='strain hardening function pickled file name, which is characterized by VPSC model runs') parser.add_argument( '--hash', type=str,default=etc.gen_hash_code2(nchar=6), help='unique hash code for identity') parser.add_argument('--dry',dest='dry',action='store_true', default=False) ## rho to theta? ( should be later passed as arguments) args = parser.parse_args() rhos = np.linspace(args.r0,args.r1,args.nr) print 'rhos:', rhos ivpsc_hard = False if type(args.fnhrd_vpsc).__name__!='NoneType': ivpsc_hard=True if ivpsc_hard: print 'Read based on VPSC hardening fittings'