Changeset 90b9e0c in tol
- Timestamp:
- Sep 17, 2009, 2:08:10 PM (17 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- b184182
- Parents:
- 077124f
- Location:
- tol/stdlib/math/stat/models/bayesian/bysMcmc/bsr
- Files:
-
- 2 edited
-
_import.tol (modified) (5 diffs)
-
_oneNode.tol (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
tol/stdlib/math/stat/models/bayesian/bysMcmc/bsr/_import.tol
r077124f r90b9e0c 82 82 83 83 /////////////////////////////////////////////////////////////////////////// 84 Real Write.Header(NameBlock model, Real fileHandler )84 Real Write.Header(NameBlock model, Real fileHandler, Text module.type) 85 85 /////////////////////////////////////////////////////////////////////////// 86 86 { … … 98 98 "$BEGIN\n" 99 99 "\n"+ 100 "Module.Type = "+module.type+";\n" 100 101 "Model.Name = \""+model.name+"\";\n" 101 102 "Model.Description = \""+Replace(model.desc,"\n","\\n\"\n\"")+"\";\n" … … 382 383 383 384 ////////////////////////////////////////////////////////////////////////////// 384 Text _.autodoc.member.Write =385 Text _.autodoc.member.Write.Primary = 385 386 "Imports data from a model defined by a NameBlock having a set of mandatory " 386 387 "methods to get all needed information to write an ASCII file with BSR " 387 388 "format that will can be readed by function BSR.Parse "; 388 Text Write(NameBlock model) 389 Text Write.Primary(NameBlock model) 390 ////////////////////////////////////////////////////////////////////////////// 391 { 392 Text model.name = model::Get.Doc.Model.Name(0); 393 Text session.name = model::Get.Doc.Session.Name(0); 394 Text path = model::Get.Doc.Path(0); 395 Real Do OSDirMake(path); 396 397 Text file.bsr = path+model.name+"."+session.name+".bsr"; 398 Real f.bsr = FOpen(file.bsr,"w"); 399 Real If(!f.bsr, Real{ 400 WriteLn(_MID+"Cannot open "+file.bsr+" for writing.","E"); 401 Real Stop 402 }); 403 WriteLn(_MID+"File "+file.bsr+" was open successfully."); 404 405 Real numSegment = model::Get.LinReg.Size(0); 406 NameBlock segment = model::Get.LinReg.Segment(0); 407 408 Real Write.Header (model, f.bsr, "primary"); 409 Real Write.Header.MainLinearBlock (model, f.bsr); 410 Real Write.Data.MainLinearBlock (segment, f.bsr); 411 Real Write.Header.NoiseDistribution (model, f.bsr); 412 Real Write.Data.NoiseDistribution (segment, f.bsr); 413 Real Write.Header.RegressionMatrices (model, f.bsr); 414 Real Write.Data.RegressionMatrices (segment, f.bsr); 415 Real Write.Header.MissingBlock (model, f.bsr); 416 Real Write.Data.MissingBlock (segment, f.bsr); 417 Real FPutText(f.bsr,"\n$END\n"); 418 file.bsr 419 }; 420 421 ////////////////////////////////////////////////////////////////////////////// 422 Text _.autodoc.member.Write.Joint = 423 "Imports data from a model defined by a NameBlock having a set of mandatory " 424 "methods to get all needed information to write an ASCII file with BSR " 425 "format that will can be readed by function BSR.Parse "; 426 Text Write.Joint(NameBlock model) 389 427 ////////////////////////////////////////////////////////////////////////////// 390 428 { … … 409 447 Real f.con = FOpen(file.bsr+".con", "w"); 410 448 411 Real Write.Header (model, f.head );449 Real Write.Header (model, f.head, "joint"); 412 450 Real Write.Header.MainLinearBlock (model, f.lin); 413 451 Real Write.Header.MissingBlock (model, f.mis); … … 454 492 Real OSFilRemove(file.bsr+".con"); 455 493 file.bsr 494 }; 495 496 ////////////////////////////////////////////////////////////////////////////// 497 Text _.autodoc.member.Write = 498 "Imports data from a model defined by a NameBlock having a set of mandatory " 499 "methods to get all needed information to write an ASCII file with BSR " 500 "format that will can be readed by function BSR.Parse "; 501 Text Write(NameBlock model) 502 ////////////////////////////////////////////////////////////////////////////// 503 { 504 Text moduleType = ToLower(If(!FunctionExist("Text","model::Get.ModuleType"), 505 { 506 "joint" 507 }, 508 { 509 model::Get.ModuleType(0) 510 })); 511 Case 512 ( 513 moduleType=="primary", Write.Primary(model), 514 moduleType=="joint", Write.Joint (model), 515 moduleType=="master", Write.Master (model), 516 1==1, 517 { 518 Error("Invalid module type '"+moduleType+"' should be one of these " 519 "'primary', 'joint' or 'master'") 520 } 521 ) 456 522 } 457 523 524 458 525 ]]; 459 526 -
tol/stdlib/math/stat/models/bayesian/bysMcmc/bsr/_oneNode.tol
r077124f r90b9e0c 240 240 //Building generic model definition 241 241 Set modelDef = BSR.ModelDef ( 242 "joint", 242 243 docInfo = data::_.docInfo, 243 244 linearBlock,
Note: See TracChangeset
for help on using the changeset viewer.
