@@ -408,3 +408,100 @@ def other(self, other: str | types.String) -> None:
408408 other = types .String .from_mcnp (other )
409409
410410 self ._other : types .Integer = other
411+
412+ @property
413+ def nps (self ) -> types .Integer :
414+ """
415+ File nps.
416+
417+ Raises:
418+ InpError: SEMANTICS_OPTION.
419+ TypeError:
420+ """
421+
422+ try :
423+ card_nps = next (filter (lambda card : isinstance (card , inp .Data ) and isinstance (card .option , inp .data .Nps ), self .data ))
424+ return card_nps .option .npp
425+ except StopIteration :
426+ return None
427+
428+ @nps .setter
429+ def nps (self , nps : str | int | types .Integer ) -> None :
430+ """
431+ Sets ``nps``.
432+
433+ Parameters:
434+ nps: File nps.
435+
436+ Raises:
437+ InpError: SEMANTICS_OPTION.
438+ TypeError:
439+ """
440+
441+ if nps is not None :
442+ if isinstance (nps , types .Integer ):
443+ nps = nps
444+ elif isinstance (nps , int ):
445+ nps = types .Integer (nps )
446+ elif isinstance (nps , str ):
447+ nps = types .Integer .from_mcnp (nps )
448+
449+ try :
450+ card_nps = next (filter (lambda card : isinstance (card , inp .Data ) and isinstance (card .option , inp .data .Nps ), self .data ))
451+ card_nps .option .npp = nps
452+ except StopIteration :
453+ card_nps = inp .data .Nps (nps )
454+ self .data = [* self .data , inp .Data (card_nps )]
455+
456+ @property
457+ def seed (self ) -> types .Integer :
458+ """
459+ File seed.
460+
461+ Raises:
462+ InpError: SEMANTICS_OPTION.
463+ TypeError:
464+ """
465+
466+ try :
467+ card_rand = next (filter (lambda card : isinstance (card , inp .Data ) and isinstance (card .option , inp .data .Rand ), self .data ))
468+ option_seed = next (filter (lambda option : isinstance (option , inp .data .rand .Seed ), card_rand .option .options or []))
469+ return option_seed .seed
470+ except StopIteration :
471+ return None
472+
473+ @seed .setter
474+ def seed (self , seed : str | int | types .Integer ) -> None :
475+ """
476+ Sets ``seed``.
477+
478+ Parameters:
479+ seed: File seed.
480+
481+ Raises:
482+ InpError: SEMANTICS_OPTION.
483+ TypeError:
484+ """
485+
486+ if seed is not None :
487+ if isinstance (seed , types .Integer ):
488+ seed = seed
489+ elif isinstance (seed , int ):
490+ seed = types .Integer (seed )
491+ elif isinstance (seed , str ):
492+ seed = types .Integer .from_mcnp (seed )
493+
494+ try :
495+ card_rand = next (filter (lambda card : isinstance (card , inp .Data ) and isinstance (card .option , inp .data .Rand ), self .data ))
496+
497+ try :
498+ option_seed = next (filter (lambda option : isinstance (option , inp .data .rand .Seed ), card_rand .option .options or []))
499+ option_seed .seed = seed
500+ except StopIteration :
501+ option_seed = inp .data .rand .Seed (seed )
502+ card_rand .option .options = [* (card_rand .option .options or []), option_seed ]
503+
504+ except StopIteration :
505+ option_seed = inp .data .rand .Seed (seed )
506+ card_rand = inp .Data (inp .data .Rand ([option_seed ]))
507+ self .data = [* self .data , card_rand ]
0 commit comments