Esempio n. 1
0
    def generate_fname(cls,
                       Ch_list=None,
                       Nwalls=None,
                       Ntubes=None,
                       nx=None,
                       ny=None,
                       bundle_geometry=None,
                       bundle_packing=None,
                       **kwargs):
        Nwalls = '{}wall_mwnt'.format(Nwalls)
        chiralities = '@'.join([str(Ch).replace(' ', '') for Ch in Ch_list])
        packing = '{}cp'.format(bundle_packing[0])
        Ntubes = '{}tube'.format(Ntubes)

        fname_wordlist = None
        if bundle_geometry is None:
            nx = ''.join(('{}'.format(nx), pluralize('cell', nx)))
            ny = ''.join(('{}'.format(ny), pluralize('cell', ny)))
            cells = 'x'.join((nx, ny))

            if nx == 1 and ny == 1:
                fname_wordlist = (Nwalls, chiralities, cells)
            else:
                fname_wordlist = (Nwalls, chiralities, packing, cells)
        else:
            fname_wordlist = \
                (Nwalls, chiralities, packing, Ntubes, bundle_geometry)

        fname = '_'.join(fname_wordlist)
        return fname
    def generate_fname(
        cls,
        Ch_list=None,
        Nwalls=None,
        Ntubes=None,
        nx=None,
        ny=None,
        bundle_geometry=None,
        bundle_packing=None,
        **kwargs
    ):
        Nwalls = "{}wall_mwnt".format(Nwalls)
        chiralities = "@".join([str(Ch).replace(" ", "") for Ch in Ch_list])
        packing = "{}cp".format(bundle_packing[0])
        Ntubes = "{}tube".format(Ntubes)

        fname_wordlist = None
        if bundle_geometry is None:
            nx = "".join(("{}".format(nx), pluralize("cell", nx)))
            ny = "".join(("{}".format(ny), pluralize("cell", ny)))
            cells = "x".join((nx, ny))

            if nx == 1 and ny == 1:
                fname_wordlist = (Nwalls, chiralities, cells)
            else:
                fname_wordlist = (Nwalls, chiralities, packing, cells)
        else:
            fname_wordlist = (Nwalls, chiralities, packing, Ntubes, bundle_geometry)

        fname = "_".join(fname_wordlist)
        return fname
    def generate_fname(cls, n=None, m=None, nx=None, nz=None, fix_Lx=False, fix_Lz=False, **kwargs):
        chirality = "{}{}".format("{}".format(n).zfill(2), "{}".format(m).zfill(2))

        nx_fmtstr = "{:.2f}" if fix_Lx else "{:.0f}"
        nx = "".join((nx_fmtstr.format(nx), pluralize("cell", nx)))

        nz_fmtstr = "{:.2f}" if fix_Lz else "{:.0f}"
        nz = "".join((nz_fmtstr.format(nz), pluralize("cell", nz)))

        cells = "x".join((nx, nz))
        fname_wordlist = (chirality, cells)

        fname = "unrolled_" + "_".join(fname_wordlist)
        return fname
    def generate_fname(cls, n=None, m=None, nx=None, nz=None,
                       fix_Lx=False, fix_Lz=False, **kwargs):
        chirality = '{}{}'.format('{}'.format(n).zfill(2),
                                  '{}'.format(m).zfill(2))

        nx_fmtstr = '{:.2f}' if fix_Lx else '{:.0f}'
        nx = ''.join((nx_fmtstr.format(nx), pluralize('cell', nx)))

        nz_fmtstr = '{:.2f}' if fix_Lz else '{:.0f}'
        nz = ''.join((nz_fmtstr.format(nz), pluralize('cell', nz)))

        cells = 'x'.join((nx, nz))
        fname_wordlist = (chirality, cells)

        fname = 'unrolled_' + '_'.join(fname_wordlist)
        return fname
Esempio n. 5
0
    def generate_fname(cls, n=None, m=None, nz=None, fix_Lz=False,
                       **kwargs):

        chirality = '{}{}'.format('{}'.format(n).zfill(2),
                                  '{}'.format(m).zfill(2))
        nz_fmtstr = '{:.2f}' if fix_Lz else '{:.0f}'
        nz = ''.join((nz_fmtstr.format(nz), pluralize('cell', nz)))
        fname_wordlist = (chirality, nz)
        fname = '_'.join(fname_wordlist)
        return fname
    def generate_fname(cls, n=None, m=None, nx=None, ny=None, nz=None,
                       fix_Lz=False, Ntubes=None, bundle_geometry=None,
                       bundle_packing=None, **kwargs):
        chirality = '{}{}'.format('{}'.format(n).zfill(2),
                                  '{}'.format(m).zfill(2))
        packing = '{}cp'.format(bundle_packing[0])
        Ntube = '{}tube'.format(Ntubes)

        fname_wordlist = None
        if bundle_geometry is None:
            nx = ''.join(('{}'.format(nx),
                         pluralize('cell', nx)))
            ny = ''.join(('{}'.format(ny),
                         pluralize('cell', ny)))
            nz_fmtstr = '{:.2f}' if fix_Lz else '{:.0f}'
            nz = ''.join((nz_fmtstr.format(nz), pluralize('cell', nz)))
            cells = 'x'.join((nx, ny, nz))
            fname_wordlist = (chirality, packing, cells)
        else:
            fname_wordlist = \
                (chirality, packing, Ntube, bundle_geometry)

        fname = '_'.join(fname_wordlist)
        return fname
Esempio n. 7
0
def test2():
    lst = [1]
    assert_equal(pluralize('item', len(lst)), 'item')
Esempio n. 8
0
def test1():
    lst = [1, 2, 2, 3, 4, 50, 50, 4, 5]
    assert_equal(pluralize('item', len(lst)), 'items')