Module:Unicode data and DC2: Difference between pages

From Polyphasic Sleep Wiki
(Difference between pages)
m 1 revision imported
 
>GeneralNguyen
 
Line 1: Line 1:
local p = {}
{{TNT|DC2}}
== Mechanism ==
Dual Core 2, or DC2, is the second dual core schedule, a logical upgrade from DC1 with the addition of 1 nap and some sleep reduction from the core sleeps. The total sleep of DC2 hovers around the hospitable zone for long-term sustenance, approximately ~5-5.5h of total sleep each day. With 2 core sleeps placed around the sleep peaks and 2 supplemental naps in the day, DC2 is similar to E3-extended in sleep distribution and offers a decent napping frequency to learn the napping behavior. '''DC2 in a way resembles E3''', except that the first nap of E3 is now the second core in DC2.


local floor = math.floor
The first core sleep is typically longer than the second core sleep to obtain an ideally sufficient amount of SWS, while the second core has a lot of room for REM sleep. With a 3h core (2 full cycles) in SWS peak hours, SWS is likely preserved after repartitioning is completed, and SWS deprivation symptoms on DC2 are overall a lot milder than schedules with only 1-cycle core sleeps around SWS peak/night hours. The naps provide more alertness boost to sustain the long wake gap in the day as the core duration becomes shorter, and meet the remaining REM sleep requirements. The second nap on DC2 may not give any REM sleep, and just NREM2 or trace SWS instead if it is placed in mid/late afternoon (e.g, after ~4 PM). Because of the reduced total core duration compared to that of DC1, an extra nap has to be added to compensate for the reduced amount of REM sleep in the second core of DC2.  


local function errorf(level, ...)
In addition, DC2 is also a middle ground between the easier DC1 and the advanced DC3. The total sleep is not as high as DC1-extended and not as low as DC3, which is '''a favorable zone of total sleep for flexing sleep after adaptation'''. The total sleep is equivalent to E2, but the splitting of core sleeps will provide a deeper core experience for the first core, and high likelihood for vivid/lucid dreaming in the second core as SWS is met in the first core. The wake gap between 2 cores is also large enough for certain favorite nighttime activities, including certain brainstorming or somewhat mentally taxing duties without having to worry about cooling down for the second core around sunrise hours too soon. It is also possible to have a 5-6h wake gap from the morning core to the first nap, and another ~4-5h to the second nap. 4 sleeps per day also renders the wake gap between each sleep more manageable than on E2 for instance. Skipping one nap as a result may be tolerable during adaptation, as long as this does not happen too often.  
if type(level) == "number" then
return error(string.format(...), level + 1)
else -- level is actually the format string.
return error(string.format(level, ...), 2)
end
end


local function binary_range_search(codepoint, ranges)
== Adaptation ==
local low, mid, high
It is generally considered that adapting to '''multi-core schedules''' (more than 1 core sleep) is harder than to schedules with only 1 core sleep (e.g, Everyman), except in the case of naturally segmented sleepers who are used to sleeping in more than one core sleep. This is believed to be the case because repartitioning of vital sleep stages into both core sleeps becomes more complicated, and this '''doubles''' the chance for SWS wakes from both cores during adaptation. Thus, adaptation to DC2 in general is at least as difficult as that to E2, or possibly as challenging as to E3 (3.5h core) for non-natural Segmented sleepers. Initially, splitting the monophasic core sleep into 2 smaller cores can result in a much rougher wake from the first core, if the '''cold turkey adaptation method''' is chosen.  
low, high = 1, ranges.length or require "Module:TableTools".length(ranges)
while low <= high do
mid = floor((low + high) / 2)
local range = ranges[mid]
if codepoint < range[1] then
high = mid - 1
elseif codepoint <= range[2] then
return range, mid
else
low = mid + 1
end
end
return nil, mid
end
p.binary_range_search = binary_range_search


--[[
Alternatively, a gradual adaptation method from DC1 is also viable, but it also has more limited success than the cold turkey method. It is also worth noting that after the adaptation to DC2 is completed, one can proceed to flexing the naps and the core(s) and adapt to DUCAMAYL, or transition to DC3. The first core sleep on DC2 can naturally shorten by 30m (becoming 2.5h core instead) as a result of compressed repartitioning and high frequency of sleep, but this is not guaranteed for everyone.
local function linear_range_search(codepoint, ranges)
for i, range in ipairs(ranges) do
if range[1] <= codepoint and codepoint <= range[2] then
return range
end
end
end
--]]


-- Load a module by indexing "loader" with the name of the module minus the
== Alternate Variants ==
-- "Module:Unicode data/" part. For instance, loader.blocks returns
Over the years, there have been a lot of changes in DC2 scheduling. A lot of principles and bases discovered throughout these years have opened up multiple possibilities for a DC2 setup, making DC2 a very underrated schedule.  
-- [[Module:Unicode data/blocks]]. If a module cannot be loaded, false will be
-- returned.
local loader = setmetatable({}, {
__index = function (self, key)
local success, data = pcall(mw.loadData, "Module:Unicode data/" .. key)
if not success then
data = false
end
self[key] = data
return data
end
})


-- For the algorithm used to generate Hangul Syllable names,
=== Slightly modified core duration ===
-- see "Hangul Syllable Name Generation" in section 3.12 of the
[[File:DC2-mod.png|center|thumb|A DC2 variant proposed by Polyphasic Society]]
-- Unicode Specification:
This scheduling variant was proposed by <u>'''Polyphasic Society'''</u> a long time ago, which gives an extra amount of sleep reduction compared to the standard variant. Totaling 4h40m of sleep, this version may be more appealing to adapt to than the standard version, as it also gives a similar amount of total sleep to E3 (3.5h core and 3 20m naps). The basis of this version was to induce a bit more sleep reduction in the first core sleep and add a second nap. However, it is not recommended to schedule a 2.5h core from the beginning, because it likely will result in heavy SWS wakes and increases the chance for oversleeping. As mentioned above, there is still some chance for the automatic reduction in the SWS core's length after adaptation, so it is not necessary to adapt to this variant. This total sleep may also contribute to the potential inflexibility of the schedule after adaptation, or make it a lot more difficult to flex each sleep block. Throughout the years, there were '''virtually no successful adaptations to this DC2 variant'''. It may benefit sleepers with lower SWS requirements or shorter overall sleep duration on monophasic sleep, though.
-- https://www.unicode.org/versions/Unicode11.0.0/ch03.pdf
[[File:DC2-mod 2.png|center|thumb|A DC2 variant with extra sleep compression]]
local name_hooks = {
Similar to the Polyphasic Society's proposal of a possible DC2 variant, this DC2 variant stresses on the final goal once the adaptation is completed - to compress both core sleeps down to a '''multiple of 80m cycles''' (from 90m). The common approach would be to adapt to the original '''3-1.5''' standard combination, and then wait for the compression to occur, thanks to the frequency of sleep. It is not recommended to start an adaptation with this variant, however, because of the increased chance to run into SWS/REM wakes that give an excessive amount of sleep inertia that could be alleviated in the standard setup.
{    0x00,     0x1F, "<control-%04X>" }, -- C0 control characters
[[File:DC2-mod 3.png|center|thumb|A DC2-modified variant with the same sleep duration for both cores]]
{    0x7F,    0x9F, "<control-%04X>" }, -- DEL and C1 control characters
This DC2 variant offers a somewhat higher total sleep than usual (not high enough to be grouped into the extended category), and both core sleeps last for 2.5h each. So far there has only been one success with this variant, however. The premise behind this variant is to '''provide some buffer total sleep to advance to DUCAMAYL''' with both cores becoming flexible. This example sets the consideration for appropriate core durations to ensure that they can receive some flexibility after adaptation. Because of the highly uncommon and ill-advised 2.5h core duration, beginners and inexperienced polyphasic sleepers should avoid this variant.  
{  0x3400,   0x4DBF, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph Extension A
{  0x4E00,   0x9FFC, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph
{  0xAC00,  0xD7A3, function (codepoint) -- Hangul Syllables
local Hangul_data = loader.Hangul
local syllable_index = codepoint - 0xAC00


return ("HANGUL SYLLABLE %s%s%s"):format(
An easier way to schedule a similar amount of sleep duration for both cores is to have a '''3.5h core and a 1.5h core''' respectively. The 3.5h core duration has been used in E3 in a lot of successful adaptations and the idea behind it is to make use of the potential +30m from the 3h mark for more REM sleep (even though the better statistically likely REM period is oftentimes a 5h core). Once adaptation is complete, it may become more comfortable to flex both core sleeps.   
Hangul_data.leads[floor(syllable_index / Hangul_data.final_count)],
Hangul_data.vowels[floor((syllable_index % Hangul_data.final_count)
/ Hangul_data.trail_count)],
Hangul_data.trails[syllable_index % Hangul_data.trail_count]
)
end },
-- High Surrogates, High Private Use Surrogates, Low Surrogates
{  0xD800,  0xDFFF, "<surrogate-%04X>" },
{  0xE000,  0xF8FF, "<private-use-%04X>" }, -- Private Use
-- CJK Compatibility Ideographs
{  0xF900,  0xFA6D, "CJK COMPATIBILITY IDEOGRAPH-%04X" },
{  0xFA70,  0xFAD9, "CJK COMPATIBILITY IDEOGRAPH-%04X" },
{  0x17000,  0x187F7, "TANGUT IDEOGRAPH-%04X" }, -- Tangut Ideograph
{  0x18800, 0x18AFF, function (codepoint)
return ("TANGUT COMPONENT-%03d"):format(codepoint - 0x187FF)
end },
{  0x18D00,  0x18D08, "TANGUT IDEOGRAPH-%04X" }, -- Tangut Ideograph Supplement
{  0x1B170,  0x1B2FB, "NUSHU CHARACTER-%04X" }, -- Nushu
{  0x20000,  0x2A6DD, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph Extension B
{  0x2A700,  0x2B734, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph Extension C
{  0x2B740,  0x2B81D, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph Extension D
{  0x2B820,  0x2CEA1, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph Extension E
{  0x2CEB0,  0x2EBE0, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph Extension F
-- CJK Compatibility Ideographs Supplement (Supplementary Ideographic Plane)
{  0x2F800,  0x2FA1D, "CJK COMPATIBILITY IDEOGRAPH-%04X" },
{  0xE0100,  0xE01EF, function (codepoint) -- Variation Selectors Supplement
return ("VARIATION SELECTOR-%d"):format(codepoint - 0xE0100 + 17)
end},
{  0x30000,  0x3134A, "CJK UNIFIED IDEOGRAPH-%04X" }, -- CJK Ideograph Extension G
{  0xF0000,  0xFFFFD, "<private-use-%04X>" }, -- Plane 15 Private Use
{ 0x100000, 0x10FFFD, "<private-use-%04X>" }  -- Plane 16 Private Use
}
name_hooks.length = #name_hooks


local name_range_cache
=== Early rotation/Pronap ===
[[File:DC2 Early Rotation.png|center|thumb|A DC2 variant with the first nap around dawn]]
This interesting DC2 variant rotates the whole schedule backward, to earlier hours. The premise behind this distribution of sleeps is to place most sleep blocks to night hours, and only have one nap in the day. As a result, the wake gap between each core is possibly smaller than on the standard version. The first nap is placed at the usual position of the second core, and as a result, it is very similar to an Everyman schedule. The first core likely will contain most SWS needs, while the second core may be a mixed core (containing both SWS and REM, but likely more REM sleep). Both naps may contain REM sleep, which can boost the chance to recall dreams.


local function generate_name(data, codepoint)
Alternatively, the first nap can be extended to become a '''Pronap''' (e.g, 30m) to better sustain wakefulness and provide more REM sleep for individuals with somewhat higher REM requirements, because the first nap is located in REM peak. The reason a Pronap can be used is that both core sleeps mostly cover all SWS needs, leaving basically no room for SWS to occur in this hypothetical Pronap. The Pronap can then yield better wakefulness sustaining, and can become flexible after adaptation. However, it is important to note that this is a new proposal for an alternate DC2 variation, and has not been tested. There is also little incentive to try out this early rotation/Pronap variant, because the first core is too early in the evening, and becomes a liability for social time for a lot of people.
if type(data) == "string" then
return data:format(codepoint)
else
return data(codepoint)
end
end


--[[
=== Extended variant ===
-- Checks that the code point is a number and in range.
[[File:DC2-ext Base.png|center|thumb]]
-- Does not check whether code point is an integer.
DC2-extended simply extends the second core sleep by a full cycle, making it 3h total. This variant shares the same total sleep as E2-extended, with the exception of having 2 core sleeps. People with high sleep requirements (especially in both REM and SWS) can make use of the sleep frequency and the assistance from naps to meet the necessary vital sleep requirements. The only advantage of this version is that the first core can be delayed to the last hours of SWS peak - meaning it is possible to schedule this core at 11 PM or later. However, while looking realistic on paper, DC2-extended has never really reported any successes. It is also outclassed by '''E2-extended''', which is more convenient in scheduling, more success and an allegedly easier adaptation. While it is possible to schedule the first core to be 4.5h long and the second core to be 1.5h long (for more SWS recovery from intense exercising or high SWS requirement), DC2-extended is also shadowed by '''DC1-extended''', which has the same total sleep for both cores combined while only requiring 1 daytime nap (more comfortable to keep up long-term)
-- Not used
local function check_codepoint(funcName, argIdx, val)
require 'libraryUtil'.checkType(funcName, argIdx, val, 'number')
if codepoint < 0 or 0x10FFFF < codepoint then
errorf("Codepoint %04X out of range", codepoint)
end
end
--]]


-- https://www.unicode.org/versions/Unicode11.0.0/ch04.pdf, section 4.8
== Lifestyle Considerations ==
function p.lookup_name(codepoint)
In spite of the seemingly unnecessary sleep distribution across the day on DC2, it is actually viable to attempt this schedule, because of its ability to become flexible after adaptation, and even scheduling viability. For the most part, the first nap can be taken during a noon or lunch break (which is allowed in many workplaces) and the second nap can be taken after work (~4:30-5:30 PM). It is then possible to sustain 2 naps per day, with a consistent work schedules on weekdays for example.  
-- U+FDD0-U+FDEF and all code points ending in FFFE or FFFF are Unassigned
-- (Cn) and specifically noncharacters:
-- https://www.unicode.org/faq/private_use.html#nonchar4
if 0xFDD0 <= codepoint and (codepoint <= 0xFDEF
or floor(codepoint % 0x10000) >= 0xFFFE) then
return ("<noncharacter-%04X>"):format(codepoint)
end


if name_range_cache -- Check if previously used "name hook" applies to this code point.
Both core sleeps total '''at least 3 full sleep cycles''', and with the more efficient use of sleep peaks, DC2 is an underrated option to pick for some physical exercises. The second core, being safe from virtually any real-life interruptions at late hours, acts as a storage for REM sleep, which can in return boost alertness and performance before heading out to work or school. The second core, once adapted, can create a strong impression of a long, restful night sleep that is compacted down to only 90m sleep. Not only is REM sleep safer to be maintained on DC2 (compared to regular E3) but also the DC2 naps can sustain alertness after only a couple hours staying awake, replenishing the energy budget after a long morning at work/school and then another nap after work/school for extra recovery. This also indicates that DC2 is one of the few polyphasic schedules that can go well with mainstream 9-to-5 jobs '''as long as it is possible to take one nap in the middle of this work gap'''.
and codepoint >= name_range_cache[1]
and codepoint <= name_range_cache[2] then
return generate_name(name_range_cache[3], codepoint)
end
local range = binary_range_search(codepoint, name_hooks)
if range then
name_range_cache = range
return generate_name(range[3], codepoint)
end


local data = loader[('names/%03X'):format(codepoint / 0x1000)]
However, to ensure the naps have good quality, it can be tricky to plan the nap before lunch when the noon break window is too short to take both the nap and have lunch. In addition, many people can also sustain 1 daytime nap in the long run, so 2 naps may prove to be an arduous choice for long-term practice. This also calls for the viability of the '''early rotation/Pronap''' scheduling choice, at the cost of a complete sacrifice of social time in the evening. In the end, though, the first core sleep of DC2 (which is usually taken around ~9-10 PM, or at worst, 11 PM in rare cases) poses more hindrance for social life around these hours; this weakness is only mitigated on extended version, which is also outperformed by other extended schedules with the better niches they offer. Non-natural Segmented sleep habits or poor planning during the wake gap at night can quickly lead to boredom and boost the difficulty of the adaptation. Overall, even though DC2 possesses the flaws of a typical Dual Core schedule, it does offer decent variability and diversity in its scheduling potential.
if data and data[codepoint] then
return data[codepoint]
-- Unassigned (Cn) consists of noncharacters and reserved characters.
-- The character has been established not to be a noncharacter,
-- and if it were assigned, its name would already been retrieved,
-- so it must be reserved.
else
return ("<reserved-%04X>"):format(codepoint)
end
end


--[[
{{Polyphasic Sleep Schedules}}
-- No image data modules on Wikipedia yet.
[[Category:Schedules]]
function p.lookup_image(codepoint)
local data = loader[('images/%03X'):format(codepoint / 0x1000)]
if data then
return data[codepoint]
end
end
--]]
 
local planes = {
[ 0] = "Basic Multilingual Plane";
[ 1] = "Supplementary Multilingual Plane";
[ 2] = "Supplementary Ideographic Plane";
[ 3] = "Tertiary Ideographic Plane";
[14] = "Supplementary Special-purpose Plane";
[15] = "Supplementary Private Use Area-A";
[16] = "Supplementary Private Use Area-B";
}
 
-- Load [[Module:Unicode data/blocks]] if needed and assign it to this variable.
local blocks
 
local function block_iter(blocks, i)
i = i + 1
local data = blocks[i]
if data then
-- Unpack doesn't work on tables loaded with mw.loadData.
return i, data[1], data[2], data[3]
end
end
 
-- An ipairs-type iterator generator for the list of blocks.
function p.enum_blocks()
local blocks = loader.blocks
return block_iter, blocks, 0
end
 
function p.lookup_plane(codepoint)
local i = floor(codepoint / 0x10000)
return planes[i] or ("Plane %u"):format(i)
end
 
function p.lookup_block(codepoint)
local blocks = loader.blocks
local range = binary_range_search(codepoint, blocks)
if range then
return range[3]
else
return "No Block"
end
end
 
function p.get_block_info(name)
for i, block in ipairs(loader.blocks) do
if block[3] == name then
return block
end
end
end
 
function p.is_valid_pagename(pagename)
local has_nonws = false
 
for cp in mw.ustring.gcodepoint(pagename) do
if (cp == 0x0023) -- #
or (cp == 0x005B) -- [
or (cp == 0x005D) -- ]
or (cp == 0x007B) -- {
or (cp == 0x007C) -- |
or (cp == 0x007D) -- }
or (cp == 0x180E) -- MONGOLIAN VOWEL SEPARATOR
or ((cp >= 0x2000) and (cp <= 0x200A)) -- spaces in General Punctuation block
or (cp == 0xFFFD) -- REPLACEMENT CHARACTER
then
return false
end
 
local printable, result = p.is_printable(cp)
if not printable then
return false
end
 
if result ~= "space-separator" then
has_nonws = true
end
end
 
return has_nonws
end
 
local function manual_unpack(what, from)
if what[from + 1] == nil then
return what[from]
end
local result = {}
from = from or 1
for i, item in ipairs(what) do
if i >= from then
table.insert(result, item)
end
end
return unpack(result)
end
 
local function compare_ranges(range1, range2)
return range1[1] < range2[1]
end
 
-- Creates a function to look up data in a module that contains "singles" (a
-- code point-to-data map) and "ranges" (an array containing arrays that contain
-- the low and high code points of a range and the data associated with that
-- range).
-- "loader" loads and returns the "singles" and "ranges" tables.
-- "match_func" is passed the code point and either the data or the "dots", and
-- generates the final result of the function.
-- The varargs ("dots") describes the default data to be returned if there wasn't
-- a match.
-- In case the function is used more than once, "cache" saves ranges that have
-- already been found to match, or a range whose data is the default if there
-- was no match.
local function memo_lookup(data_module_subpage, match_func, ...)
local dots = { ... }
local cache = {}
local singles, ranges
 
return function (codepoint)
if not singles then
local data_module = loader[data_module_subpage]
singles, ranges = data_module.singles, data_module.ranges
end
 
if singles[codepoint] then
return match_func(codepoint, singles[codepoint])
end
 
local range = binary_range_search(codepoint, cache)
if range then
return match_func(codepoint, manual_unpack(range, 3))
end
local range, index = binary_range_search(codepoint, ranges)
if range then
table.insert(cache, range)
table.sort(cache, compare_ranges)
return match_func(codepoint, manual_unpack(range, 3))
end
if ranges[index] then
local dots_range
if codepoint > ranges[index][2] then
dots_range = {
ranges[index][2] + 1,
ranges[index + 1] and ranges[index + 1][1] - 1 or 0x10FFFF,
unpack(dots)
}
else -- codepoint < range[index][1]
dots_range = {
ranges[index - 1] and ranges[index - 1][2] + 1 or 0,
ranges[index][1] - 1,
unpack(dots)
}
end
table.sort(cache, compare_ranges)
end
return match_func(codepoint)
end
end
 
-- Get a code point's combining class value in [[Module:Unicode data/combining]],
-- and return whether this value is not zero. Zero is assigned as the default
-- if the combining class value is not found in this data module.
-- That is, return true if character is combining, or false if it is not.
-- See https://www.unicode.org/reports/tr44/#Canonical_Combining_Class_Values for
-- more information.
p.is_combining = memo_lookup(
"combining",
function (codepoint, combining_class)
return combining_class and combining_class ~= 0 or false
end,
0)
 
function p.add_dotted_circle(str)
return (mw.ustring.gsub(str, ".",
function(char)
if p.is_combining(mw.ustring.codepoint(char)) then
return '◌' .. char
end
end))
end
 
local lookup_control = memo_lookup(
"control",
function (codepoint, ccc)
return ccc or "assigned"
end,
"assigned")
p.lookup_control = lookup_control
 
function p.is_assigned(codepoint)
return lookup_control(codepoint) ~= "unassigned"
end
 
function p.is_printable(codepoint)
local result = lookup_control(codepoint)
return (result == "assigned") or (result == "space-separator"), result
end
 
function p.is_whitespace(codepoint)
local result = lookup_control(codepoint)
return (result == "space-separator"), result
end
 
p.lookup_category = memo_lookup(
"category",
function (codepoint, category)
return category
end,
"Cn")
 
local lookup_script = memo_lookup(
"scripts",
function (codepoint, script_code)
return script_code or 'Zzzz'
end,
"Zzzz")
p.lookup_script = lookup_script
 
function p.get_best_script(str)
-- Check type of argument, because mw.text.decode coerces numbers to strings!
require "libraryUtil".checkType("get_best_script", 1, str, "string")
-- Convert HTML character references (including named character references,
-- or character entities) to characters.
str = mw.text.decode(str, true)
local scripts = {}
for codepoint in mw.ustring.gcodepoint(str) do
local script = lookup_script(codepoint)
-- Ignore "Inherited", "Undetermined", or "Uncoded" scripts.
if not (script == "Zyyy" or script == "Zinh" or script == "Zzzz") then
scripts[script] = true
end
end
-- If scripts does not contain two or more keys,
-- return first and only key (script code) in table.
if not next(scripts, next(scripts)) then
return next(scripts)
end -- else return majority script, or else "Zzzz"?
end
 
function p.is_Latin(str)
require "libraryUtil".checkType("get_best_script", 1, str, "string")
str = mw.text.decode(str, true)
-- Search for the leading bytes that introduce the UTF-8 encoding of the
-- code points U+0340-U+10FFFF. If they are not found and there is at least
-- one Latin-script character, the string counts as Latin, because the rest
-- of the characters can only be Zyyy, Zinh, and Zzzz.
-- The only scripts found below U+0370 (the first code point of the Greek
-- and Coptic block) are Latn, Zyyy, Zinh, and Zzzz.
-- See the codepage in the [[UTF-8]] article.
if not str:find "[\205-\244]" then
for codepoint in mw.ustring.gcodepoint(str) do
if lookup_script(codepoint) == "Latn" then
return true
end
end
end
local Latn = false
for codepoint in mw.ustring.gcodepoint(str) do
local script = lookup_script(codepoint)
if script == "Latn" then
Latn = true
elseif not (script == "Zyyy" or script == "Zinh"
or script == "Zzzz") then
return false
end
end
return Latn
end
 
-- Checks that a string contains only characters belonging to right-to-left
-- scripts, or characters of ignorable scripts.
function p.is_rtl(str)
require "libraryUtil".checkType("get_best_script", 1, str, "string")
str = mw.text.decode(str, true)
-- Search for the leading bytes that introduce the UTF-8 encoding of the
-- code points U+0580-U+10FFFF. If they are not found, the string can only
-- have characters from a left-to-right script, because the first code point
-- in a right-to-left script is U+0591, in the Hebrew block.
if not str:find "[\214-\244]" then
return false
end
local result = false
local rtl = loader.scripts.rtl
for codepoint in mw.ustring.gcodepoint(str) do
local script = lookup_script(codepoint)
if rtl[script] then
result = true
elseif not (script == "Zyyy" or script == "Zinh"
or script == "Zzzz") then
return false
end
end
return result
end
 
local function get_codepoint(args, arg)
local codepoint_string = args[arg]
or errorf(2, "Parameter %s is required", tostring(arg))
local codepoint = tonumber(codepoint_string, 16)
or errorf(2, "Parameter %s is not a code point in hexadecimal base",
tostring(arg))
if not (0 <= codepoint and codepoint <= 0x10FFFF) then
errorf(2, "code point in parameter %s out of range", tostring(arg))
end
return codepoint
end
 
local function get_func(args, arg, prefix)
local suffix = args[arg]
or errorf(2, "Parameter %s is required", tostring(arg))
suffix = mw.text.trim(suffix)
local func_name = prefix .. suffix
local func = p[func_name]
or errorf(2, "There is no function '%s'", func_name)
return func
end
 
-- This function allows any of the "lookup" functions to be invoked. The first
-- parameter is the word after "lookup_"; the second parameter is the code point
-- in hexadecimal base.
function p.lookup(frame)
local func = get_func(frame.args, 1, "lookup_")
local codepoint = get_codepoint(frame.args, 2)
local result = func(codepoint)
if func == p.lookup_name then
-- Prevent code point labels such as <control-0000> from being
-- interpreted as HTML tags.
result = result:gsub("<", "&lt;")
end
return result
end
 
function p.is(frame)
local func = get_func(frame.args, 1, "is_")
-- is_Latin and is_valid_pagename take strings.
if func == p.is_Latin or func == p.is_valid_pagename or func == p.is_rtl then
return (func(frame.args[2]))
else -- The rest take code points.
local codepoint = get_codepoint(frame.args, 2)
return (func(codepoint)) -- Adjust to one result.
end
end
 
return p

Revision as of 09:54, 22 November 2020

DC2
Dual Core 2
chart link

Total sleep5 hours 10 minutes
Proposed byPolyphasic Society
DifficultyModerate
Specification1 dusk core, 1 dawn core, 2 daytime naps

Mechanism

Dual Core 2, or DC2, is the second dual core schedule, a logical upgrade from DC1 with the addition of 1 nap and some sleep reduction from the core sleeps. The total sleep of DC2 hovers around the hospitable zone for long-term sustenance, approximately ~5-5.5h of total sleep each day. With 2 core sleeps placed around the sleep peaks and 2 supplemental naps in the day, DC2 is similar to E3-extended in sleep distribution and offers a decent napping frequency to learn the napping behavior. DC2 in a way resembles E3, except that the first nap of E3 is now the second core in DC2.

The first core sleep is typically longer than the second core sleep to obtain an ideally sufficient amount of SWS, while the second core has a lot of room for REM sleep. With a 3h core (2 full cycles) in SWS peak hours, SWS is likely preserved after repartitioning is completed, and SWS deprivation symptoms on DC2 are overall a lot milder than schedules with only 1-cycle core sleeps around SWS peak/night hours. The naps provide more alertness boost to sustain the long wake gap in the day as the core duration becomes shorter, and meet the remaining REM sleep requirements. The second nap on DC2 may not give any REM sleep, and just NREM2 or trace SWS instead if it is placed in mid/late afternoon (e.g, after ~4 PM). Because of the reduced total core duration compared to that of DC1, an extra nap has to be added to compensate for the reduced amount of REM sleep in the second core of DC2.

In addition, DC2 is also a middle ground between the easier DC1 and the advanced DC3. The total sleep is not as high as DC1-extended and not as low as DC3, which is a favorable zone of total sleep for flexing sleep after adaptation. The total sleep is equivalent to E2, but the splitting of core sleeps will provide a deeper core experience for the first core, and high likelihood for vivid/lucid dreaming in the second core as SWS is met in the first core. The wake gap between 2 cores is also large enough for certain favorite nighttime activities, including certain brainstorming or somewhat mentally taxing duties without having to worry about cooling down for the second core around sunrise hours too soon. It is also possible to have a 5-6h wake gap from the morning core to the first nap, and another ~4-5h to the second nap. 4 sleeps per day also renders the wake gap between each sleep more manageable than on E2 for instance. Skipping one nap as a result may be tolerable during adaptation, as long as this does not happen too often.

Adaptation

It is generally considered that adapting to multi-core schedules (more than 1 core sleep) is harder than to schedules with only 1 core sleep (e.g, Everyman), except in the case of naturally segmented sleepers who are used to sleeping in more than one core sleep. This is believed to be the case because repartitioning of vital sleep stages into both core sleeps becomes more complicated, and this doubles the chance for SWS wakes from both cores during adaptation. Thus, adaptation to DC2 in general is at least as difficult as that to E2, or possibly as challenging as to E3 (3.5h core) for non-natural Segmented sleepers. Initially, splitting the monophasic core sleep into 2 smaller cores can result in a much rougher wake from the first core, if the cold turkey adaptation method is chosen.

Alternatively, a gradual adaptation method from DC1 is also viable, but it also has more limited success than the cold turkey method. It is also worth noting that after the adaptation to DC2 is completed, one can proceed to flexing the naps and the core(s) and adapt to DUCAMAYL, or transition to DC3. The first core sleep on DC2 can naturally shorten by 30m (becoming 2.5h core instead) as a result of compressed repartitioning and high frequency of sleep, but this is not guaranteed for everyone.

Alternate Variants

Over the years, there have been a lot of changes in DC2 scheduling. A lot of principles and bases discovered throughout these years have opened up multiple possibilities for a DC2 setup, making DC2 a very underrated schedule.

Slightly modified core duration

File:DC2-mod.png
A DC2 variant proposed by Polyphasic Society

This scheduling variant was proposed by Polyphasic Society a long time ago, which gives an extra amount of sleep reduction compared to the standard variant. Totaling 4h40m of sleep, this version may be more appealing to adapt to than the standard version, as it also gives a similar amount of total sleep to E3 (3.5h core and 3 20m naps). The basis of this version was to induce a bit more sleep reduction in the first core sleep and add a second nap. However, it is not recommended to schedule a 2.5h core from the beginning, because it likely will result in heavy SWS wakes and increases the chance for oversleeping. As mentioned above, there is still some chance for the automatic reduction in the SWS core's length after adaptation, so it is not necessary to adapt to this variant. This total sleep may also contribute to the potential inflexibility of the schedule after adaptation, or make it a lot more difficult to flex each sleep block. Throughout the years, there were virtually no successful adaptations to this DC2 variant. It may benefit sleepers with lower SWS requirements or shorter overall sleep duration on monophasic sleep, though.

File:DC2-mod 2.png
A DC2 variant with extra sleep compression

Similar to the Polyphasic Society's proposal of a possible DC2 variant, this DC2 variant stresses on the final goal once the adaptation is completed - to compress both core sleeps down to a multiple of 80m cycles (from 90m). The common approach would be to adapt to the original 3-1.5 standard combination, and then wait for the compression to occur, thanks to the frequency of sleep. It is not recommended to start an adaptation with this variant, however, because of the increased chance to run into SWS/REM wakes that give an excessive amount of sleep inertia that could be alleviated in the standard setup.

File:DC2-mod 3.png
A DC2-modified variant with the same sleep duration for both cores

This DC2 variant offers a somewhat higher total sleep than usual (not high enough to be grouped into the extended category), and both core sleeps last for 2.5h each. So far there has only been one success with this variant, however. The premise behind this variant is to provide some buffer total sleep to advance to DUCAMAYL with both cores becoming flexible. This example sets the consideration for appropriate core durations to ensure that they can receive some flexibility after adaptation. Because of the highly uncommon and ill-advised 2.5h core duration, beginners and inexperienced polyphasic sleepers should avoid this variant.

An easier way to schedule a similar amount of sleep duration for both cores is to have a 3.5h core and a 1.5h core respectively. The 3.5h core duration has been used in E3 in a lot of successful adaptations and the idea behind it is to make use of the potential +30m from the 3h mark for more REM sleep (even though the better statistically likely REM period is oftentimes a 5h core). Once adaptation is complete, it may become more comfortable to flex both core sleeps.

Early rotation/Pronap

File:DC2 Early Rotation.png
A DC2 variant with the first nap around dawn

This interesting DC2 variant rotates the whole schedule backward, to earlier hours. The premise behind this distribution of sleeps is to place most sleep blocks to night hours, and only have one nap in the day. As a result, the wake gap between each core is possibly smaller than on the standard version. The first nap is placed at the usual position of the second core, and as a result, it is very similar to an Everyman schedule. The first core likely will contain most SWS needs, while the second core may be a mixed core (containing both SWS and REM, but likely more REM sleep). Both naps may contain REM sleep, which can boost the chance to recall dreams.

Alternatively, the first nap can be extended to become a Pronap (e.g, 30m) to better sustain wakefulness and provide more REM sleep for individuals with somewhat higher REM requirements, because the first nap is located in REM peak. The reason a Pronap can be used is that both core sleeps mostly cover all SWS needs, leaving basically no room for SWS to occur in this hypothetical Pronap. The Pronap can then yield better wakefulness sustaining, and can become flexible after adaptation. However, it is important to note that this is a new proposal for an alternate DC2 variation, and has not been tested. There is also little incentive to try out this early rotation/Pronap variant, because the first core is too early in the evening, and becomes a liability for social time for a lot of people.

Extended variant

File:DC2-ext Base.png

DC2-extended simply extends the second core sleep by a full cycle, making it 3h total. This variant shares the same total sleep as E2-extended, with the exception of having 2 core sleeps. People with high sleep requirements (especially in both REM and SWS) can make use of the sleep frequency and the assistance from naps to meet the necessary vital sleep requirements. The only advantage of this version is that the first core can be delayed to the last hours of SWS peak - meaning it is possible to schedule this core at 11 PM or later. However, while looking realistic on paper, DC2-extended has never really reported any successes. It is also outclassed by E2-extended, which is more convenient in scheduling, more success and an allegedly easier adaptation. While it is possible to schedule the first core to be 4.5h long and the second core to be 1.5h long (for more SWS recovery from intense exercising or high SWS requirement), DC2-extended is also shadowed by DC1-extended, which has the same total sleep for both cores combined while only requiring 1 daytime nap (more comfortable to keep up long-term).

Lifestyle Considerations

In spite of the seemingly unnecessary sleep distribution across the day on DC2, it is actually viable to attempt this schedule, because of its ability to become flexible after adaptation, and even scheduling viability. For the most part, the first nap can be taken during a noon or lunch break (which is allowed in many workplaces) and the second nap can be taken after work (~4:30-5:30 PM). It is then possible to sustain 2 naps per day, with a consistent work schedules on weekdays for example.

Both core sleeps total at least 3 full sleep cycles, and with the more efficient use of sleep peaks, DC2 is an underrated option to pick for some physical exercises. The second core, being safe from virtually any real-life interruptions at late hours, acts as a storage for REM sleep, which can in return boost alertness and performance before heading out to work or school. The second core, once adapted, can create a strong impression of a long, restful night sleep that is compacted down to only 90m sleep. Not only is REM sleep safer to be maintained on DC2 (compared to regular E3) but also the DC2 naps can sustain alertness after only a couple hours staying awake, replenishing the energy budget after a long morning at work/school and then another nap after work/school for extra recovery. This also indicates that DC2 is one of the few polyphasic schedules that can go well with mainstream 9-to-5 jobs as long as it is possible to take one nap in the middle of this work gap.

However, to ensure the naps have good quality, it can be tricky to plan the nap before lunch when the noon break window is too short to take both the nap and have lunch. In addition, many people can also sustain 1 daytime nap in the long run, so 2 naps may prove to be an arduous choice for long-term practice. This also calls for the viability of the early rotation/Pronap scheduling choice, at the cost of a complete sacrifice of social time in the evening. In the end, though, the first core sleep of DC2 (which is usually taken around ~9-10 PM, or at worst, 11 PM in rare cases) poses more hindrance for social life around these hours; this weakness is only mitigated on extended version, which is also outperformed by other extended schedules with the better niches they offer. Non-natural Segmented sleep habits or poor planning during the wake gap at night can quickly lead to boredom and boost the difficulty of the adaptation. Overall, even though DC2 possesses the flaws of a typical Dual Core schedule, it does offer decent variability and diversity in its scheduling potential.